//TODO: change with validation story
        //[Fact]
        public async Task ThenResultIsNotFound()
        {
            var mockPersistentLocalIdGenerator = new Mock <IPersistentLocalIdGenerator>();

            //Arrange
            var importMunicipality = new ImportMunicipality(
                new MunicipalityId(Guid.NewGuid()),
                new NisCode("123"),
                _fixture.Create <Provenance>());

            DispatchArrangeCommand(importMunicipality);


            var body = new StreetNameProposeRequest()
            {
                GemeenteId  = $"https://data.vlaanderen.be/id/gemeente/{123}",
                Straatnamen = new Dictionary <Taal, string>()
                {
                    { Taal.NL, "Rodekruisstraat" },
                    { Taal.FR, "Rue de la Croix-Rouge" }
                }
            };

            //Act
            var result = await _controller.Propose(ResponseOptions, _idempotencyContext, _syndicationContext, mockPersistentLocalIdGenerator.Object, body);

            result.Should().BeOfType <NotFoundResult>();
        }
Esempio n. 2
0
 public static ImportMunicipality WithNisCode(
     this ImportMunicipality command,
     NisCode nisCode)
 {
     return(new ImportMunicipality(
                new MunicipalityId(command.MunicipalityId),
                nisCode,
                command.Provenance));
 }
Esempio n. 3
0
 public static ImportMunicipality WithMunicipalityId(
     this ImportMunicipality command,
     MunicipalityId municipalityId)
 {
     return(new ImportMunicipality(
                municipalityId,
                new NisCode(command.NisCode),
                command.Provenance));
 }
Esempio n. 4
0
        public async Task ThenTheStreetNameIsProposed()
        {
            const int expectedLocation = 5;

            //Arrange
            var municipalityLatestItem         = _syndicationContext.AddMunicipalityLatestItemFixture();
            var mockPersistentLocalIdGenerator = new Mock <IPersistentLocalIdGenerator>();

            mockPersistentLocalIdGenerator
            .Setup(x => x.GenerateNextPersistentLocalId())
            .Returns(new PersistentLocalId(expectedLocation));

            var importMunicipality = new ImportMunicipality(
                new MunicipalityId(municipalityLatestItem.MunicipalityId),
                new NisCode(municipalityLatestItem.NisCode),
                _fixture.Create <Provenance>());

            DispatchArrangeCommand(importMunicipality);

            var body = new StreetNameProposeRequest()
            {
                GemeenteId  = $"https://data.vlaanderen.be/id/gemeente/{municipalityLatestItem.NisCode}",
                Straatnamen = new Dictionary <Taal, string>()
                {
                    { Taal.NL, "Rodekruisstraat" },
                    { Taal.FR, "Rue de la Croix-Rouge" }
                }
            };

            //Act
            var result = (CreatedWithETagResult)await _controller.Propose(ResponseOptions, _idempotencyContext, _syndicationContext, mockPersistentLocalIdGenerator.Object, body);

            //Assert
            var expectedPosition = 1;

            result.Location.Should().Be(string.Format(DetailUrl, 1));
            //TODO: Correct when implementation is done
            //result.Location.Should().Be(string.Format(DetailUrl, expectedLocation));
            result.ETag.Should().Be(expectedPosition.ToString());
        }