public void DeleteSprint_SprintDeleted_ReturnsSuccessfull() { var sprint = CreateSampleSprint(); mockSprintEngine.Setup(x => x.RemoveSprint(sprint)) .Returns(true); mockSprintEngine.Setup(x => x.GetSprint(sprint.SprintId)) .Returns(sprint); SprintLogic SprintLogic = new SprintLogic(mockSprintEngine.Object); bool expected = true; bool actual = SprintLogic.RemoveSprint(sprint.SprintId); Assert.Equal(expected, actual); mockSprintEngine.Verify(x => x.RemoveSprint(sprint), Times.Once); }
public void DeleteSprint_SprintDoesNotExists_ThrowsException() { var sprint = CreateSampleSprint(); mockSprintEngine.Setup(x => x.RemoveSprint(sprint)) .Returns(true); mockSprintEngine.Setup(x => x.GetSprint(1)) .Returns((Sprint)null); SprintLogic SprintLogic = new SprintLogic(mockSprintEngine.Object); Action act = () => { SprintLogic.RemoveSprint(sprint.SprintId); }; act.Should().Throw <Exception>() .And.Message .Should().Be("Sprint does not exists"); mockSprintEngine.Verify(x => x.RemoveSprint(sprint), Times.Never); }