Пример #1
0
        public void Compare_Object_With_List_Property()
        {
            var comparer = SutEngine.Get <HasList>();
            var oldModel = new HasList
            {
                Ids = new List <int> {
                    1, 2, 3, 4, 5
                }
            };
            var newModel = new HasList
            {
                Ids = new List <int> {
                    1, 3, 4, 5, 6
                }
            };
            var changes = comparer(oldModel, newModel);

            Assert.AreEqual(changes.Count(), 2);
            Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.OldValue is int && (int)x.OldValue == 2));
            Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.NewValue is int && (int)x.NewValue == 6));
        }
Пример #2
0
 public void When_I_Compare_IEnumerable_I_Get_Added_And_Removed_Values()
 {
     var comparer = Comparer.GetComparer<HasList>();
     var oldModel = new HasList
     {
         Ids = new List<int> { 1, 2, 3, 4, 5 }
     };
     var newModel = new HasList
     {
         Ids = new List<int> { 1, 3, 4, 5, 6 }
     };
     var changes = comparer(oldModel, newModel);
     Assert.AreEqual(changes.Count(), 2);
     Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.OldValue is int && (int)x.OldValue == 2));
     Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.NewValue is int && (int)x.NewValue == 6));
 }
Пример #3
0
 public void Compare_Object_With_List_Property()
 {
     var comparer = SutEngine.Get<HasList>();
     var oldModel = new HasList
     {
         Ids = new List<int> { 1, 2, 3, 4, 5 }
     };
     var newModel = new HasList
     {
         Ids = new List<int> { 1, 3, 4, 5, 6 }
     };
     var changes = comparer(oldModel, newModel);
     Assert.AreEqual(changes.Count(), 2);
     Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.OldValue is int && (int)x.OldValue == 2));
     Assert.IsNotNull(changes.Single(x => x.Name == "Ids" && x.NewValue is int && (int)x.NewValue == 6));
 }