public async Task GivenTheSpecificationHasTheFollowingFundingStreams(Table table)
        {
            IEnumerable <Reference> fundingStreams = table.CreateSet <Reference>();

            Guard.IsNullOrWhiteSpace(_currentSpecificationContext.SpecificationId, nameof(_currentSpecificationContext.SpecificationId));
            SpecificationSummary specificationSummary = await _currentSpecificationContext.Repo.GetSpecificationSummaryById(_currentSpecificationContext.SpecificationId);

            specificationSummary
            .Should()
            .NotBeNull();

            specificationSummary.FundingStreams = fundingStreams;
        }
        public async Task GivenTheSpecificationHasTheFundingPeriodWithIdAndName(string fundingPeriodId, string fundingPeriodName)
        {
            Guard.IsNullOrWhiteSpace(_currentSpecificationContext.SpecificationId, nameof(_currentSpecificationContext.SpecificationId));
            Guard.IsNullOrWhiteSpace(fundingPeriodId, nameof(fundingPeriodId));
            Guard.IsNullOrWhiteSpace(fundingPeriodName, nameof(fundingPeriodName));

            SpecificationSummary specificationSummary = await _currentSpecificationContext.Repo.GetSpecificationSummaryById(_currentSpecificationContext.SpecificationId);

            specificationSummary
            .Should()
            .NotBeNull();

            specificationSummary.FundingPeriod = new Common.Models.Reference(fundingPeriodId, fundingPeriodName);
        }
        public async Task GivenTheSpecificationHasTheFollowingTemplateVersionsForFundingStreams(Table table)
        {
            Guard.IsNullOrWhiteSpace(_currentSpecificationContext.SpecificationId, nameof(_currentSpecificationContext.SpecificationId));
            SpecificationSummary specificationSummary = await _currentSpecificationContext.Repo.GetSpecificationSummaryById(_currentSpecificationContext.SpecificationId);

            specificationSummary
            .Should()
            .NotBeNull();

            IEnumerable <KeyValuePair <string, string> > templateVersions = table.CreateSet <KeyValuePair <string, string> >();

            templateVersions
            .Should()
            .NotBeNull();

            specificationSummary.TemplateIds = new Dictionary <string, string>(templateVersions);
        }
        public async Task GetSelectedSpecificationsByFundingPeriodIdAndFundingStreamId_GivenFundingStreamIdAndFundingPeriodId_ReturnsSpecificationSummary()
        {
            string fundingStreamId = NewRandomString();
            string fundingPeriodId = NewRandomString();
            string specificationId = NewRandomString();

            IMapper mapper = CreateImplementedMapper();
            ISpecificationsRepository specificationsRepository = CreateSpecificationsRepository();

            IEnumerable <Specification> specifications = NewSpecifications(_ => _.WithId(specificationId));

            specificationsRepository
            .GetSpecificationsSelectedForFundingByPeriodAndFundingStream(fundingPeriodId, fundingStreamId)
            .Returns(specifications);

            SpecificationsService service = CreateService(
                mapper: mapper,
                specificationsRepository: specificationsRepository);

            IActionResult result = await service.GetSelectedSpecificationsByFundingPeriodIdAndFundingStreamId(fundingPeriodId, fundingStreamId);

            result
            .Should()
            .BeOfType <OkObjectResult>()
            .Which
            .Value
            .Should()
            .BeOfType <List <SpecificationSummary> >()
            .And
            .NotBeNull();

            List <SpecificationSummary> objContent           = (List <SpecificationSummary>)((OkObjectResult)result).Value;
            SpecificationSummary        specificationSummary = objContent.FirstOrDefault();

            specificationSummary
            .Should()
            .NotBeNull();

            specificationSummary
            .Id
            .Should()
            .Be(specificationId);
        }