public async Task ShouldUpdateImplementationTimescales() { const string expectedResult = "some implementation timescales description"; await CatalogueItemEntityBuilder .Create() .WithCatalogueItemId(_solution1Id) .WithName(_solution1Id) .WithPublishedStatusId((int)PublishedStatus.Published) .WithSupplierId(_supplierId) .Build() .InsertAsync(); await SolutionEntityBuilder.Create() .WithId(_solution1Id) .Build() .InsertAsync(); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithImplementationTimescales(expectedResult) .Build() .InsertAndSetCurrentForSolutionAsync(); var mockRequest = new Mock <IUpdateImplementationTimescalesRequest>(); mockRequest.Setup(m => m.SolutionId).Returns(_solution1Id); mockRequest.Setup(m => m.Description).Returns(expectedResult); await _solutionDetailRepository.UpdateImplementationTimescalesAsync(mockRequest.Object, new CancellationToken()); var solution = await SolutionEntity.GetByIdAsync(_solution1Id); solution.Id.Should().Be(_solution1Id); var marketingData = await SolutionDetailEntity.GetBySolutionIdAsync(_solution1Id); marketingData.ImplementationDetail.Should().Be(expectedResult); (await marketingData.LastUpdated.SecondsFromNow()).Should().BeLessOrEqualTo(5); }
public async Task ShouldUpdateFeatures() { await CatalogueItemEntityBuilder .Create() .WithCatalogueItemId(_solution1Id) .WithName(_solution1Id) .WithPublishedStatusId((int)PublishedStatus.Published) .WithSupplierId(_supplierId) .Build() .InsertAsync(); await SolutionEntityBuilder.Create() .WithId(_solution1Id) .Build() .InsertAsync(); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithAboutUrl("AboutUrl") .WithFeatures("Features") .Build() .InsertAndSetCurrentForSolutionAsync(); var mockUpdateSolutionFeaturesRequest = new Mock <IUpdateSolutionFeaturesRequest>(); mockUpdateSolutionFeaturesRequest.Setup(m => m.SolutionId).Returns(_solution1Id); mockUpdateSolutionFeaturesRequest.Setup(m => m.Features).Returns("Features4"); await _solutionDetailRepository.UpdateFeaturesAsync(mockUpdateSolutionFeaturesRequest.Object, new CancellationToken()); var solution = await SolutionEntity.GetByIdAsync(_solution1Id); solution.Id.Should().Be(_solution1Id); var marketingData = await SolutionDetailEntity.GetBySolutionIdAsync(_solution1Id); marketingData.AboutUrl.Should().Be("AboutUrl"); marketingData.Features.Should().Be("Features4"); (await marketingData.LastUpdated.SecondsFromNow()).Should().BeLessOrEqualTo(5); }
public async Task ShouldUpdateHosting() { const string expectedResult = "{ 'SomethingElse': [] }"; await CatalogueItemEntityBuilder .Create() .WithCatalogueItemId(_solution1Id) .WithName(_solution1Id) .WithPublishedStatusId((int)PublishedStatus.Published) .WithSupplierId(_supplierId) .Build() .InsertAsync(); await SolutionEntityBuilder.Create() .WithId(_solution1Id) .Build() .InsertAsync(); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithHosting("{ 'Something': [] }") .Build() .InsertAndSetCurrentForSolutionAsync(); var mockUpdateHostingRequest = new Mock <IUpdateSolutionHostingRequest>(); mockUpdateHostingRequest.Setup(m => m.SolutionId).Returns(_solution1Id); mockUpdateHostingRequest.Setup(m => m.Hosting).Returns(expectedResult); await _solutionDetailRepository.UpdateHostingAsync(mockUpdateHostingRequest.Object, new CancellationToken()); var solution = await SolutionEntity.GetByIdAsync(_solution1Id); solution.Id.Should().Be(_solution1Id); var marketingData = await SolutionDetailEntity.GetBySolutionIdAsync(_solution1Id); marketingData.Hosting.Should().Be(expectedResult); (await marketingData.LastUpdated.SecondsFromNow()).Should().BeLessOrEqualTo(5); }
public async Task ShouldUpdateClientApplicationType() { await SolutionEntityBuilder.Create() .WithName("Solution1") .WithId(_solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .Build() .InsertAsync() .ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithAboutUrl("AboutUrl") .WithClientApplication("Browser-based") .Build() .InsertAndSetCurrentForSolutionAsync() .ConfigureAwait(false); var mockUpdateSolutionClientApplicationRequest = new Mock <IUpdateSolutionClientApplicationRequest>(); mockUpdateSolutionClientApplicationRequest.Setup(m => m.SolutionId).Returns(_solution1Id); mockUpdateSolutionClientApplicationRequest.Setup(m => m.ClientApplication).Returns("Browser-based"); await _solutionDetailRepository.UpdateClientApplicationAsync(mockUpdateSolutionClientApplicationRequest.Object, new CancellationToken()) .ConfigureAwait(false); var solution = await SolutionEntity.GetByIdAsync(_solution1Id) .ConfigureAwait(false); solution.Id.Should().Be(_solution1Id); var marketingData = await SolutionDetailEntity.GetBySolutionIdAsync(_solution1Id) .ConfigureAwait(false); marketingData.AboutUrl.Should().Be("AboutUrl"); marketingData.ClientApplication.Should().Be("Browser-based"); (await marketingData.LastUpdated.SecondsFromNow().ConfigureAwait(false)).Should().BeLessOrEqualTo(5); }
public static async Task LastUpdatedHasUpdatedOnSolutionDetail(string solutionId) { var solutionDetail = await SolutionDetailEntity.GetBySolutionIdAsync(solutionId).ConfigureAwait(false); (await solutionDetail.LastUpdated.SecondsFromNow().ConfigureAwait(false)).Should().BeLessOrEqualTo(5); }
public async Task ShouldUpdateSummary() { await SolutionEntityBuilder.Create() .WithName("Solution1") .WithId(_solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .Build() .InsertAsync() .ConfigureAwait(false); await SolutionEntityBuilder.Create() .WithName("Solution2") .WithId(_solution2Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .Build() .InsertAsync() .ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithAboutUrl("AboutUrl1") .WithFeatures("Features") .WithClientApplication("Browser-based") .Build() .InsertAndSetCurrentForSolutionAsync() .ConfigureAwait(false); var mockUpdateSolutionSummaryRequest = new Mock <IUpdateSolutionSummaryRequest>(); mockUpdateSolutionSummaryRequest.Setup(m => m.SolutionId).Returns(_solution1Id); mockUpdateSolutionSummaryRequest.Setup(m => m.Summary).Returns("Sln4Summary"); mockUpdateSolutionSummaryRequest.Setup(m => m.Description).Returns("Sln4Description"); mockUpdateSolutionSummaryRequest.Setup(m => m.AboutUrl).Returns("AboutUrl4"); await _solutionDetailRepository.UpdateSummaryAsync(mockUpdateSolutionSummaryRequest.Object, new CancellationToken()) .ConfigureAwait(false); var solution = await SolutionEntity.GetByIdAsync(_solution1Id) .ConfigureAwait(false); solution.Id.Should().Be(_solution1Id); solution.Name.Should().Be("Solution1"); solution = await SolutionEntity.GetByIdAsync(_solution2Id) .ConfigureAwait(false); solution.Id.Should().Be(_solution2Id); solution.Name.Should().Be("Solution2"); var solutionDetail = await SolutionDetailEntity.GetBySolutionIdAsync(_solution1Id) .ConfigureAwait(false); solutionDetail.Summary.Should().Be("Sln4Summary"); solutionDetail.FullDescription.Should().Be("Sln4Description"); solutionDetail.AboutUrl.Should().Be("AboutUrl4"); solutionDetail.Features.Should().Be("Features"); solutionDetail.ClientApplication.Should().Be("Browser-based"); (await solutionDetail.LastUpdated.SecondsFromNow().ConfigureAwait(false)).Should().BeLessOrEqualTo(5); }