Пример #1
0
        public async Task WhenPublicServiceWasRemoved()
        {
            var projection = new PublicServiceLifeCycleListProjections();
            var resolver   = ConcurrentResolve.WhenEqualToHandlerMessageType(projection.Handlers);

            var stageWasAddedToLifeCycle = _fixture.Create <StageWasAddedToLifeCycle>();
            var publicServiceWasRemoved  = new PublicServiceWasRemoved(
                new PublicServiceId(stageWasAddedToLifeCycle.PublicServiceId),
                new ReasonForRemoval("testing purposes"));

            await new ConnectedProjectionScenario <BackofficeContext>(resolver)
            .Given(
                new Envelope <StageWasAddedToLifeCycle>(new Envelope(stageWasAddedToLifeCycle, new Dictionary <string, object>())),
                new Envelope <PublicServiceWasRemoved>(new Envelope(publicServiceWasRemoved, new Dictionary <string, object>())))
            .Verify(async context =>
            {
                var publicService =
                    await context.PublicServiceLifeCycleList.FirstOrDefaultAsync(a =>
                                                                                 a.PublicServiceId == stageWasAddedToLifeCycle.PublicServiceId && a.LifeCycleStageId == stageWasAddedToLifeCycle.LifeCycleStageId);

                publicService.Should().BeNull();

                return(VerificationResult.Pass());
            })
            .Assert();
        }
Пример #2
0
        public Task WhenPublicServiceWasRemoved()
        {
            var labelWasAssigned        = _fixture.Create <LabelWasAssigned>();
            var anotherLabelWasAssigned = _fixture.Create <LabelWasAssigned>();
            var publicServiceWasRemoved = new PublicServiceWasRemoved(new PublicServiceId(labelWasAssigned.PublicServiceId), new ReasonForRemoval("because"));

            return(new PublicServiceLabelListProjections()
                   .Scenario()
                   .Given(labelWasAssigned, anotherLabelWasAssigned, publicServiceWasRemoved)
                   .Expect(CreateListItemFromEvent(anotherLabelWasAssigned)));
        }
Пример #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(PublicServiceWasRemoved @event)
 {
     IsRemoved = true;
 }