コード例 #1
0
        public async Task DeleteSizeAsync_IfObjectExists_ReturnsDeletedObject()
        {
            //arrange
            _existingSize = _sizes[0];
            _context
            .Setup(c => c.DeleteAsync(_existingSize.SizeId))
            .Returns(async() => {
                return(await Task.Run(() => {
                    return _existingSize;
                }));
            });
            //act
            var result = await _sizeService.DeleteSizeAsync(_existingSize.SizeId);

            //assert
            _context.Verify(c => c.DeleteAsync(_existingSize.SizeId), Times.Once);
        }