Ejemplo n.º 1
0
        public void DeleteStatus_StatusDeleted_ReturnsSuccessfull()
        {
            var issueType = CreateSampleIssueType();

            mockIssueTypeEngine.Setup(x => x.RemoveIssueType(issueType))
            .Returns(true);

            mockIssueTypeEngine.Setup(x => x.GetIssueType(1))
            .Returns(issueType);

            IssueTypeLogic issueTypeLogic = new IssueTypeLogic(mockIssueTypeEngine.Object);

            bool expected = true;
            bool actual   = issueTypeLogic.RemoveIssueType(1);

            Assert.Equal(expected, actual);
            mockIssueTypeEngine.Verify(x => x.RemoveIssueType(issueType), Times.Once);
        }
Ejemplo n.º 2
0
        public void DeleteStatus_StatusDoesNotExists_ThrowsException()
        {
            var issueType = CreateSampleIssueType();

            mockIssueTypeEngine.Setup(x => x.RemoveIssueType(issueType))
            .Returns(true);

            mockIssueTypeEngine.Setup(x => x.GetIssueType(issueType.IssueTypeId))
            .Returns((IssueType)null);

            IssueTypeLogic issueTypeLogic = new IssueTypeLogic(mockIssueTypeEngine.Object);


            Action act = () => { issueTypeLogic.RemoveIssueType(1); };

            act.Should().Throw <Exception>()
            .And.Message
            .Should().Be("IssueType Does not exists");

            mockIssueTypeEngine.Verify(x => x.RemoveIssueType(issueType), Times.Never);
        }