public void EditIssueType_EditedSuccessfull_ValidCall() { var issueType = CreateSampleIssueType(); mockIssueTypeEngine.Setup(x => x.EditIssueType(issueType)) .Returns(true); mockIssueTypeEngine.Setup(x => x.IssueTypeExists(issueType.IssueTypeId)) .Returns(true); IssueTypeLogic issueTypeLogic = new IssueTypeLogic(mockIssueTypeEngine.Object); bool expected = true; bool actual = issueTypeLogic.EditIssueType(issueType); Assert.Equal(expected, actual); mockIssueTypeEngine.Verify(x => x.EditIssueType(issueType), Times.Once); }
public void EditIssueType_IssueTypeDoesNotExists_throwsException() { var issueType = CreateSampleIssueType(); mockIssueTypeEngine.Setup(x => x.EditIssueType(issueType)) .Returns(true); mockIssueTypeEngine.Setup(x => x.IssueTypeExists(issueType.IssueTypeId)) .Returns(false); IssueTypeLogic issueTypeLogic = new IssueTypeLogic(mockIssueTypeEngine.Object); Action act = () => { issueTypeLogic.EditIssueType(issueType); }; act.Should().Throw <Exception>() .And.Message .Should().Be("IssueType Does not exists"); mockIssueTypeEngine.Verify(x => x.EditIssueType(issueType), Times.Never); }