Ejemplo n.º 1
0
        public void ConverterWithNoSuitableEventsTest()
        {
            var registry       = new ConverterRegistry();
            var guid           = Guid.NewGuid();
            var eventToConvert = new EventV1 {
                Id = guid
            };
            var result = registry.Convert(eventToConvert);

            Assert.True(result is EventV1);
            Assert.Equal(guid, ((EventV1)result).Id);
            Assert.Same(eventToConvert, result);
        }
Ejemplo n.º 2
0
        public void OneLevelConvertWithRegisteredEventTest()
        {
            var registry       = new ConverterRegistry();
            var message        = "test";
            var guid           = Guid.NewGuid();
            var eventToConvert = new EventV1 {
                Id = guid
            };

            registry.Register(new EventConverterV1V2(message));

            var result = registry.Convert(eventToConvert);

            Assert.NotSame(eventToConvert, result);
            Assert.True(result is EventV2);
            Assert.Equal(guid, ((EventV2)result).NewGuid);
            Assert.Equal(message, ((EventV2)result).Message);
        }