public void Compare_List_With_Null() { SutEngine.Configure <IListModel>() .For(x => x.Children, x => x.MatchUsing(y => y.Id)); var oldModel = new IListModel() { Id = 1, Children = null, }; var newModel = new IListModel() { Id = 1, Children = new List <GrandChildModel>() { new GrandChildModel() { Id = 100, Name = "Name", Value = 25, } } }; var diff = SutEngine.Compare(oldModel, newModel); Assert.AreEqual(3, diff.Count()); }
public void Configure_IList() { SutEngine.Configure <IListModel>() .For(x => x.Children, x => x.MatchUsing(y => y.Id)); var oldModel = new IListModel() { Id = 1, Children = new List <GrandChildModel> { new GrandChildModel() { Id = 100, Name = "Name 1", Value = 100 }, new GrandChildModel() { Id = 200, Name = "Name 2", Value = 200 } }, }; var newModel = new IListModel() { Id = 1, Children = new List <GrandChildModel> { new GrandChildModel() { Id = 100, Name = "Name 1", Value = 100 }, new GrandChildModel() { Id = 300, Name = "Name 3", Value = 300 } }, }; var diff = SutEngine.Compare(oldModel, newModel); Assert.AreEqual(6, diff.Count); }