private void When(PublicServiceWasRegistered @event)
        {
            _id   = new PublicServiceId(@event.PublicServiceId);
            _name = new PublicServiceName(@event.Name);

            _lifeCycle.Route(@event);
        }
Exemple #2
0
        public async Task WhenPublicServiceWasRegistered()
        {
            var projection = new PublicServiceListProjections(new ClockProviderStub(DateTime.Now));
            var resolver   = ConcurrentResolve.WhenEqualToHandlerMessageType(projection.Handlers);

            var publicServiceId            = PublicServiceId.FromNumber(123);
            var publicServiceWasRegistered = new PublicServiceWasRegistered(publicServiceId, new PublicServiceName("Ophaling huisvuil"), PrivateZoneId.Unregistered);

            await new ConnectedProjectionScenario <BackofficeContext>(resolver)
            .Given(
                new Envelope <PublicServiceWasRegistered>(new Envelope(
                                                              publicServiceWasRegistered, new Dictionary <string, object>())))
            .Verify(async context =>
            {
                var publicService = await context.PublicServiceList.FirstAsync(a => a.PublicServiceId == publicServiceId);

                publicService.PublicServiceId.Should().Be("DVR000000123");
                publicService.Name.Should().Be("Ophaling huisvuil");
                publicService.CompetentAuthorityCode.Should().BeNullOrEmpty();
                publicService.CompetentAuthorityName.Should().BeNullOrEmpty();
                publicService.ExportToOrafin.Should().Be(false);

                return(VerificationResult.Pass());
            })
            .Assert();
        }
Exemple #3
0
        public Task WhenPublicServiceWasRemoved()
        {
            var publicServiceId            = new PublicServiceId("DVR000000001");
            var publicServiceName          = new PublicServiceName("Test");
            var publicServiceWasRegistered = new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered);
            var publicServiceWasRemoved    = new PublicServiceWasRemoved(new PublicServiceId(publicServiceWasRegistered.PublicServiceId), new ReasonForRemoval("because"));

            return(new PublicServiceListProjections(new ClockProviderStub(DateTime.Now))
                   .Scenario()
                   .Given(publicServiceWasRegistered, publicServiceWasRemoved)
                   .Expect(new PublicServiceListItem
            {
                Name = publicServiceName,
                PublicServiceId = publicServiceId,
                Removed = true
            }));
        }
 private void When(PublicServiceWasRegistered @event)
 {
     _publicServiceId = new PublicServiceId(@event.PublicServiceId);
 }