Esempio n. 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());
        }
        public DictionaryWindow(IDictionaryModel model)
        {
            InitializeComponent();

            Model = model;
            DictWindow.DataContext = Model;
        }
        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);
        }