Exemplo n.º 1
0
        public async Task <EstimationDto> GetEstimationAsync(string estimationId)
        {
            var estimation = await _estimationRepository.GetEstimationAsync(estimationId);

            if (string.IsNullOrEmpty(estimation))
            {
                throw new ArgumentException("Invalid estimationId", "estimationId");
            }
            return(EstimationDto.FromString(estimation));
        }
Exemplo n.º 2
0
        public async Task GetEstimationAsync_Should_Return_Cached_Estimation()
        {
            // arrange
            var estimationId = Guid.NewGuid().ToString();
            var estimation   = new EstimationDto {
                EstimationId = estimationId
            };
            var json = EstimationDto.ToString(estimation);

            _mockEstimationRepository.GetEstimationAsync(estimationId)
            .Returns(json);

            // act
            var result = await _service.GetEstimationAsync(estimationId);

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual(estimationId, result.EstimationId);
        }