Пример #1
0
        public async Task CanGetFeatureIfDoesNotExist()
        {
            const int featureId = 123;

            _featuresRepository.Setup(repo => repo.GetAsync(featureId)).ReturnsAsync(default(Feature));

            var actual = await _controller.GetFeatureAsync(featureId);

            _featuresRepository.Verify(repo => repo.GetAsync(featureId), Times.Once);
            _mapper.Verify(m => m.Map <Feature, KeyValuePairResource>(_features.First()), Times.Never);

            var error = ControllerTestHelper.GetNotFoundError(actual);

            Assert.AreEqual("Feature with id = 123 does not exist!", error);
        }
Пример #2
0
        public async Task CanGetMakeIfDoesNotExist()
        {
            const int makeId = 123;

            _makesRepository.Setup(repo => repo.GetAsync(makeId)).ReturnsAsync(default(Make));

            var actual = await _controller.GetMakeAsync(makeId);

            _makesRepository.Verify(repo => repo.GetAsync(makeId), Times.Once);
            _mapper.Verify(m => m.Map <Make, MakeResource>(_makes.First()), Times.Never);

            var error = ControllerTestHelper.GetNotFoundError(actual);

            Assert.AreEqual("Make with id = 123 does not exist!", error);
        }