コード例 #1
0
        public void DeleteLabel_InValidId()
        {
            _labelService.Setup(p => p.DeleteLabel(0)).Returns(0);
            var returnObj = labelController.DeleteLabel(0);
            var okResult  = returnObj.Result as ObjectResult;

            Assert.IsTrue((int)okResult.Value == 0);
        }
コード例 #2
0
        public void Delete_ExistingIdPassed_RemovesItem()
        {
            // Act
            _ = controller.DeleteLabel("1").Result;

            // Assert
            var result = controller.GetLabels().Result;
            var items  = Assert.IsType <List <Label> >(result.Value);

            Assert.Single(items);
        }
コード例 #3
0
        public async Task DeleteLabelTest()
        {
            IActionResult result = await controller.DeleteLabel(1);

            OkObjectResult response = result as OkObjectResult;

            Assert.AreEqual(StatusCodes.Status200OK, (int)response.StatusCode);
        }