//TODO: uncomment when implementation is done //[Fact] public async Task ThenAggregateIsNotFound() { //Arrange var municipalityLatestItem = _syndicationContext.AddMunicipalityLatestItemFixture(); var mockPersistentLocalIdGenerator = new Mock <IPersistentLocalIdGenerator>(); mockPersistentLocalIdGenerator .Setup(x => x.GenerateNextPersistentLocalId()) .Returns(new PersistentLocalId(5)); 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 Func <Task> act = async() => await _controller.Propose(ResponseOptions, _idempotencyContext, _syndicationContext, mockPersistentLocalIdGenerator.Object, body); //Assert act.Should().Throw <AggregateNotFoundException>(); }
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()); }