コード例 #1
0
        public async Task DeleteTestCase_Success_AcceptedResponse()
        {
            //Arrange
            _testCaseServiceMock.Setup(service => service.DeleteTestCase(It.IsAny <TestCaseDto>()))
            .Returns(Task.CompletedTask);
            _testCaseServiceMock.Setup(service => service.GetTestCase(It.IsAny <int>()))
            .ReturnsAsync(new TestCaseDto()
            {
                TestCaseId = 12,
                Name       = "TestCase12",
                StepCount  = 12,
                FolderId   = 100000023
            });

            // ACT
            var response = (IActionResult)await _controller.DeleteTestCase(12);

            var result = (StatusCodeResult)response;

            //Assert
            Assert.IsNotNull(result);
            _testCaseServiceMock.Verify(t => t.DeleteTestCase(It.IsAny <TestCaseDto>()), Times.Once);
            Assert.IsTrue(result.StatusCode == (int)HttpStatusCode.Accepted);
        }