public void ShouldThrowDomainEventMapperNotFoundException() { var domainEventMappingCollection = new NServiceBusEventMappings(); var domainEvent = new AccommodationLeadApproved { ID = Guid.NewGuid() }; domainEventMappingCollection.GetMappedObjectFor(domainEvent); }
public void ShouldReturnABusEventForAccommodationLeadApproved() { var id = Guid.NewGuid(); var mapper = new AccommodationLeadApprovedMapper(); var domainEvent = new AccommodationLeadApproved { ID = id }; Assert.That(mapper.Map(domainEvent), Is.TypeOf<Messages.Events.AccommodationLeadApproved>()); }
public void ShouldPublishEvent() { var mockBus = MockRepository.GenerateMock<IBus>(); var domainEventMappingCollection = new NServiceBusEventMappings(); domainEventMappingCollection.AddMapper(new AccommodationLeadApprovedMapper()); var eventPublisher = new NServiceBusEventPublisher(mockBus, domainEventMappingCollection); var domainEvent = new AccommodationLeadApproved { ID = Guid.NewGuid() }; eventPublisher.Publish(domainEvent); //Already tested that the correct event should be being published here where the //DomainEventMappingTests mockBus.AssertWasCalled(x => x.Publish(Arg<IEvent>.Is.Anything)); }
public void ShouldLocateAnExistingMapperUsingASuppliedDomainEventType() { var domainEventMappingCollection = new NServiceBusEventMappings(); domainEventMappingCollection.AddMapper( new AccommodationLeadApprovedMapper()); var domainEvent = new AccommodationLeadApproved { ID = Guid.NewGuid() }; var mappedEvent = domainEventMappingCollection.GetMappedObjectFor(domainEvent); Assert.That(mappedEvent, Is.TypeOf<Messages.Events.AccommodationLeadApproved>()); }
private void Apply(AccommodationLeadApproved @event) { _approved = true; }