Example #1
0
        protected void LocalTime_ExpectIsDateTimeToMatch()
        {
            // arrange
            ScalarType scalar      = CreateType <LocalTimeType>();
            var        valueSyntax = new DateTime(2018, 6, 29, 8, 46, 14);

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void Longitude_ExpectIsDoubleInstanceToFail_GreaterThanMax()
        {
            // arrange
            ScalarType   scalar      = CreateType <LongitudeType>();
            const double valueSyntax = 181d;

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.False(result);
        }
Example #3
0
        protected void LocalTime_ExpectIsStringValueToMatch()
        {
            // arrange
            ScalarType scalar      = CreateType <LocalTimeType>();
            var        valueSyntax = new StringValueNode("2018-06-29T08:46:14+04:00");

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void Longitude_ExpectIsStringInstanceToMatch()
        {
            // arrange
            ScalarType      scalar      = CreateType <LongitudeType>();
            StringValueNode valueSyntax = new("179° 0' 0.000\" E")!;

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void Longitude_ExpectIsDoubleInstanceToMatch()
        {
            // arrange
            ScalarType   scalar      = CreateType <LongitudeType>();
            const double valueSyntax = -179d;

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void UtcOffset_ExpectIsUtcOffsetToMatch()
        {
            // arrange
            ScalarType scalar      = CreateType <UtcOffsetType>();
            var        valueSyntax = TimeSpan.FromHours(12);

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void UtcOffset_ExpectPositiveIsStringValueToMatch()
        {
            // arrange
            ScalarType scalar      = CreateType <UtcOffsetType>();
            var        valueSyntax = new StringValueNode("-00:00");

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void LocalCurrency_ExpectIsStringValueToMatch()
        {
            // arrange
            ScalarType scalar      = CreateType <LocalCurrencyType>();
            var        valueSyntax = new StringValueNode("$10.99");

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.True(result);
        }
        protected void ExpectIsInstanceOfTypeToMatch <TType>(
            object?runtimeValue,
            bool expectedResult)
            where TType : ScalarType
        {
            // arrange
            ScalarType scalar = CreateType <TType>();

            // act
            var result = scalar.IsInstanceOfType(runtimeValue);

            // assert
            Assert.Equal(expectedResult, result);
        }
Example #10
0
        protected void ExpectIsInstanceOfTypeToMatch <TType>(
            IValueNode valueSyntax,
            bool expectedResult)
            where TType : ScalarType
        {
            // arrange
            ScalarType scalar = CreateType <TType>();

            // act
            var result = scalar.IsInstanceOfType(valueSyntax);

            // assert
            Assert.Equal(expectedResult, result);
        }