Пример #1
0
        public void Compare_Dictionary_With_Null()
        {
            SutEngine.Configure <IDictionaryModel>();

            var oldModel = new IDictionaryModel()
            {
                Id       = 1,
                Children = null,
            };

            var newModel = new IDictionaryModel()
            {
                Id       = 1,
                Children = new Dictionary <int, GrandChildModel>()
                {
                    { 100, new GrandChildModel()
                      {
                          Id    = 100,
                          Name  = "Name",
                          Value = 25,
                      } }
                }
            };

            var diff = SutEngine.Compare(oldModel, newModel);

            Assert.AreEqual(3, diff.Count());
        }
Пример #2
0
        public void Configure_IDictionary()
        {
            SutEngine.Configure <IDictionaryModel>();

            var oldModel = new IDictionaryModel()
            {
                Id       = 1,
                Children = new Dictionary <int, GrandChildModel>
                {
                    { 100,
                      new GrandChildModel()
                      {
                          Id    = 100,
                          Name  = "Name 1",
                          Value = 100
                      } },
                    { 200,
                      new GrandChildModel()
                      {
                          Id    = 200,
                          Name  = "Name 2",
                          Value = 200
                      } }
                },
            };

            var newModel = new IDictionaryModel()
            {
                Id       = 1,
                Children = new Dictionary <int, GrandChildModel>
                {
                    { 100,
                      new GrandChildModel()
                      {
                          Id    = 100,
                          Name  = "Name 1",
                          Value = 100
                      } },
                    { 300,
                      new GrandChildModel()
                      {
                          Id    = 300,
                          Name  = "Name 3",
                          Value = 300
                      } }
                },
            };

            var diff = SutEngine.Compare(oldModel, newModel);

            Assert.AreEqual(6, diff.Count);
        }