public async System.Threading.Tasks.Task AddTaskAsync_ManageSpiritsServiceNameCheckReturns_true() { //Arrange var task1 = new Task { Id = 1, TeamId = 1, Name = "Task", MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; var task2 = new Task { Id = 1, TeamId = 1, Name = "Task 1", MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; var task3 = new Task { Id = 1, TeamId = 1, Name = "Task_1", MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; var task4 = new Task { Id = 1, TeamId = 1, Name = "Task-1.", MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; _tasksRepository.Setup(x => x.InsertAsync(It.IsAny <Task>())).ReturnsAsync(true); //Act var result1 = await _manageTasksService.AddTaskAsync(task1); var result2 = await _manageTasksService.AddTaskAsync(task2); var result3 = await _manageTasksService.AddTaskAsync(task3); var result4 = await _manageTasksService.AddTaskAsync(task4); //Assert Assert.IsTrue(result1); Assert.IsTrue(result2); Assert.IsTrue(result3); Assert.IsTrue(result4); }
public async System.Threading.Tasks.Task AddTasksAsync_ManageTasksServiceReturns_False() { //Arrange var task1 = new Task { Id = 1, TeamId = 1, Name = "Task 1@@ ", Link = "https://github.com/", StoryPoints = 1 }; var task2 = new Task { Id = 2, TeamId = 2, Name = "Task2", Link = "https://github.com/", StoryPoints = -5 }; var task3 = new Task { Id = 3, TeamId = 3, Name = "Task3", Link = "https:/ qq/github.com/", StoryPoints = 3 }; _tasksRepository.Setup(x => x.InsertAsync(It.IsAny <Task>())).ReturnsAsync(true); //Act var result1 = await _manageTasksService.AddTaskAsync(task1); //Incorrect name var result2 = await _manageTasksService.AddTaskAsync(task2); //Incorrect SP count var result3 = await _manageTasksService.AddTaskAsync(task3); //Incorrect link //Assert Assert.IsFalse(result1); Assert.IsFalse(result2); Assert.IsFalse(result3); }
public async System.Threading.Tasks.Task EditTaskAsync_ManageSpiritsServiceReturns_False() { //Arrange var task1 = new Task { Id = 1, TeamId = 1, Name = "Ta sk", MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; var task2 = new Task { Id = 1, TeamId = 1, Name = "Task", MemberId = 1, Link = "vkcom", StoryPoints = 3, SprintId = 3 }; var task3 = new Task { Id = 1, TeamId = 1, Name = "Task", MemberId = 1, Link = "vk.com", StoryPoints = -3, SprintId = 3 }; _tasksRepository.Setup(x => x.UpdateAsync(It.IsAny <Task>())).ReturnsAsync(true); _tasksRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(task2); //Act var result1 = await _manageTasksService.EditTaskAsync(task1); //Incorrect name var result2 = await _manageTasksService.EditTaskAsync(task2); //Incorrect link count var result3 = await _manageTasksService.EditTaskAsync(task3); //Incorrect SP count //Assert Assert.IsFalse(result1); Assert.IsFalse(result2); Assert.IsFalse(result3); }
public async System.Threading.Tasks.Task AddTaskAsync_ManageTaskServiceReturns_True() { //Arrange var task = new Task { Id = 1, TeamId = 1, Name = "Task1", Link = "https://github.com/", StoryPoints = 1 }; _tasksRepository.Setup(x => x.InsertAsync(It.IsAny <Task>())).ReturnsAsync(true); //Act var result = await _manageTasksService.AddTaskAsync(task); //Assert Assert.IsTrue(result); }
public async System.Threading.Tasks.Task EditTaskAsync_ManageSpiritsServiceNameCheckReturns_false(string TaskName) { //Arrange var task = new Task { Id = 1, TeamId = 1, Name = TaskName, MemberId = 1, Link = "vk.com", StoryPoints = 3, SprintId = 3 }; _tasksRepository.Setup(x => x.UpdateAsync(It.IsAny <Task>())).ReturnsAsync(true); _tasksRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(task); //Act var result = await _manageTasksService.EditTaskAsync(task); //Assert Assert.IsFalse(result); }