using System.Collections.Generic;
public static void Main()
Date = new DateTime(2022,11,01),
Customer = new Customer {
var expectedOrder = new Order {
Date = new DateTime(2022,11,01),
Customer = new Customer {
order.Should().BeEquivalentTo(expectedOrder, options =>
options.Excluding(o => o.Customer.Name)
.Excluding(o => o.Customer.Id);
order.Should().BeEquivalentTo(expectedOrder, options =>
options.Excluding(o => o.Customer.Name);
options.Excluding(o => o.Customer.Id);
order.Should().BeEquivalentTo(expectedOrder, options =>
options.Excluding(o => o.Customer.Name)
.Excluding(o => o.Customer.Id)
order.Should().BeEquivalentTo(expectedOrder);
catch(Exception ex) { Console.WriteLine(ex); }
order.Should().BeEquivalentTo(expectedOrder, options => options.ExcludingNestedObjects());
order.Address.Should().BeEquivalentTo(expectedOrder.Customer.Address);
Console.WriteLine("Fluent Assertions Collection extension methods tests - pass");
public int Id { get;set;}
public DateTime Date { get;set;}
public Customer Customer { get;set; }
public Address Address { get;set; }
public int Id { get;set;}
public string Name { get;set; }
public Address Address { get;set; }
public int Id { get;set;}
public string Line1 { get;set; }
public string Line2 { get;set; }
public string City { get;set; }
public string State { get;set; }
public string Postcode { get;set; }
public string Country { get;set; }