コード例 #1
0
        public async Task AddImageToCatalogAsyncCallsMethodOfRepository_And_SavesChanges()
        {
            var updateImageCatalog = new UpdateImageCatalogDto()
            {
                CatalogId = 1,
                ImageId   = 1
            };
            Expression <Func <ImageCatalog, bool> > ex = i => i.ImageId == updateImageCatalog.ImageId && i.CatalogId == updateImageCatalog.CatalogId;

            await _service.AddImageToCatalogAsync(updateImageCatalog);

            _catalogRepositoryMock.Verify(r => r.AddImageToCatalog(It.Is(ex)), Times.Once);
            _dbContextMock.Verify(r => r.SaveChangesAsync(CancellationToken.None), Times.Once);
        }