public void EditStatus_EditedSuccessfull_ValidCall() { var status = CreateSampleStatus(); mockStatusEngine.Setup(x => x.EditStatus(status)) .Returns(true); mockStatusEngine.Setup(x => x.StatusExists(status.IssueStatusId)) .Returns(true); IssueStatusLogic statusLogic = new IssueStatusLogic(mockStatusEngine.Object); bool expected = true; bool actual = statusLogic.EditStatus(status); Assert.Equal(expected, actual); mockStatusEngine.Verify(x => x.EditStatus(status), Times.Once); }
public void EditStatus_StatusDoesNotExists_throwsException() { var status = CreateSampleStatus(); mockStatusEngine.Setup(x => x.EditStatus(status)) .Returns(true); mockStatusEngine.Setup(x => x.StatusExists(status.IssueStatusId)) .Returns(false); IssueStatusLogic statusLogic = new IssueStatusLogic(mockStatusEngine.Object); Action act = () => { statusLogic.EditStatus(status); }; act.Should().Throw <Exception>() .And.Message .Should().Be("Status Doesnot exists "); mockStatusEngine.Verify(x => x.EditStatus(status), Times.Never); }