public void Upgrade()
        {
            var event1 = CreateEvent("foo");
            var event2 = CreateEvent("bar");
            var fooConverter = MockRepository.GenerateStub<IEventConverter>();
            var barConverter = MockRepository.GenerateStub<IEventConverter>();

            var converter = new EventConverter(_typeResolver);
            converter.AddConverter("foo", fooConverter);
            converter.AddConverter("bar", barConverter);

            converter.Upgrade(event1);
            converter.Upgrade(event2);

            fooConverter.AssertWasCalled(x => x.Upgrade(event1));
            barConverter.AssertWasCalled(x => x.Upgrade(event2));
        }
        public void AddConverter_ByType()
        {
            var anEvent = CreateEvent();
            var converter = new EventConverter(_typeResolver);
            converter.AddConverter(typeof(AnEvent), _childConverter);

            converter.Upgrade(anEvent);

            _childConverter.AssertWasCalled(x => x.Upgrade(anEvent));
        }
 public void Upgrade_theEvent_null()
 {
     var converter = new EventConverter(_typeResolver);
     var ex = Assert.Throws<ArgumentNullException>(() => converter.Upgrade(null));
     ex.ParamName.Should().Be("theEvent");
 }
 public void Upgrade_unknown_event()
 {
     var converter = new EventConverter(_typeResolver);
     Assert.DoesNotThrow(() => converter.Upgrade(CreateEvent()));
 }
Exemple #5
0
 public void Upgrade_unknown_event()
 {
     var converter = new EventConverter(_typeResolver);
     converter.Upgrade(CreateEvent());
 }