コード例 #1
0
 public UpdateLabels(
     PublicServiceId publicServiceId,
     Dictionary <LabelType, LabelValue> labels)
 {
     PublicServiceId = publicServiceId;
     Labels          = labels;
 }
コード例 #2
0
 public SetLegislativeDocumentId(
     PublicServiceId publicServiceId,
     LegislativeDocumentId legislativeDocumentId)
 {
     PublicServiceId       = publicServiceId;
     LegislativeDocumentId = legislativeDocumentId;
 }
コード例 #3
0
 public RemoveStageFromLifeCycle(
     PublicServiceId publicServiceId,
     LifeCycleStageId lifeCycleStageId)
 {
     PublicServiceId  = publicServiceId;
     LifeCycleStageId = lifeCycleStageId;
 }
コード例 #4
0
        public Task WhenIpdcCodeWasSet()
        {
            var clockProviderStub = new ClockProviderStub(Today);

            var publicServiceId   = new PublicServiceId("DVR000000001");
            var publicServiceName = new PublicServiceName("Test");
            var events            = new object[]
            {
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                new IpdcCodeWasSet(publicServiceId, new IpdcCode("1234")),
            };

            return(new PublicServiceListProjections(clockProviderStub)
                   .Scenario()
                   .Given(events)
                   .Expect(new PublicServiceListItem
            {
                Name = publicServiceName,
                PublicServiceId = publicServiceId,
                CurrentLifeCycleStageType = null,
                CurrentLifeCycleStageId = null,
                CurrentLifeCycleStageEndsAt = null,
                IpdcCode = "1234"
            }));
        }
コード例 #5
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();
        }
コード例 #6
0
        public Task DoesNotClearLifeCycleStageWhenAnotherLifeCycleStageNoLongerOverlapsWithToday()
        {
            var clockProviderStub = new ClockProviderStub(Today);

            var publicServiceId   = new PublicServiceId("DVR000000001");
            var publicServiceName = new PublicServiceName("Test");
            var events            = new object[]
            {
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                new StageWasAddedToLifeCycle(publicServiceId, LifeCycleStageId.FromNumber(1), LifeCycleStageType.Active, PeriodOverlappingWithToday),
                new StageWasAddedToLifeCycle(publicServiceId, LifeCycleStageId.FromNumber(2), LifeCycleStageType.PhasingOut, PeriodOverlappingWithTomorrow),
                new PeriodOfLifeCycleStageWasChanged(publicServiceId, LifeCycleStageId.FromNumber(2), PeriodOverlappingWithYesterday),
            };

            return(new PublicServiceListProjections(clockProviderStub)
                   .Scenario()
                   .Given(events)
                   .Expect(new PublicServiceListItem
            {
                Name = publicServiceName,
                PublicServiceId = publicServiceId,
                CurrentLifeCycleStageType = "Active",
                CurrentLifeCycleStageId = 1,
                CurrentLifeCycleStageEndsAt = LocalDate.FromDateTime(Today),
            }));
        }
コード例 #7
0
        public Task DoesNotSetNextLifeCycleStageWhenDayHasPassedWhenThatLifeCycleStageWasRemoved()
        {
            var clockProviderStub = new ClockProviderStub(Today);

            var publicServiceId   = new PublicServiceId("DVR000000001");
            var publicServiceName = new PublicServiceName("Test");
            var events            = new object[]
            {
                new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                new StageWasAddedToLifeCycle(publicServiceId, LifeCycleStageId.FromNumber(1), LifeCycleStageType.Active, PeriodOverlappingWithToday),
                new StageWasAddedToLifeCycle(publicServiceId, LifeCycleStageId.FromNumber(2), LifeCycleStageType.PhasingOut, PeriodOverlappingWithTomorrow),
                new LifeCycleStageWasRemoved(publicServiceId, LifeCycleStageId.FromNumber(2)),
                new ClockHasTicked(Tomorrow),
            };

            return(new PublicServiceListProjections(clockProviderStub)
                   .Scenario()
                   .Given(events)
                   .Expect(new PublicServiceListItem
            {
                Name = publicServiceName,
                PublicServiceId = publicServiceId,
                CurrentLifeCycleStageType = null,
                CurrentLifeCycleStageId = null,
                CurrentLifeCycleStageEndsAt = null,
            }));
        }
コード例 #8
0
 public PublicServiceWasRemoved(
     PublicServiceId publicServiceId,
     ReasonForRemoval reasonForRemoval)
 {
     PublicServiceId  = publicServiceId;
     ReasonForRemoval = reasonForRemoval;
 }
 public static RegisterPublicService Map(
     RegisterPublicServiceRequest message,
     PublicServiceId publicServiceId) =>
 new RegisterPublicService(
     publicServiceId,
     new PublicServiceName(message.Naam),
     PrivateZoneId.Unregistered);
