I am having this issue when I have two lists containing the same object type but with different sizes.
I want to make sure they are being checked (one is sub list of the other for example) based on the all of the properties of the given DTO for example:
public class Student
{
public int? id { get; set; }
public string? name { get; set; }
}
And I have two lists for example:
List<Student> firstList = new List<Student>() {
new Student(){ Id = 1, Name="Bill"},
new Student(){ Id = 2, Name="Steve"},
new Student(){ Id = 3, Name="Ram"},
new Student(){ Id = 4, Name="Abdul"}
};
List<Student> secondList = new List<Student>() {
new Student(){ Id = 1, Name="Bill"},
new Student(){ Id = 4, Name="Abdul"}
};
So my question is how can I make an assertion with Fluent Assertion that secondList is a sub list of firstList using deep compare making sure all the properties of an objects are compared to each other.
Thank you for your time and attention!
question from:
https://stackoverflow.com/questions/65848443/compare-lists-of-same-dtos-with-different-size-using-c-sharp-fluent-assertions 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…