Ejemplo n.º 1
0
        public async Task TestDeleteValidModelShouldReturnTrue()
        {
            var model = new NodeDeletePostModel()
            {
                NodeId = 1
            };

            var result = await controller.Delete(model);

            var jsonResult = result as JsonResult;

            var deleted = jsonResult?.Value as bool?;

            Assert.IsTrue(deleted);
        }
        public async Task TestDeleteServerExceptionShouldReturnErrorMessage()
        {
            var result = await controller.Delete(new NodeDeletePostModel { NodeId = 1 });

            var badRequestResult = result as BadRequestObjectResult;

            Assert.IsNotNull(badRequestResult);
            Assert.AreEqual(400, badRequestResult.StatusCode);
            Assert.AreEqual("Failed to delete settlement", badRequestResult.Value as string);
        }