public void GetValue_WhenNoAssignedNullableDateTimeExists_ReturnsNulledNullableDateTime() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithNullableDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var model = new ModelWithNullableDateTime { TimeStamp = null }; var timeStamp = accessor.GetValue(model); Assert.IsNull(timeStamp); }
public void GetValue_WhenAssignedNullableDateTimeExists_ReturnsAssignedValue() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithNullableDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = new DateTime(1970, 12, 13, 01, 02, 03); var model = new ModelWithNullableDateTime { TimeStamp = initialValue }; var timeStamp = accessor.GetValue(model); Assert.AreEqual(initialValue, timeStamp); }
public void GetValue_WhenNoAssignedDateTimeExists_ReturnsMinValueDateTime() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = default(DateTime); var model = new ModelWithDateTime { TimeStamp = initialValue }; var timeStamp = accessor.GetValue(model); Assert.AreEqual(initialValue, timeStamp); }
public void GetValue_WhenNoAssignedNullableDateTimeExists_ReturnsNulledNullableDateTime() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithNullableDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var model = new ModelWithNullableDateTime { TimeStamp = null }; var timeStamp = accessor.GetValue(model); Assert.IsNull(timeStamp); }
public void GetValue_WhenAssignedNullableDateTimeExists_ReturnsAssignedValue() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithNullableDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = new DateTime(1970, 12, 13, 01, 02, 03); var model = new ModelWithNullableDateTime { TimeStamp = initialValue }; var timeStamp = accessor.GetValue(model); Assert.AreEqual(initialValue, timeStamp); }
public void GetValue_WhenNoAssignedDateTimeExists_ReturnsMinValueDateTime() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = default(DateTime); var model = new ModelWithDateTime { TimeStamp = initialValue }; var timeStamp = accessor.GetValue(model); Assert.AreEqual(initialValue, timeStamp); }
public void SetValue_WhenAssigningDateTime_UpdatesValue() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = new DateTime(1970, 12, 13, 01, 02, 03); var assignedValue = initialValue.AddDays(1); var model = new ModelWithDateTime { TimeStamp = initialValue }; accessor.SetValue(model, assignedValue); Assert.AreEqual(assignedValue, model.TimeStamp); }
public void SetValue_WhenAssigningValueToNullableDateTime_UpdatesValue() { var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithNullableDateTime>(TimeStampMemberName); var accessor = new TimeStampAccessor(timeStampProperty); var initialValue = new DateTime(1970, 12, 13, 01, 02, 03); var assignedValue = initialValue.AddDays(1); var model = new ModelWithNullableDateTime { TimeStamp = initialValue }; accessor.SetValue(model, assignedValue); Assert.AreEqual(assignedValue, model.TimeStamp); }