Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }