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"))); }
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); }
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); }
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); }