Beispiel #1
0
        public void ParseValue_Int()
        {
            // arrange
            var uuidType = new UuidType();
            int value    = 123;

            // act
            Action action = () => uuidType.ParseValue(value);

            // assert
            Assert.Throws <ScalarSerializationException>(action);
        }
Beispiel #2
0
        public void ParseValue_With_Format(char format)
        {
            // arrange
            var  uuidType = new UuidType(defaultFormat: format);
            Guid guid     = Guid.Empty;

            // act
            var s = (StringValueNode)uuidType.ParseValue(guid);

            // assert
            Assert.Equal(guid.ToString(format.ToString()), s.Value);
        }
Beispiel #3
0
        public void ParseValue_Int()
        {
            // arrange
            var uuidType = new UuidType();
            var value    = 123;

            // act
            void Action() => uuidType.ParseValue(value);

            // assert
            Assert.Throws <SerializationException>(Action);
        }
Beispiel #4
0
        public void ParseValue_Null()
        {
            // arrange
            var  uuidType = new UuidType();
            Guid?guid     = null;

            // act
            IValueNode stringLiteral = uuidType.ParseValue(guid);

            // assert
            Assert.True(stringLiteral is NullValueNode);
            Assert.Null(((NullValueNode)stringLiteral).Value);
        }
Beispiel #5
0
        public void ParseValue_Guid()
        {
            // arrange
            var uuidType             = new UuidType();
            var expected             = Guid.NewGuid();
            var expectedLiteralValue = expected.ToString("N");

            // act
            var stringLiteral = (StringValueNode)uuidType.ParseValue(expected);

            // assert
            Assert.Equal(expectedLiteralValue, stringLiteral.Value);
        }