Exemple #1
0
        public void DateTimeWithFormatConverter_ReadJson_ReturnNull()
        {
            DateTimeWithFormatConverter converter  = new DateTimeWithFormatConverter();
            JsonReaderValueNull         jsonReader = new JsonReaderValueNull();
            object result = converter.ReadJson(jsonReader, typeof(DateTimeWithFormatConverter), null, null);

            Assert.IsNull(result);
        }
Exemple #2
0
        public void DateTimeWithFormatConverter_ReadJson_ReturnDateTimeMinValue()
        {
            DateTimeWithFormatConverter converter  = new DateTimeWithFormatConverter();
            JsonReaderMinDateTime       jsonReader = new JsonReaderMinDateTime();

            object result = converter.ReadJson(jsonReader, typeof(DateTimeWithFormatConverter), null, null);

            Assert.AreEqual(DateTime.MinValue, result);
        }
Exemple #3
0
        public void DateTimeWithFormatConverter_ReadJson_ReturnDateTime()
        {
            DateTimeWithFormatConverter converter  = new DateTimeWithFormatConverter();
            JsonReaderDateTimeValid     jsonReader = new JsonReaderDateTimeValid();
            object result = converter.ReadJson(jsonReader, typeof(DateTimeWithFormatConverter), null, null);

            var expected = new DateTime(2019, 09, 17, 15, 0, 0).ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CreateSpecificCulture("pt-BR"));

            Assert.AreEqual(expected, Convert.ToDateTime(result.ToString()).ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CreateSpecificCulture("pt-BR")));
        }