hi
I tried exclude from test one property how writing in Docs:
System.ArgumentException : Expression {Convert(o.Products.get_Item(0).Status)} is not a valid property expression
if i write:
System.ArgumentException : Expression {o.Products.get_Item(0)} is not a valid property expression
When i write:
What am I doing wrong?
Thanks.
I tried exclude from test one property how writing in Docs:
orderDto.ShouldBeEquivalentTo(order, options => options.Excluding(o => o.Products[1].Status));My classes:
public class Product
{
public String name { get; set; }
public Int32 Status { get; set; }
}
public class Order
{
public Int32 Id { get; set; }
public List<Product> Products { get; set; }
}
My test:[Test]
public void test()
{
Order order1 = new Order();
order1.Products = new List<Product>();
order1.Products.Add(new Product());
order1.Products.Add(new Product());
Order order2 = new Order();
order2.Products = new List<Product>();
order2.Products.Add(new Product());
order2.Products.Add(new Product());
order2.ShouldBeEquivalentTo(order1, options =>options.Excluding(o => o.Products[0].Status));
}
But Test Failed with:System.ArgumentException : Expression {Convert(o.Products.get_Item(0).Status)} is not a valid property expression
if i write:
order2.ShouldBeEquivalentTo(order1, options =>options.Excluding(o => o.Products[0]));
Test failed with:System.ArgumentException : Expression {o.Products.get_Item(0)} is not a valid property expression
When i write:
order2.ShouldBeEquivalentTo(order1, options =>options.Excluding(o => o.Products));
Test is success.What am I doing wrong?
Thanks.