Ejemplo n.º 1
0
        public async Task MergeTags()
        {
            var tag       = _fixture.Create <TagStat>();
            var newName   = tag.TagName;
            var mergeInfo = new TagMergeInfo {
                NewTagName = newName, SourceTagIds = new int[] { 1, 2, 3 }
            };

            _photosService.Setup(m => m.MergeTags(mergeInfo.NewTagName, mergeInfo.SourceTagIds))
            .ReturnsAsync(tag);

            var response = await _tagsController.MergeTags(mergeInfo);

            _photosService.Verify(m => m.MergeTags(mergeInfo.NewTagName, mergeInfo.SourceTagIds),
                                  Times.Once);

            Assert.IsType <OkObjectResult>(response);

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

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

            var dto = value as Dto.Tag;

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