예제 #1
0
        public void TestChangeDefaultSerialization()
        {
            var           config = new SerializationConfig();
            ISerializer   ser    = new StringSerializer();
            IDeserializer deser  = new StringDeserializer();

            var s = config.GetSerializersForTopic("topicnotfound");

            Assert.That(s,
                        Is.EqualTo(Tuple.Create(ByteArraySerialization.DefaultSerializer, ByteArraySerialization.DefaultSerializer)));

            var d = config.GetDeserializersForTopic("topicnotfound");

            Assert.That(d,
                        Is.EqualTo(Tuple.Create(ByteArraySerialization.DefaultDeserializer, ByteArraySerialization.DefaultDeserializer)));

            config.SetDefaultSerializers(ser, ser);
            config.SetDefaultDeserializers(deser, deser);

            s = config.GetSerializersForTopic("topicnotfound");
            Assert.That(s,
                        Is.EqualTo(Tuple.Create(ser, ser)));

            d = config.GetDeserializersForTopic("topicnotfound");
            Assert.That(d,
                        Is.EqualTo(Tuple.Create(deser, deser)));
        }