コード例 #10
0
 public SetIpdcCode(
     PublicServiceId publicServiceId,
     IpdcCode ipdcCode)
 {
     PublicServiceId = publicServiceId;
     IpdcCode        = ipdcCode;
 }
コード例 #11
0
        private void When(PublicServiceWasRegistered @event)
        {
            _id   = new PublicServiceId(@event.PublicServiceId);
            _name = new PublicServiceName(@event.Name);

            _lifeCycle.Route(@event);
        }
コード例 #12
0
 public RemovePublicService(
     PublicServiceId publicServiceId,
     ReasonForRemoval reasonForRemoval)
 {
     PublicServiceId  = publicServiceId;
     ReasonForRemoval = reasonForRemoval;
 }
コード例 #13
0
 public OrafinExportPropertyWasSet(
     PublicServiceId publicServiceId,
     bool exportToOrafin)
 {
     PublicServiceId = publicServiceId;
     ExportToOrafin  = exportToOrafin;
 }
コード例 #14
0
 public LifeCycleStageWasRemoved(
     PublicServiceId publicServiceId,
     LifeCycleStageId lifeCycleStageId)
 {
     PublicServiceId  = publicServiceId;
     LifeCycleStageId = lifeCycleStageId;
 }
コード例 #15
0
        public void CannotPerformSimpleUpdateOnRemovedPublicService(
            PublicServiceId publicServiceId,
            PublicServiceName publicServiceName,
            PublicServiceName publicServiceRename,
            ReasonForRemoval reasonForRemoval,
            OvoNumber ovoNumber,
            Organisation organisation)
        {
            _mocker.MockOrganisationProvider(ovoNumber, organisation);

            Assert(new Scenario()
                   .Given(publicServiceId,
                          new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                          new PublicServiceWasRemoved(publicServiceId, reasonForRemoval))
                   .When(new UpdatePublicService(publicServiceId, publicServiceRename, null, false))
                   .Throws(new CannotPerformActionOnRemovedPublicService()));

            Assert(new Scenario()
                   .Given(publicServiceId,
                          new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                          new PublicServiceWasRemoved(publicServiceId, reasonForRemoval))
                   .When(new UpdatePublicService(publicServiceId, publicServiceName, ovoNumber, false))
                   .Throws(new CannotPerformActionOnRemovedPublicService()));

            Assert(new Scenario()
                   .Given(publicServiceId,
                          new PublicServiceWasRegistered(publicServiceId, publicServiceName, PrivateZoneId.Unregistered),
                          new PublicServiceWasRemoved(publicServiceId, reasonForRemoval))
                   .When(new UpdatePublicService(publicServiceId, publicServiceName, null, true))
                   .Throws(new CannotPerformActionOnRemovedPublicService()));
        }
コード例 #16
0
        public void WithEveryPropertyChanged(
            OvoNumber ovoNumber,
            Organisation organisation,
            PublicServiceId publicServiceId,
            PublicServiceName publicServiceName,
            PrivateZoneId privateZoneId)
        {
            _mocker.MockOrganisationProvider(ovoNumber, organisation);

            var newPublicServiceName = new PublicServiceName("Uitreiken identiteitskaart");

            Assert(
                new Scenario()
                .Given(publicServiceId,
                       new PublicServiceWasRegistered(publicServiceId, publicServiceName, privateZoneId))
                .When(new UpdatePublicService(publicServiceId, newPublicServiceName, ovoNumber, true))
                .Then(publicServiceId,
                      new PublicServiceWasRenamed(publicServiceId, newPublicServiceName),
                      new CompetentAuthorityWasAssigned(
                          publicServiceId,
                          organisation.OvoNumber,
                          organisation.Name,
                          organisation.Provenance),
                      new OrafinExportPropertyWasSet(
                          publicServiceId,
                          true)));
        }
コード例 #17
0
        public void WithOvoNumberChanged(
            Fixture fixture,
            OvoNumber ovoNumber,
            Organisation organisation,
            PublicServiceId publicServiceId,
            PublicServiceName publicServiceName,
            PrivateZoneId privateZoneId)
        {
            _mocker.MockOrganisationProvider(ovoNumber, organisation);

            var newOvoNumber    = fixture.Create <OvoNumber>();
            var newOrganisation = fixture.Create <Organisation>();

            _mocker.MockOrganisationProvider(newOvoNumber, newOrganisation);

            Assert(
                new Scenario()
                .Given(publicServiceId,
                       new PublicServiceWasRegistered(publicServiceId, publicServiceName, privateZoneId),
                       new CompetentAuthorityWasAssigned(
                           publicServiceId,
                           organisation.OvoNumber,
                           organisation.Name,
                           organisation.Provenance))
                .When(new UpdatePublicService(publicServiceId, publicServiceName, newOvoNumber, false))
                .Then(publicServiceId,
                      new CompetentAuthorityWasAssigned(
                          publicServiceId,
                          newOrganisation.OvoNumber,
                          newOrganisation.Name,
                          newOrganisation.Provenance)));
        }
