Beispiel #1
0
        public async Task ShouldListSingleSolutionAsFoundation(bool isFoundation)
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(Solution1Id)
            .WithName("Solution1")
            .WithSupplierId(_supplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(Solution1Id)
            .WithSummary("Sln1Summary")
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(_cap1Id)
            .Build()
            .InsertAsync();

            await FrameworkSolutionEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithFoundation(isFoundation)
            .Build().InsertAsync();

            var solutions = await _solutionListRepository.ListAsync(false, null, new CancellationToken());

            var solution = solutions.Should().ContainSingle().Subject;

            solution.SolutionId.Should().Be(Solution1Id);
            solution.IsFoundation.Should().Be(isFoundation);
        }
Beispiel #2
0
        public async Task ShouldHaveOneCapability()
        {
            const string cap1Name = "Cap1";
            const string cap1Desc = "Desc1";

            await CapabilityEntityBuilder.Create()
            .WithId(_cap1Id)
            .WithName(cap1Name)
            .WithDescription(cap1Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap1Id)
            .WithSolutionId(Solution1Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            var solutionCapabilityRequest =
                await _solutionCapabilityRepository.ListSolutionCapabilities(Solution1Id, CancellationToken.None)
                .ConfigureAwait(false);

            var solutionCapability = solutionCapabilityRequest.Should().ContainSingle().Subject;

            solutionCapability.CapabilityId.Should().Be(_cap1Id);
            solutionCapability.CapabilityName.Should().Be(cap1Name);
            solutionCapability.CapabilityDescription.Should().Be(cap1Desc);
        }
        public async Task ShouldListSingleSolutionWithMultipleCapability()
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(Solution1Id)
            .WithName("Solution1")
            .WithSupplierId(SupplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(Solution1Id)
            .WithSummary("Sln1Summary")
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(cap1Id)
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(cap2Id)
            .Build()
            .InsertAsync();

            await FrameworkSolutionEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithFrameworkId("NHSDGP001")
            .Build()
            .InsertAsync();

            var solutions = (await solutionListRepository.ListAsync(false, null, null, CancellationToken.None)).ToList();

            solutions.Should().HaveCount(2);

            var solution = solutions.Should().ContainSingle(s => s.CapabilityReference == CapabilityReference1).Subject;

            solution.SolutionId.Should().Be(Solution1Id);
            solution.SolutionName.Should().Be("Solution1");
            solution.SolutionSummary.Should().Be("Sln1Summary");
            solution.SupplierId.Should().Be(SupplierId);
            solution.SupplierName.Should().Be(SupplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference1);
            solution.CapabilityName.Should().Be("Cap1");
            solution.CapabilityDescription.Should().Be("Cap1Desc");

            solution = solutions.Should().ContainSingle(s => s.CapabilityReference == CapabilityReference2).Subject;
            solution.SolutionId.Should().Be(Solution1Id);
            solution.SolutionName.Should().Be("Solution1");
            solution.SolutionSummary.Should().Be("Sln1Summary");
            solution.SupplierId.Should().Be(SupplierId);
            solution.SupplierName.Should().Be(SupplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference2);
            solution.CapabilityName.Should().Be("Cap2");
            solution.CapabilityDescription.Should().Be("Cap2Desc");
        }
Beispiel #4
0
 private static async Task InsertSolutionCapabilityAsync(string solutionId, Guid capId, bool passed = true)
 {
     await SolutionCapabilityEntityBuilder.Create()
     .WithCapabilityId(capId)
     .WithSolutionId(solutionId)
     .WithStatusId(passed ? 1 : 3)
     .Build()
     .InsertAsync();
 }
Beispiel #5
0
        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 GivenSolutionsAreLinkedToCapabilities(Table table)
        {
            var solutions = await SolutionEntity.FetchAllAsync().ConfigureAwait(false);

            var capabilities = await CapabilityEntity.FetchAllAsync().ConfigureAwait(false);

            foreach (var solutionCapabilityTable in table.CreateSet <SolutionCapabilityTable>())
            {
                await SolutionCapabilityEntityBuilder.Create()
                .WithSolutionId(solutions.First(s => s.Name == solutionCapabilityTable.Solution).Id)
                .WithCapabilityId(capabilities.First(s => s.Name == solutionCapabilityTable.Capability).Id)
                .Build()
                .InsertAsync()
                .ConfigureAwait(false);
            }
        }
Beispiel #7
0
        private async Task CreateSimpleSolutionWithOneCap(string solutionId, string supplierId = _supplierId)
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(solutionId)
            .WithName(solutionId)
            .WithSupplierId(supplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(solutionId)
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(solutionId)
            .WithCapabilityId(_cap1Id)
            .Build()
            .InsertAsync();
        }
Beispiel #8
0
        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 static async Task GivenSolutionsAreLinkedToCapabilities(Table table)
        {
            var solutions    = (await SolutionEntity.FetchAllAsync()).ToDictionary(s => s.Name);
            var capabilities = (await CapabilityEntity.FetchAllAsync()).ToDictionary(c => c.Name);

            foreach (var solutionCapability in table.CreateSet <SolutionCapabilityTable>())
            {
                if (!solutionCapability.Capability.Any())
                {
                    continue;
                }

                foreach (var capability in solutionCapability.Capability)
                {
                    await SolutionCapabilityEntityBuilder.Create()
                    .WithSolutionId(solutions[solutionCapability.Solution].SolutionId)
                    .WithCapabilityId(capabilities[capability].Id)
                    .WithStatusId(solutionCapability.Pass ? PassedSolutionCapabilityStatusId : FailedSolutionCapabilityStatusId)
                    .Build()
                    .InsertAsync();
                }
            }
        }
Beispiel #10
0
        public async Task ShouldListSingleSolutionWithSingleCapability()
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(Solution1Id)
            .WithName("Solution1")
            .WithSupplierId(_supplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(Solution1Id)
            .WithSummary("Sln1Summary")
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(_cap1Id)
            .Build()
            .InsertAsync();

            var solutions = await _solutionListRepository.ListAsync(false, null, new CancellationToken());

            var solution = solutions.Should().ContainSingle().Subject;

            solution.SolutionId.Should().Be(Solution1Id);
            solution.SolutionName.Should().Be("Solution1");
            solution.SolutionSummary.Should().Be("Sln1Summary");
            solution.SupplierId.Should().Be(_supplierId);
            solution.SupplierName.Should().Be(_supplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference1);
            solution.CapabilityName.Should().Be("Cap1");
            solution.CapabilityDescription.Should().Be("Cap1Desc");
            solution.IsFoundation.Should().BeFalse();
        }
Beispiel #11
0
        public async Task ShouldListMultipleSolutionsWithCapabilities()
        {
            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId(Solution1Id)
            .WithName("Solution1")
            .WithSupplierId(_supplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId(Solution1Id)
            .WithSummary("Sln1Summary")
            .Build()
            .InsertAsync();

            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId("Sln2")
            .WithName("Solution2")
            .WithSupplierId(_supplierId)
            .WithPublishedStatusId(3)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId("Sln2")
            .WithSummary("Sln2Summary")
            .Build()
            .InsertAsync();

            await CatalogueItemEntityBuilder
            .Create()
            .WithCatalogueItemId("Sln3")
            .WithName("Solution3")
            .WithSupplierId(_supplierId)
            .Build()
            .InsertAsync();

            await SolutionEntityBuilder.Create()
            .WithId("Sln3")
            .WithSummary("Sln3Summary")
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(_cap1Id)
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId(Solution1Id)
            .WithCapabilityId(_cap2Id)
            .Build()
            .InsertAsync();

            await SolutionCapabilityEntityBuilder.Create()
            .WithSolutionId("Sln2")
            .WithCapabilityId(_cap2Id)
            .Build()
            .InsertAsync();

            var solutions =
                (await _solutionListRepository.ListAsync(false, null, new CancellationToken())).ToList();

            solutions.Should().HaveCount(3);

            var solution = solutions.Should().ContainSingle(s => s.SolutionId == Solution1Id && s.CapabilityReference == CapabilityReference1).Subject;

            solution.SolutionId.Should().Be(Solution1Id);
            solution.SolutionName.Should().Be("Solution1");
            solution.SolutionSummary.Should().Be("Sln1Summary");
            solution.SupplierId.Should().Be(_supplierId);
            solution.SupplierName.Should().Be(_supplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference1);
            solution.CapabilityName.Should().Be("Cap1");
            solution.CapabilityDescription.Should().Be("Cap1Desc");

            solution = solutions.Should().ContainSingle(s => s.SolutionId == Solution1Id && s.CapabilityReference == CapabilityReference2).Subject;
            solution.SolutionId.Should().Be(Solution1Id);
            solution.SolutionName.Should().Be("Solution1");
            solution.SolutionSummary.Should().Be("Sln1Summary");
            solution.SupplierId.Should().Be(_supplierId);
            solution.SupplierName.Should().Be(_supplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference2);
            solution.CapabilityName.Should().Be("Cap2");
            solution.CapabilityDescription.Should().Be("Cap2Desc");

            solution = solutions.Should().ContainSingle(s => s.SolutionId == Solution2Id && s.CapabilityReference == CapabilityReference2).Subject;
            solution.SolutionId.Should().Be(Solution2Id);
            solution.SolutionName.Should().Be("Solution2");
            solution.SolutionSummary.Should().Be("Sln2Summary");
            solution.SupplierId.Should().Be(_supplierId);
            solution.SupplierName.Should().Be(_supplierName);
            solution.CapabilityReference.Should().Be(CapabilityReference2);
            solution.CapabilityName.Should().Be("Cap2");
            solution.CapabilityDescription.Should().Be("Cap2Desc");
        }
Beispiel #12
0
        public async Task ShouldHaveMultipleCapabilities()
        {
            const string cap1Name = "Cap1";
            const string cap1Desc = "Desc1";

            const string cap2Name = "Cap2";
            const string cap2Desc = "Desc2";

            const string cap3Name = "Cap3";
            const string cap3Desc = "Desc3";

            await CapabilityEntityBuilder.Create()
            .WithId(_cap1Id)
            .WithName(cap1Name)
            .WithDescription(cap1Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await CapabilityEntityBuilder.Create()
            .WithId(_cap2Id)
            .WithName(cap2Name)
            .WithDescription(cap2Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await CapabilityEntityBuilder.Create()
            .WithId(_cap3Id)
            .WithName(cap3Name)
            .WithDescription(cap3Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap1Id)
            .WithSolutionId(Solution1Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap2Id)
            .WithSolutionId(Solution1Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap3Id)
            .WithSolutionId(Solution1Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            var solutionCapabilityResponse =
                await _solutionCapabilityRepository.ListSolutionCapabilities(Solution1Id, CancellationToken.None)
                .ConfigureAwait(false);

            solutionCapabilityResponse.Count().Should().Be(3);
        }
Beispiel #13
0
        public async Task HasMultipleSolutions()
        {
            const string cap1Name = "Cap1";
            const string cap1Desc = "Desc1";

            const string cap2Name = "Cap2";
            const string cap2Desc = "Desc2";

            await SolutionEntityBuilder.Create()
            .WithId(Solution2Id)
            .WithOrganisationId(_org1Id)
            .WithSupplierId(SupplierId)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await CapabilityEntityBuilder.Create()
            .WithId(_cap1Id)
            .WithName(cap1Name)
            .WithDescription(cap1Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await CapabilityEntityBuilder.Create()
            .WithId(_cap2Id)
            .WithName(cap2Name)
            .WithDescription(cap2Desc)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap1Id)
            .WithSolutionId(Solution1Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            await SolutionCapabilityEntityBuilder.Create()
            .WithCapabilityId(_cap2Id)
            .WithSolutionId(Solution2Id)
            .Build()
            .InsertAsync()
            .ConfigureAwait(false);

            var solutionCapabilityResponseSolution1 =
                await _solutionCapabilityRepository.ListSolutionCapabilities(Solution1Id, CancellationToken.None)
                .ConfigureAwait(false);

            var solutionCapabilityResponseSolution2 =
                await _solutionCapabilityRepository.ListSolutionCapabilities(Solution2Id, CancellationToken.None)
                .ConfigureAwait(false);


            var solutionCapability1 = solutionCapabilityResponseSolution1.Should().ContainSingle().Subject;

            solutionCapability1.CapabilityId.Should().Be(_cap1Id);
            solutionCapability1.CapabilityName.Should().Be(cap1Name);
            solutionCapability1.CapabilityDescription.Should().Be(cap1Desc);

            var solutionCapability2 = solutionCapabilityResponseSolution2.Should().ContainSingle().Subject;

            solutionCapability2.CapabilityId.Should().Be(_cap2Id);
            solutionCapability2.CapabilityName.Should().Be(cap2Name);
            solutionCapability2.CapabilityDescription.Should().Be(cap2Desc);
        }