public void ParseLiteral_NullValueNode()
        {
            // arrange
            DateType      dateType = new DateType();
            NullValueNode literal  = NullValueNode.Default;

            // act
            object value = dateType.ParseLiteral(literal);

            // assert
            Assert.Null(value);
        }
Example #2
0
        public void ParseLiteral_StringValueNode()
        {
            // arrange
            var dateType         = new DateType();
            var literal          = new StringValueNode("2018-06-29");
            var expectedDateTime = new DateTime(2018, 6, 29);

            // act
            var dateTime = (DateTime)dateType.ParseLiteral(literal) !;

            // assert
            Assert.Equal(expectedDateTime, dateTime);
        }
        public void ParseLiteral_StringValueNode()
        {
            // arrange
            DateType        dateType         = new DateType();
            StringValueNode literal          = new StringValueNode("2018-06-11");
            DateTime        expectedDateTime = new DateTime(2018, 6, 11);

            // act
            DateTime dateTime = (DateTime)dateType
                                .ParseLiteral(literal);

            // assert
            Assert.Equal(expectedDateTime, dateTime);
        }
Example #4
0
        public void ParseLiteral_StringValueNode_DifferentCulture(
            string cultureName)
        {
            // arrange
            Thread.CurrentThread.CurrentCulture =
                CultureInfo.GetCultureInfo(cultureName);

            var dateType         = new DateType();
            var literal          = new StringValueNode("2018-06-29");
            var expectedDateTime = new DateTime(2018, 6, 29);

            // act
            var dateTime = (DateTime)dateType.ParseLiteral(literal) !;

            // assert
            Assert.Equal(expectedDateTime, dateTime);
        }