Exemple #1
0
        public void throws_expected_exception_when_no_instance_type_is_registered(string eventName)
        {
            var stubEvent        = new FooDomainEvent();
            var stubRegistration = new DomainEventRegistrationBuilder()
                                   .WithEventInstanceType(stubEvent)
                                   .Build();

            var sut = new DomainEventRegistryBuilder().Build();

            sut.Register <FooDomainEvent>(stubRegistration.EventType, stubRegistration.Topic);

            Assert.Throws <MessagingHandlerNotAvailable>(() => sut.GetInstanceTypeFor(eventName));
        }
Exemple #2
0
        public void returns_expected_instance_type()
        {
            var stubEvent        = new FooDomainEvent();
            var stubRegistration = new DomainEventRegistrationBuilder()
                                   .WithEventInstanceType(stubEvent)
                                   .Build();

            var sut = new DomainEventRegistryBuilder().Build();

            sut.Register <FooDomainEvent>(stubRegistration.EventType, stubRegistration.Topic);

            var result = sut.GetInstanceTypeFor(stubRegistration.EventType);

            Assert.Equal(typeof(FooDomainEvent), result);
        }