public void EditSprint_EditedSuccessfull_returnsSprint() { var sprint = CreateSampleSprint(); mockSprintEngine.Setup(x => x.EditSprint(sprint)) .Returns(true); mockSprintEngine.Setup(x => x.SprintExists(sprint.SprintId)) .Returns(true); SprintLogic sprintLogic = new SprintLogic(mockSprintEngine.Object); bool expected = true; bool actual = sprintLogic.EditSprint(sprint); Assert.Equal(expected, actual); mockSprintEngine.Verify(x => x.EditSprint(sprint), Times.Once); }
public void EditSprint_SprintDoesNotExists_ThrowsException() { var sprint = CreateSampleSprint(); mockSprintEngine.Setup(x => x.EditSprint(sprint)) .Returns(true); mockSprintEngine.Setup(x => x.SprintExists(sprint.SprintId)) .Returns(false); SprintLogic sprintLogic = new SprintLogic(mockSprintEngine.Object); Action act = () => { sprintLogic.EditSprint(sprint); }; act.Should().Throw <Exception>() .And.Message .Should().Be("Sprint does not exists"); mockSprintEngine.Verify(x => x.EditSprint(sprint), Times.Never); }