コード例 #18
0
 public IpdcCodeWasSet(
     PublicServiceId publicServiceId,
     IpdcCode ipdcCode)
 {
     PublicServiceId = publicServiceId;
     IpdcCode        = ipdcCode;
 }
コード例 #19
0
 public PublicServiceWasRenamed(
     PublicServiceId publicServiceId,
     PublicServiceName newName)
 {
     PublicServiceId = publicServiceId;
     NewName         = newName;
 }
コード例 #20
0
 public RegisterPublicService(
     PublicServiceId publicServiceId,
     PublicServiceName publicServiceName,
     PrivateZoneId privateZoneId)
 {
     PublicServiceId   = publicServiceId;
     PublicServiceName = publicServiceName;
     PrivateZoneId     = privateZoneId;
 }
コード例 #21
0
 public AddStageToLifeCycle(
     PublicServiceId publicServiceId,
     LifeCycleStageType lifeCycleStageType,
     LifeCycleStagePeriod lifeCycleStagePeriod)
 {
     PublicServiceId      = publicServiceId;
     LifeCycleStageType   = lifeCycleStageType;
     LifeCycleStagePeriod = lifeCycleStagePeriod;
 }
コード例 #22
0
 public PublicServiceWasRegistered(
     PublicServiceId publicServiceId,
     PublicServiceName name,
     PrivateZoneId privateZoneId)
 {
     PublicServiceId = publicServiceId;
     Name            = name;
     PrivateZoneId   = privateZoneId;
 }
コード例 #23
0
 public static void CustomizeLabelWasAssigned(this IFixture fixture) =>
 fixture.Customize <LabelWasAssigned>(customization =>
                                      customization
                                      .FromFactory(generator =>
                                                   new LabelWasAssigned(
                                                       PublicServiceId.FromNumber(fixture.Create <int>()),
                                                       LabelType.All[generator.Next() % LabelType.All.Length],
                                                       new LabelValue(fixture.Create <string>())
                                                       )).OmitAutoProperties());
コード例 #24
0
 public static void CustomizePublicServiceWasRegistered(this IFixture fixture) =>
 fixture.Customize <PublicServiceWasRegistered>(customization =>
                                                customization
                                                .FromFactory(generator =>
                                                             new PublicServiceWasRegistered(
                                                                 PublicServiceId.FromNumber(fixture.Create <int>()),
                                                                 new PublicServiceName(fixture.Create <string>()),
                                                                 PrivateZoneId.Unregistered
                                                                 )).OmitAutoProperties());
コード例 #25
0
 public ChangePeriodOfLifeCycleStage(
     PublicServiceId publicServiceId,
     LifeCycleStageId lifeCycleStageId,
     LifeCycleStagePeriod lifeCycleStagePeriod)
 {
     PublicServiceId      = publicServiceId;
     LifeCycleStageId     = lifeCycleStageId;
     LifeCycleStagePeriod = lifeCycleStagePeriod;
 }
コード例 #26
0
 public LabelWasAssigned(
     PublicServiceId publicServiceId,
     LabelType labelType,
     LabelValue labelValue)
 {
     PublicServiceId = publicServiceId;
     LabelType       = labelType;
     LabelValue      = labelValue;
 }
 public PeriodOfLifeCycleStageWasChanged(
     PublicServiceId publicServiceId,
     LifeCycleStageId lifeCycleStageId,
     LifeCycleStagePeriod period)
 {
     PublicServiceId  = publicServiceId;
     LifeCycleStageId = lifeCycleStageId;
     From             = period.Start;
     To = period.End;
 }
コード例 #28
0
        public static PublicService Register(
            PublicServiceId id,
            PublicServiceName name,
            PrivateZoneId privateZoneId)
        {
            var publicService = Factory();

            publicService.ApplyChange(new PublicServiceWasRegistered(id, name, privateZoneId));
            return(publicService);
        }
コード例 #29
0
 public static void CustomizeStageWasAddedToLifeCycle(this IFixture fixture) =>
 fixture.Customize <StageWasAddedToLifeCycle>(customization =>
                                              customization
                                              .FromFactory(generator =>
                                                           new StageWasAddedToLifeCycle(
                                                               PublicServiceId.FromNumber(fixture.Create <int>()),
                                                               LifeCycleStageId.FromNumber(fixture.Create <int>()),
                                                               LifeCycleStageType.All[generator.Next() % LifeCycleStageType.All.Length],
                                                               fixture.Create <LifeCycleStagePeriod>()
                                                               )).OmitAutoProperties());
コード例 #30
0
        private async Task <bool> StreamExists(PublicServiceId publicServiceId)
        {
            var pageReadStatus = await _streamStore
                                 .ReadStreamForwards(
                streamId : publicServiceId.ToString(),
                fromVersionInclusive : StreamVersion.Start,
                maxCount : 1,
                prefetchJsonData : false);

            return(pageReadStatus.Status != PageReadStatus.StreamNotFound);
        }