I try to make a test using FluentAssertion pass but i get the famous "System.InvalidOperationException : No members were found for comparison" and i don't know how i can make it pass in this specific context.
The root compared object type has a private inner list of objects (Light) and i don't know how to write the config options object of BeEquivalentTo function.
public class LightDashboard
{
private List<Light> _innerList;
public LightDashboard(List<Light> innerList)
{
_innerList = innerList;
}
}
public class Light
{
private bool _value;
public Light(bool value)
{
_value = value;
}
}
And the test looks like :
[Test]
public void ListWithSameNumberOfElementsButDifferentValuesShouldNotBeEquivalent()
{
List<Light> sutInnerList = new List<Light>() {
new Light(true)
};
_sutObject = new LightDashboard(sutInnerList);
List<Light> expectedInnerList = new List<Light>(){
new Light(false)
};
_expectedObject = new LightDashboard(expectedInnerList);
_sutObject.Should().NotBeEquivalentTo(_expectedObject);
}
Aucun commentaire:
Enregistrer un commentaire