Пример #1
0
        public async Task Create_ResultValueEqualExpected_Success()
        {
            var vaccination = new Vaccination()
            {
                Id = 1, Name = "testName", Type = "testType"
            };
            var vaccinationDto = _mapper.Map <VaccinationForCreationDto>(vaccination);

            _vaccinationRepositoryMock.Setup(x => x.AddAsync(vaccination));
            _vaccinationRepositoryMock.Setup(x => x.SaveAsync());

            var actual = await _service.Create(vaccinationDto);

            Assert.AreEqual(vaccinationDto, actual);
            _vaccinationRepositoryMock.Verify(x => x.SaveAsync(), Times.Once());
            _vaccinationRepositoryMock.Verify(x => x.AddAsync(It.IsAny <Vaccination>()), Times.Once());
        }
Пример #2
0
        public async Task <ActionResult> Post([FromBody] VaccinationForCreationDto vaccination)
        {
            await _service.Create(vaccination);

            return(Ok());
        }