Ejemplo n.º 1
0
        public async Task StreetNameWasRegisteredInsertsRecord()
        {
            var id         = Arrange(Produce.Guid());
            var provenance = Arrange(Generate.Provenance);

            await GivenEvents()
            .Project(Generate.StreetNameWasRegistered
                     .Select(e => e.WithId(id)
                             .WithProvenance(provenance)))
            .Then(async ct => (await ct.FindAsync <StreetNameListItem>(id)).Should().NotBeNull());
        }
        public async Task StreetNameBecameCompleteSetsCompleted()
        {
            var id         = Arrange(Produce.Guid());
            var provenance = Arrange(Generate.Provenance);

            await GivenEvents(Generate.EventsFor.StreetName(id))
            .Project(Generate.StreetNameBecameComplete
                     .Select(e => e.WithId(id).WithProvenance(provenance)))
            .Then(async ct => {
                var entity = await ct.FindAsync <StreetNameDetail>(id);
                entity.Should().NotBeNull();
                entity.Complete.Should().BeTrue();
            });
        }
        public async Task StreetNameWasRetiredSetsStatus()
        {
            var id         = Arrange(Produce.Guid());
            var provenance = Arrange(Generate.Provenance);

            await GivenEvents(Generate.EventsFor.StreetName(id))
            .Project(Generate.StreetNameWasRetired
                     .Select(e => e.WithId(id).WithProvenance(provenance)))
            .Then(async ct =>
            {
                var entity = await ct.FindAsync <StreetNameDetail>(id);
                entity.Should().NotBeNull();
                entity.Status.Should().Be(StreetNameStatus.Retired);
            });
        }
Ejemplo n.º 4
0
        public async Task StreetNamePersistentLocalIdWasAssignedAssignsOsloId()
        {
            var id = Arrange(Produce.Guid());
            var persistentLocalId = Arrange(Produce.Integer(10000, 15000));

            await GivenEvents(Generate.EventsFor.StreetName(id))
            .Project(Generate.StreetNamePersistentLocalIdWasAssigned
                     .Select(e => e.WithId(id)
                             .WithPersistentLocalId(persistentLocalId)))
            .Then(async ct =>
            {
                var entity = await ct.FindAsync <StreetNameListItem>(id);
                entity.Should().NotBeNull();
                entity.PersistentLocalId.Should().Be(persistentLocalId);
            });
        }
Ejemplo n.º 5
0
        public async Task EventThrowsIfNoRecordFound()
        {
            var id = Arrange(Produce.Guid());

            try
            {
                await GivenEvents()
                .Project(Generate.StreetNamePersistentLocalIdWasAssigned.Select(e => e.WithId(id)))
                .Then(async ct =>
                {
                    var entity = await ct.FindAsync <StreetNameListItem>(id);
                    entity.Should().BeNull();
                });
            }
            catch (Exception e)
            {
                Assert.IsType <ProjectionItemNotFoundException <StreetNameListProjections> >(e);
            }
        }
Ejemplo n.º 6
0
        public async Task StreetNameNameWasClearedClearsName()
        {
            var id         = Arrange(Produce.Guid());
            var nameDutch  = Arrange(Generate.StreetNameString);
            var provenance = Arrange(Generate.Provenance);
            var language   = Language.Dutch;

            await GivenEvents(Generate.EventsFor.StreetName(id, nameDutch))
            .Project(Generate.StreetNameNameWasCleared
                     .Select(e => e.WithId(id)
                             .WithLanguage(language)
                             .WithProvenance(provenance)))
            .Then(async ct =>
            {
                var entity = await ct.FindAsync <StreetNameListItem>(id);
                entity.Should().NotBeNull();
                entity.NameDutch.Should().BeEmpty();
            });
        }
        public async Task MunicipalityEventInsertsRecord(MunicipalityEvent @event)
        {
            var id       = Arrange(Produce.Guid());
            var position = Arrange(Produce.Integer(100, 6000));

            await Given()
            .Project(Generate.AtomEntry(@event, position)
                     .Select(e => e
                             .WithObjectId <Gemeente>(id))
                     .Generate(new Random()))
            .Then(async context =>
            {
                var entry = await context.FindAsync <MunicipalitySyndicationItem>(id, (long)position);

                entry.Should().NotBeNull();
                entry.MunicipalityId.Should().Be(id);
                entry.Position.Should().Be(position);
            });
        }