public void DeleteStatus_StatusDeleted_ReturnsSuccessfull() { var status = CreateSampleStatus(); mockStatusEngine.Setup(x => x.RemoveStatus(status)) .Returns(true); mockStatusEngine.Setup(x => x.GetStatus(status.IssueStatusId)) .Returns(status); IssueStatusLogic statusLogic = new IssueStatusLogic(mockStatusEngine.Object); bool expected = true; bool actual = statusLogic.RemoveStatus(status.IssueStatusId); Assert.Equal(expected, actual); mockStatusEngine.Verify(x => x.RemoveStatus(status), Times.Once); }
public void DeleteStatus_StatusDoesNotExists_ThrowsException() { var status = CreateSampleStatus(); mockStatusEngine.Setup(x => x.RemoveStatus(status)) .Returns(true); mockStatusEngine.Setup(x => x.GetStatus(1)) .Returns((IssueStatus)null); IssueStatusLogic statusLogic = new IssueStatusLogic(mockStatusEngine.Object); Action act = () => { statusLogic.RemoveStatus(status.IssueStatusId); }; act.Should().Throw <Exception>() .And.Message .Should().Be("Status doesnot exists"); mockStatusEngine.Verify(x => x.RemoveStatus(status), Times.Never); }