コード例 #1
0
        public void AllTest()
        {
            var encoding = Encoding.UTF8;

            var serializer = SerializerManager.GetBySource <Encoding>();

            var value = serializer.Serialize(encoding);

            Assert.NotEmpty(value);

            var source = serializer.Deserialize(value);

            Assert.NotNull(source);

            Assert.Equal(encoding, source);
        }
コード例 #2
0
        public void AllTest()
        {
            var type = typeof(TypeStringSerializerTests);

            var serializer = SerializerManager.GetBySource <Type>();

            var value = serializer.Serialize(type);

            Assert.NotEmpty(value);

            var source = serializer.Deserialize(value);

            Assert.NotNull(source);

            Assert.Equal(type, source);
        }
コード例 #3
0
        public void AllTest()
        {
            var token = SecurityToken.New();

            var serializer = SerializerManager.GetBySource <SecurityToken>();

            var value = serializer.Serialize(token);

            Assert.NotEmpty(value);

            var source = serializer.Deserialize(value);

            Assert.NotNull(source);

            Assert.Equal(token, source);
        }
コード例 #4
0
        public void AllTest()
        {
            var oldSerializerType = typeof(EncodingStringSerializer);
            var oldSerializer     = SerializerManager.GetBySource <Encoding>();

            Assert.Equal(oldSerializerType, oldSerializer.GetType());

            var newSerializerType = typeof(TestEncodingStringSerializer);
            var newSerializer     = SerializerManager.Default.Replace(oldSerializer,
                                                                      new TestEncodingStringSerializer());

            Assert.Equal(newSerializerType, newSerializer.GetType());

            var serializer = SerializerManager.GetBySource <Encoding>();

            Assert.Equal(newSerializerType, serializer.GetType());
        }