public void GivenModelNotModified_WhenCopyFrom_ThenModelStatelastModifyValuesNull() { ServiceAttendance expectedState = new ServiceAttendance { CreateTime = new DateTime(2005, 4, 30), CreatingUser = new User { DisplayName = "fredBob" } }; ServiceAttendanceModel target = new ServiceAttendanceModel(); target.CopyFrom(expectedState); Assert.IsNull(target.Audit.LastModifiedBy); Assert.IsFalse(target.Audit.LastModifyTime.HasValue); }
public void GivenModelHasAuditData_WhenCopyFrom_ThenModelStateSet() { ServiceAttendance expectedState = new ServiceAttendance { CreateTime = new DateTime(2005, 4, 30), CreatingUser = new User { DisplayName = "fredBob" }, LastModifyTime = new DateTime(2010, 5, 13), LastModifyingUser = new User { DisplayName = "jimGeorge" } }; ServiceAttendanceModel target = new ServiceAttendanceModel(); target.CopyFrom(expectedState); AuditModel actualState = target.Audit; Assert.AreEqual(expectedState.CreateTime, actualState.CreateTime); Assert.AreEqual(expectedState.CreatingUser.DisplayName, actualState.CreatedBy); Assert.AreEqual(expectedState.LastModifyTime, actualState.LastModifyTime); Assert.AreEqual(expectedState.LastModifyingUser.DisplayName, actualState.LastModifiedBy); }
public void InitializeTest() { Target = new ServiceAttendanceModel(); TestData = new TestData(); }