コード例 #1
0
        public void GetByIdTest_ThrowException()
        {
            mockCache.Setup(x => x.GetById(5)).ThrowsAsync(new JobNotFoundException(5));

            var instance = new MergeSortOperation(mockCache.Object, mockLogger.Object);

            Assert.ThrowsAsync <JobNotFoundException>(() => instance.GetById(5));
        }
コード例 #2
0
        public async Task GetByIdTest_Success()
        {
            var mockValue = TestData.completedExecution;

            mockCache.Setup(x => x.GetById(5)).ReturnsAsync(mockValue);

            var instance = new MergeSortOperation(mockCache.Object, mockLogger.Object);
            var result   = await instance.GetById(5);

            mockValue.Should().BeEquivalentTo(result);
        }