I'm trying to test that a certain function I'm building will add objects to a collection when supplied with a collection of Ids.
My test looks something like this:
var someClass = new SomeClass();
var someIds = new List<Guid> { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
someClass.AddIds(someIds);
Asset.That(someClass.IdsInClass, List.???);
The property IdsInClass is actually an IList and for the sake of argument lets say that it looks something like this:
public class SomeOtherClass
{
public Guid Id { get; set; }
public SomeClass Parent { get; set; }
//other properties we don't care about for this test
}
I want to make sure that all the ids I made in my test are being added to someClass.IdsInClass
What is the best way to do that?
I was thinking maybe an expression would work like so:
Assert.That(someClass.IdsInClass,
List<SomeOtherClass>.HasAll(x => someIds.Contains(x.Id));
But I don't know if anything like that exists.