Beispiel #1
0
        public async System.Threading.Tasks.Task GetTaskByIdAsync_ManageTasksServiceReturnsTaskWithId1_ReturnTaskWithId1()
        {
            // Arrange
            const int taskId = 1;

            var task = new List <Data.Models.Task>()
            {
                new Data.Models.Task
                {
                    Id          = 1,
                    Link        = "google.com",
                    MemberId    = 1,
                    Name        = "Implement 4.5 issue",
                    StoryPoints = 3,
                    TeamMember  = null,
                    Sprint      = null,
                    SprintId    = 9,
                    Team        = null,
                    TeamId      = 9
                }
            };

            var mock = task.AsQueryable().BuildMock();

            _tasksRepository.Setup(x => x.GetAll()).Returns(mock.Object);

            // Act
            var result = await _manageTasksService.GetTaskByIdAsync(taskId);

            // Assert
            Assert.AreEqual(1, result.Id);
        }
Beispiel #2
0
        public async System.Threading.Tasks.Task GetTaskByIdAsync_ManageTasksServiceReturnsTaskWithId1_ReturnTaskWithId1()
        {
            // Arrange
            const int taskId = 1;

            Team team = Team.Create(9, "2", "1234", new List <TeamMember>());
            var  task = new List <Task>()
            {
                Task.Create(1, 9, team, "Implement 4.5 issue", 3, "google.com", 9, null),
            };

            var mock = task.AsQueryable().BuildMock();

            _tasksRepository.Setup(x => x.GetAllAsync()).Returns(System.Threading.Tasks.Task.FromResult(getFakeDbTasks()));

            // Act
            var result = await _manageTasksService.GetTaskByIdAsync(taskId);

            // Assert
            Assert.AreEqual(1, result.Id);
        }