public async System.Threading.Tasks.Task RemoveAsync_ManageSprintsServiceReturnsTrue_ReturnsTrue()
        {
            // Arrange
            const string teamOwner = "1234";
            const int    sprintId  = 1;
            Team         team      = Team.Create(1, "1234", "1234", new List <TeamMember>());
            var          sprints   = new List <Sprint>
            {
                Sprint.Create(1, 1, team, "Sprint1", 14, 4, PossibleStatuses.CompletedStatus),
                Sprint.Create(2, 1, team, "Sprint2", 16, 4, PossibleStatuses.CompletedStatus),
                Sprint.Create(3, 1, team, "Sprint3", 21, 2, PossibleStatuses.CompletedStatus),
                Sprint.Create(4, 1, team, "Sprint4", 10, 3, PossibleStatuses.CompletedStatus),
                Sprint.Create(5, 1, team, "Sprint5", 27, 5, PossibleStatuses.CompletedStatus),
            };
            var user = new Mock <UserDetails>(null);

            user.Setup(x => x.Id()).Returns(teamOwner);
            _currentUser.SetupGet(x => x.Current).Returns(user.Object);
            var mock = sprints.AsQueryable().BuildMock();

            _sprintRepository.Setup(x => x.GetAllAsync())
            .Returns(System.Threading.Tasks.Task.FromResult(sprints.AsEnumerable()));
            _sprintRepository.Setup(x => x.DeleteAsync(It.IsAny <int>()))
            .ReturnsAsync(true);

            //Act
            var result = await _manageSprintsService.RemoveAsync(sprintId);

            //Assert
            Assert.IsTrue(result);
        }
Exemple #2
0
        public async Task RemoveAsync_ManageSprintsServiceReturnsTrue_ReturnsTrue()
        {
            // Arrange
            const string teamOwner = "1234";
            const int    sprintId  = 1;
            var          sprints   = new List <Sprint>
            {
                new Sprint {
                    Id = 1, TeamId = 1, Name = "Sprint1", DaysInSprint = 14, StoryPointInHours = 4, Status = PossibleStatuses.ActiveStatus, Team = new Team {
                        TeamOwner = teamOwner
                    }
                },
                new Sprint {
                    Id = 2, TeamId = 1, Name = "Sprint2", DaysInSprint = 16, StoryPointInHours = 4, Status = PossibleStatuses.CompletedStatus, Team = new Team {
                        TeamOwner = teamOwner
                    }
                },
                new Sprint {
                    Id = 3, TeamId = 1, Name = "Sprint3", DaysInSprint = 21, StoryPointInHours = 2, Status = PossibleStatuses.CompletedStatus, Team = new Team {
                        TeamOwner = teamOwner
                    }
                },
                new Sprint {
                    Id = 4, TeamId = 1, Name = "Sprint4", DaysInSprint = 10, StoryPointInHours = 3, Status = PossibleStatuses.CompletedStatus, Team = new Team {
                        TeamOwner = teamOwner
                    }
                },
                new Sprint {
                    Id = 5, TeamId = 1, Name = "Sprint5", DaysInSprint = 27, StoryPointInHours = 5, Status = PossibleStatuses.CompletedStatus, Team = new Team {
                        TeamOwner = teamOwner
                    }
                }
            };
            var user = new Mock <UserDetails>(null);

            user.Setup(x => x.Id()).Returns(teamOwner);
            _currentUser.SetupGet(x => x.Current).Returns(user.Object);
            var mock = sprints.AsQueryable().BuildMock();

            _sprintRepository.Setup(x => x.GetAll()).Returns(mock.Object);
            _sprintRepository.Setup(x => x.DeleteAsync(It.IsAny <Sprint>()))
            .ReturnsAsync(true);

            //Act
            var result = await _manageSprintsService.RemoveAsync(sprintId);

            //Assert
            Assert.IsTrue(result);
        }