コード例 #1
0
        public async Task UpdateTag()
        {
            var tag = _fixture.Create <Tag>();
            var dto = new Dto.Tag(tag);

            _photosService.Setup(m => m.SaveTag(It.IsAny <Tag>()))
            .ReturnsAsync(tag);

            var response = await _tagsController.UpdateTag(dto);

            _photosService.Verify(m => m.SaveTag(It.IsAny <Tag>()),
                                  Times.Once);

            Assert.IsType <OkObjectResult>(response);

            var value = ((OkObjectResult)response).Value;

            Assert.IsType <Dto.Tag>(value);

            var dto2 = value as Dto.Tag;

            Assert.Equal(dto.TagName, dto2.TagName);
            Assert.Equal(dto.TagId, dto2.TagId);
        }