Exemple #1
0
        public async Task CheckChooseForFundingStatus_GivenNoSpecSummariesFoundForFundingPeriodId_ReturnsCanChoose()
        {
            //Arrange
            SpecificationSummary specificationSummary = new SpecificationSummary
            {
                FundingPeriod = new Reference
                {
                    Id = fundingPeriodId
                }
            };

            ISpecificationService specificationService = CreateSpecificationService();

            specificationService
            .GetSpecificationSummaryById(Arg.Is(specificationId))
            .Returns(specificationSummary);

            specificationService
            .GetSpecificationsSelectedForFundingByPeriod(Arg.Is(fundingPeriodId))
            .Returns((IEnumerable <SpecificationSummary>)null);

            SpecificationFundingStatusService specificationFundingStatusService = CreateSpecificationFundingStatusService(specificationService: specificationService);

            //Act
            SpecificationFundingStatus status = await specificationFundingStatusService.CheckChooseForFundingStatus(specificationId);

            //Assert
            status
            .Should()
            .Be(SpecificationFundingStatus.CanChoose);
        }
Exemple #2
0
        public async Task CheckChooseForFundingStatus_GivenSpecWIthMultipleFundingStreamsAndSpecsReturnedForFundingPeriodWithSameFundingStream_ReturnsSharesAlreadyChoseFundingStream()
        {
            //Arrange
            SpecificationSummary specificationSummary = new SpecificationSummary
            {
                FundingPeriod = new Reference
                {
                    Id = fundingPeriodId
                },
                FundingStreams = new[]
                {
                    new Reference("fs-2", "fs2"),
                    new Reference("fs-4", "fs4")
                }
            };

            IEnumerable <SpecificationSummary> specificationSummaries = new[]
            {
                new SpecificationSummary
                {
                    FundingStreams = new[]
                    {
                        new Reference("fs-1", "fs1"),
                        new Reference("fs-5", "fs5"),
                    }
                },
                new SpecificationSummary
                {
                    FundingStreams = new[]
                    {
                        new Reference("fs-3", "fs3"),
                        new Reference("fs-4", "fs4"),
                    }
                }
            };

            ISpecificationService specificationService = CreateSpecificationService();

            specificationService
            .GetSpecificationSummaryById(Arg.Is(specificationId))
            .Returns(specificationSummary);

            specificationService
            .GetSpecificationsSelectedForFundingByPeriod(Arg.Is(fundingPeriodId))
            .Returns(specificationSummaries);

            SpecificationFundingStatusService specificationFundingStatusService = CreateSpecificationFundingStatusService(specificationService: specificationService);

            //Act
            SpecificationFundingStatus status = await specificationFundingStatusService.CheckChooseForFundingStatus(specificationId);

            //Assert
            status
            .Should()
            .Be(SpecificationFundingStatus.SharesAlreadyChosenFundingStream);
        }
Exemple #3
0
        public async Task CheckChooseForFundingStatus_GivenSpecificationSummaryButAlreadyChosen_ReturnsAlreadyChosen()
        {
            //Arrange
            SpecificationSummary specificationSummary = new SpecificationSummary
            {
                IsSelectedForFunding = true
            };

            ISpecificationService specificationService = CreateSpecificationService();

            specificationService
            .GetSpecificationSummaryById(Arg.Is(specificationId))
            .Returns(specificationSummary);

            SpecificationFundingStatusService specificationFundingStatusService = CreateSpecificationFundingStatusService(specificationService: specificationService);

            //Act
            SpecificationFundingStatus status = await specificationFundingStatusService.CheckChooseForFundingStatus(specificationId);

            //Assert
            status
            .Should()
            .Be(SpecificationFundingStatus.AlreadyChosen);
        }