Exemplo n.º 1
0
        public void TestPut_ReturnsBadRequestResultWhenEntityValidationException()
        {
            var toggle = new Toggle();
            var mockOfIUpdateToggleCommand = new MockOfIUpdateToggleCommand();

            mockOfIUpdateToggleCommand.SetupToThrowException(
                new EntityValidationException(""));
            var togglesController = new TogglesController(null, null, null, mockOfIUpdateToggleCommand.Object, null);

            IActionResult result = togglesController.Put(toggle.Id, toggle);

            Assert.IsInstanceOf <BadRequestObjectResult>(result);
        }
Exemplo n.º 2
0
        public void TestPut_ReturnsNotFoundResultWhenEntityNotFoundException()
        {
            var toggle = new Toggle();
            var mockOfIUpdateToggleCommand = new MockOfIUpdateToggleCommand();

            mockOfIUpdateToggleCommand.SetupToThrowException(
                new EntityNotFoundException(typeof(Toggle), toggle.Id.ToString()));
            var togglesController = new TogglesController(null, null, null, mockOfIUpdateToggleCommand.Object, null);

            IActionResult result = togglesController.Put(toggle.Id, toggle);

            Assert.IsInstanceOf <NotFoundObjectResult>(result);
        }