Exemple #1
0
        public void CheckingAccounts_Controller_Delete_ShouldHandleValidationFailure()
        {
            // Arrange
            _checkingAccountRemove.Setup(c => c.Validate().IsValid).Returns(false);

            // Action
            IHttpActionResult callback = _checkingAccountsController.Delete(_checkingAccountRemove.Object);

            // Assert
            var httpResponse = callback.Should().BeOfType <NegotiatedContentResult <IList <ValidationFailure> > >().Subject;
        }
Exemple #2
0
        public void CheckingAccounts_Controller_Delete_ShouldBeOk()
        {
            // Arrange
            var isUpdated = true;

            _checkingAccountServiceMock.Setup(c => c.Remove(_checkingAccount.Object)).Returns(isUpdated);

            // Action
            IHttpActionResult callback = _checkingAccountsController.Delete(_checkingAccount.Object);

            // Assert
            var httpResponse = callback.Should().BeOfType <OkNegotiatedContentResult <bool> >().Subject;

            _checkingAccountServiceMock.Verify(s => s.Remove(_checkingAccount.Object), Times.Once);
            httpResponse.Content.Should().BeTrue();
        }