public void CustomJsonResult()
        {
            var data   = new ModelWithDateTime();
            var result = OnlineController.CustomJsonResult.Serialize(data);

            Assert.That(result, Is.EqualTo("{\"DateTimeProp\":\"2009-08-07T06:05\"}"));
        }
        public void CustomJsonResult()
        {
            var data = new ModelWithDateTime();
            var result = OnlineController.CustomJsonResult.Serialize(data);

            Assert.That(result, Is.EqualTo("{\"DateTimeProp\":\"2009-08-07T06:05\"}"));
        }
        public void GetValue_WhenAssignedDateTimeExists_ReturnsAssignedValue()
        {
            var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath<ModelWithDateTime>(TimeStampMemberName);
            var accessor = new TimeStampAccessor(timeStampProperty);
            var initialValue = new DateTime(1970, 12, 13, 01, 02, 03);
            var model = new ModelWithDateTime { TimeStamp = initialValue };

            var timeStamp = accessor.GetValue(model);

            Assert.AreEqual(initialValue, timeStamp);
        }
Beispiel #4
0
        public void GetValue_WhenAssignedDateTimeExists_ReturnsAssignedValue()
        {
            var timeStampProperty = StructurePropertyTestFactory.GetPropertyByPath <ModelWithDateTime>(TimeStampMemberName);
            var accessor          = new TimeStampAccessor(timeStampProperty);
            var initialValue      = new DateTime(1970, 12, 13, 01, 02, 03);
            var model             = new ModelWithDateTime {
                TimeStamp = initialValue
            };

            var timeStamp = accessor.GetValue(model);

            Assert.AreEqual(initialValue, timeStamp);
        }
Beispiel #5
0
        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_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);
        }