예제 #1
0
        public void different_data_havingDisplayname_GetUpdateEntries_should_get_correct_updateFields()
        {
            TestUpdatableCls testUpdatableCls1 = new TestUpdatableCls
            {
                PropInt              = 1,
                PropString           = "test1",
                PropNullableDateTime = new DateTime(2000, 1, 1),
                PropBool             = true,
                Phone    = "1234",
                Ignored  = "ignored",
                PropGuid = _guid,
                Updated  = true
            };
            TestUpdatableCls testUpdatableCls2 = new TestUpdatableCls
            {
                PropInt              = 2,
                PropString           = "test2",
                PropNullableDateTime = new DateTime(2001, 1, 1),
                PropBool             = false,
                Phone    = "12345",
                Ignored  = "notshow",
                PropGuid = _guid,
                Updated  = true
            };
            var updatedFields = testUpdatableCls1.GetUpdateEntries(testUpdatableCls2);

            Assert.AreEqual(6, updatedFields.Count);
            Assert.AreEqual(true, updatedFields.Contains(new KeyValuePair <string, object>("ssg_propInt", 2)));
            Assert.AreEqual(true, updatedFields.Contains(new KeyValuePair <string, object>("ssg_propstring", "test2")));
            Assert.AreEqual(true, updatedFields.Contains(new KeyValuePair <string, object>("ssg_propnullabledatetime", new DateTime(2001, 1, 1))));
            Assert.AreEqual(true, updatedFields.Contains(new KeyValuePair <string, object>("ssg_propbool", false)));
            Assert.AreEqual(true, updatedFields.Contains(new KeyValuePair <string, object>("ssg_phonenumber", "12345")));
        }
예제 #2
0
        public void null_json_property_GetUpdateEntries_should_not_in_updateFields()
        {
            TestUpdatableCls testUpdatableCls1 = new TestUpdatableCls
            {
                NoJsonProperty = "json"
            };
            TestUpdatableCls testUpdatableCls2 = new TestUpdatableCls
            {
                NoJsonProperty = "differentJson"
            };
            var updatedFields = testUpdatableCls1.GetUpdateEntries(testUpdatableCls2);

            Assert.AreEqual(0, updatedFields.Count);
        }
예제 #3
0
        public void compareOnlyNumber_data_same_number_GetUpdateEntries_should_not_in_updateFields()
        {
            TestUpdatableCls testUpdatableCls1 = new TestUpdatableCls
            {
                Phone = "123==4-5p678--9"
            };
            TestUpdatableCls testUpdatableCls2 = new TestUpdatableCls
            {
                Phone = "--123(45)678#9"
            };
            var updatedFields = testUpdatableCls1.GetUpdateEntries(testUpdatableCls2);

            Assert.AreEqual(0, updatedFields.Count);
        }
예제 #4
0
        public void noDisplayName_data_GetUpdateEntries_should_be_ignored_in_updateFields()
        {
            TestUpdatableCls testUpdatableCls1 = new TestUpdatableCls
            {
                Ignored  = "ignored",
                PropGuid = _guid,
                Updated  = true
            };
            TestUpdatableCls testUpdatableCls2 = new TestUpdatableCls
            {
                Ignored  = "notshow",
                PropGuid = Guid.NewGuid(),
                Updated  = false
            };
            var updatedFields = testUpdatableCls1.GetUpdateEntries(testUpdatableCls2);

            Assert.AreEqual(0, updatedFields.Count);
        }