Exemple #1
0
        public void Read_null()
        {
            // Arrange
            var json = "";

            var textReader    = new StringReader(json);
            var jsonReader    = new JsonTextReader(textReader);
            var objectType    = (Type)null;
            var existingValue = (object)null;
            var serializer    = new JsonSerializer();

            var converter = new EpochConverter();

            // Act
            jsonReader.Read();
            var result = converter.ReadJson(jsonReader, objectType, existingValue, serializer);

            // Assert
            result.ShouldBeNull();
        }
Exemple #2
0
        public void Read_date()
        {
            // Arrange
            var json = "1490711400";

            var textReader    = new StringReader(json);
            var jsonReader    = new JsonTextReader(textReader);
            var objectType    = (Type)null;
            var existingValue = (object)null;
            var serializer    = new JsonSerializer();

            var converter = new EpochConverter();

            // Act
            jsonReader.Read();
            var result = converter.ReadJson(jsonReader, objectType, existingValue, serializer);

            // Assert
            result.ShouldBe(new DateTime(2017, 3, 28, 14, 30, 0, DateTimeKind.Utc));
        }