예제 #1
0
        public async Task AssociateTags()
        {
            var photo = _fixture.Create <Photo>();
            var tag   = _fixture.Create <Tag>();

            var tags = _fixture.CreateMany <Tag>(3);

            _tagData.Setup(m => m.AssociatePhotoTag(It.IsAny <int>(), It.IsAny <int>()));

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

            await _photoService.AssociateTags(photo, tags.Select(t => t.TagName).ToArray());

            _tagData.Verify(m => m.AssociatePhotoTag(It.IsAny <int>(), It.IsAny <int>()),
                            Times.Exactly(3));
        }