public async Task ShouldRetrieveImplementationTimescalesWhenPresent() { const string expectedImplementationTimescalesString = "I am the integrations 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() .WithImplementationTimescales(expectedImplementationTimescalesString) .Build() .InsertAndSetCurrentForSolutionAsync(); var result = await _solutionDetailRepository.GetImplementationTimescalesBySolutionIdAsync(_solution1Id, new CancellationToken()); result.Description.Should().Be(expectedImplementationTimescalesString); }
public async Task ShouldListSingleSolutionAsFoundation(bool isFoundation) { await SolutionEntityBuilder.Create() .WithName("Solution1") .WithId(Solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .WithPublishedStatusId(3) .Build() .InsertAsync().ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithSummary("Sln1Summary") .Build() .InsertAndSetCurrentForSolutionAsync().ConfigureAwait(false); await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithCapabilityId(_cap1Id) .Build() .InsertAsync().ConfigureAwait(false); await FrameworkSolutionEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithFoundation(isFoundation) .Build().InsertAsync().ConfigureAwait(false); var solutions = await _solutionListRepository.ListAsync(false, new CancellationToken()).ConfigureAwait(false); var solution = solutions.Should().ContainSingle().Subject; solution.SolutionId.Should().Be(Solution1Id); solution.IsFoundation.Should().Be(isFoundation); }
public async Task ShouldGetByIdFoundation(bool isFoundation) { 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) .Build() .InsertAndSetCurrentForSolutionAsync(); await FrameworkSolutionEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithFoundation(isFoundation) .Build() .InsertAsync(); var solution = await _solutionRepository.ByIdAsync(_solution1Id, new CancellationToken()); solution.Id.Should().Be(_solution1Id); solution.IsFoundation.Should().Be(isFoundation); }
public async Task ShouldGetByIdFoundation(bool isFoundation) { await SolutionEntityBuilder.Create() .WithName("Solution1") .WithId(_solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .Build() .InsertAsync() .ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .Build() .InsertAndSetCurrentForSolutionAsync() .ConfigureAwait(false); await FrameworkSolutionEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithFoundation(isFoundation) .Build() .InsertAsync() .ConfigureAwait(false); var solution = await _solutionRepository.ByIdAsync(_solution1Id, new CancellationToken()).ConfigureAwait(false); solution.Id.Should().Be(_solution1Id); solution.IsFoundation.Should().Be(isFoundation); }
public async Task ShouldRetrieveRoadmapWhenPresent() { const string expectedRoadmapString = "I am the roadmap string"; 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() .WithRoadMap(expectedRoadmapString) .Build() .InsertAndSetCurrentForSolutionAsync(); var result = await _solutionDetailRepository.GetRoadMapBySolutionIdAsync(_solution1Id, new CancellationToken()); result.Summary.Should().Be(expectedRoadmapString); }
public async Task ShouldRetrieveClientApplicationDetailsWhenPresent() { const string expectedClientApplication = "I am the client application string"; 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() .WithClientApplication(expectedClientApplication) .Build() .InsertAndSetCurrentForSolutionAsync(); var result = await _solutionDetailRepository.GetClientApplicationBySolutionIdAsync(_solution1Id, new CancellationToken()); result.ClientApplication.Should().Be(expectedClientApplication); }
public async Task ShouldListSingleSolutionWithMultipleCapability() { await SolutionEntityBuilder.Create() .WithName("Solution1") .WithId(Solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .WithPublishedStatusId(3) .Build() .InsertAsync().ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithSummary("Sln1Summary") .Build() .InsertAndSetCurrentForSolutionAsync().ConfigureAwait(false); await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithCapabilityId(_cap1Id) .Build() .InsertAsync().ConfigureAwait(false); await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(Solution1Id) .WithCapabilityId(_cap2Id) .Build() .InsertAsync().ConfigureAwait(false); var solutions = (await _solutionListRepository.ListAsync(false, new CancellationToken()).ConfigureAwait(false)).ToList(); solutions.Should().HaveCount(2); var solution = solutions.Should().ContainSingle(s => s.CapabilityId == _cap1Id).Subject; solution.SolutionId.Should().Be(Solution1Id); solution.SolutionName.Should().Be("Solution1"); solution.SolutionSummary.Should().Be("Sln1Summary"); solution.OrganisationId.Should().Be(_org1Id); solution.OrganisationName.Should().Be(_orgName); solution.CapabilityId.Should().Be(_cap1Id); solution.CapabilityName.Should().Be("Cap1"); solution.CapabilityDescription.Should().Be("Cap1Desc"); solution = solutions.Should().ContainSingle(s => s.CapabilityId == _cap2Id).Subject; solution.SolutionId.Should().Be(Solution1Id); solution.SolutionName.Should().Be("Solution1"); solution.SolutionSummary.Should().Be("Sln1Summary"); solution.OrganisationId.Should().Be(_org1Id); solution.OrganisationName.Should().Be(_orgName); solution.CapabilityId.Should().Be(_cap2Id); solution.CapabilityName.Should().Be("Cap2"); solution.CapabilityDescription.Should().Be("Cap2Desc"); }
public static async Task GivenSolutionDetailExist(Table table) { foreach (var solutionDetail in table.CreateSet <SolutionDetailTable>()) { await SolutionDetailEntityBuilder.Create() .WithFeatures(solutionDetail.Features) .WithSummary(solutionDetail.SummaryDescription) .WithFullDescription(solutionDetail.FullDescription) .WithAboutUrl(solutionDetail.AboutUrl) .WithSolutionId(solutionDetail.Solution) .WithClientApplication(solutionDetail.ClientApplication) .WithLastUpdated(solutionDetail.LastUpdated != DateTime.MinValue ? solutionDetail.LastUpdated : DateTime.UtcNow) .Build() .InsertAndSetCurrentForSolutionAsync() .ConfigureAwait(false); } }
public async Task ShouldGetById() { await CatalogueItemEntityBuilder .Create() .WithCatalogueItemId(_solution1Id) .WithName("Solution1") .WithPublishedStatusId((int)PublishedStatus.Published) .WithSupplierId(_supplierId) .Build() .InsertAsync(); await SolutionEntityBuilder.Create() .WithId(_solution1Id) .WithOnLastUpdated(_lastUpdated) .Build() .InsertAsync(); await SolutionDetailEntityBuilder.Create() .WithSolutionId(_solution1Id) .WithSummary("Sln1Summary") .WithFullDescription("Sln1Description") .WithAboutUrl("AboutUrl") .WithFeatures("Features") .WithClientApplication("Browser-based") .WithHosting("Hosting") .WithLastUpdated(_lastUpdated) .Build() .InsertAndSetCurrentForSolutionAsync(); var solution = await _solutionRepository.ByIdAsync(_solution1Id, new CancellationToken()); solution.Id.Should().Be(_solution1Id); solution.Name.Should().Be("Solution1"); solution.LastUpdated.Should().Be(_lastUpdated); solution.Summary.Should().Be("Sln1Summary"); solution.Description.Should().Be("Sln1Description"); solution.AboutUrl.Should().Be("AboutUrl"); solution.Features.Should().Be("Features"); solution.ClientApplication.Should().Be("Browser-based"); solution.Hosting.Should().Be("Hosting"); solution.IsFoundation.Should().BeFalse(); solution.PublishedStatus.Should().Be(PublishedStatus.Published); }
public static async Task GivenSolutionDetailExist(Table table) { foreach (var solutionDetail in table.CreateSet <SolutionDetailTable>()) { await SolutionDetailEntityBuilder.Create() .WithFeatures(solutionDetail.Features) .WithSummary(solutionDetail.SummaryDescription) .WithFullDescription(solutionDetail.FullDescription) .WithAboutUrl(solutionDetail.AboutUrl) .WithSolutionId(solutionDetail.Solution) .WithClientApplication(solutionDetail.ClientApplication) .WithHosting(solutionDetail.Hosting) .WithRoadMap(solutionDetail.RoadMap) .WithIntegrationsUrl(solutionDetail.IntegrationsUrl) .WithImplementationTimescales(solutionDetail.ImplementationDetail) .WithLastUpdated(solutionDetail.LastUpdated != DateTime.MinValue ? solutionDetail.LastUpdated : DateTime.UtcNow) .Build() .InsertAndSetCurrentForSolutionAsync(); } }
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 async Task ShouldRetrieveClientApplicationDetailsWhenPresent() { var expectedClientApplication = "I am the client application string"; await SolutionEntityBuilder.Create() .WithId(_solution1Id) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .Build() .InsertAsync() .ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithClientApplication(expectedClientApplication) .Build() .InsertAndSetCurrentForSolutionAsync() .ConfigureAwait(false); var result = await _solutionDetailRepository.GetClientApplicationBySolutionIdAsync(_solution1Id, new CancellationToken()) .ConfigureAwait(false); result.ClientApplication.Should().Be(expectedClientApplication); }
private async Task CreateSimpleSolutionWithOneCap(string solutionId) { await SolutionEntityBuilder.Create() .WithName(solutionId) .WithId(solutionId) .WithOrganisationId(_org1Id) .WithSupplierId(_supplierId) .WithPublishedStatusId(3) .Build() .InsertAsync().ConfigureAwait(false); await SolutionDetailEntityBuilder.Create() .WithSolutionId(solutionId) .Build() .InsertAndSetCurrentForSolutionAsync().ConfigureAwait(false); await SolutionCapabilityEntityBuilder.Create() .WithSolutionId(solutionId) .WithCapabilityId(_cap1Id) .Build() .InsertAsync().ConfigureAwait(false); }
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); }