Ejemplo n.º 1
0
        public async Task ProfilePatternQueryRepository_ShouldGetFundingStreamPeriodProfilePatternByIdIfExists()
        {
            // arrange
            FundingStreamPeriodProfilePattern fundingStreamPeriodProfilePattern = _fundingStreamPeriodProfilePatternBuilder.Build();
            var fundingStreamPeriodProfilePatternId = fundingStreamPeriodProfilePattern.Id;

            _mockCosmoRepository.Setup(x => x.ReadDocumentByIdAsync <FundingStreamPeriodProfilePattern>(fundingStreamPeriodProfilePatternId))
            .ReturnsAsync(new DocumentEntity <FundingStreamPeriodProfilePattern>(fundingStreamPeriodProfilePattern));

            // act
            var profilePattern = await _repository.GetProfilePattern(fundingStreamPeriodProfilePatternId);

            // assert
            profilePattern.Id.Should().Be(fundingStreamPeriodProfilePatternId);
            _mockCosmoRepository.Verify(x => x.ReadDocumentByIdAsync <FundingStreamPeriodProfilePattern>(It.Is <string>(id => id == fundingStreamPeriodProfilePatternId)), Times.Once);
        }
 private async Task <FundingStreamPeriodProfilePattern> WhenTheProfilePatternIsQueried(string id)
 {
     return(await _repository.GetProfilePattern(id));
 }