public void AddLearningPath_WhenCalled_AddTheLearningPathToTheCourseLearningPathsList() { var learningPath = new LearningPathCourse("learningPathId", "courseId", 1); _sut.AddLearningPath(learningPath); Assert.That(_sut.CourseLearningPaths, Has.Member(learningPath)); }
public void RemoveEventualLearningPaths_newLearningPathsIdsListIsEmpty_RemoveAllExistingLearningPaths() { // Arrange var course = new Course("title", "creatorId", DateTime.Now); var existingLearningPath1 = new LearningPathCourse("learningPathId1", "courseId", 1); var existingLearningPath2 = new LearningPathCourse("learningPathId2", "courseId", 2); course.AddLearningPath(existingLearningPath1); course.AddLearningPath(existingLearningPath2); var newCourseLearningPathsIds = new List <string>(); // Act _sut.RemoveEventualLearningPaths(course, newCourseLearningPathsIds); // Assert Assert.That(course.CourseLearningPaths, Is.Empty); }
public void GivenADraftCourseThatHasANon_EmptyLearningPathsList(Table table) { var developer = new LearningPath("developer", _organizationId); _factory.AddLearningPath(developer); var businessAnalyst = new LearningPath("Business Analyst", _organizationId); _factory.AddLearningPath(businessAnalyst); var course = new Course("course", _instructorId, DateTime.Now); course.AddLearningPath(new LearningPathCourse(developer.Id, course.Id, 1)); course.AddLearningPath(new LearningPathCourse(businessAnalyst.Id, course.Id, 2)); _factory.CreateCourse(course); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id }; _learningPathsIds = new[] { developer.Id }; }
public async Task AddLearningPathToCourse(Course course, string newLearningPathId, CancellationToken token) { await CheckLearningPathExistence(newLearningPathId, token); var courseOrder = await _repo.GetLearningPathLastOrder(newLearningPathId, token); if (courseOrder != null) { var courseLearningPath = new LearningPathCourse(newLearningPathId, course.Id, courseOrder.Value + 1); course.AddLearningPath(courseLearningPath); } }
RemoveEventualLearningPaths_newLearningPathsIdsListDoesNotContainExistingLearningPaths_RemoveExistingLearningPaths() { // Arrange var course = new Course("title", "creatorId", DateTime.Now); var existingLearningPath = new LearningPathCourse("learningPathId1", "courseId", 1); course.AddLearningPath(existingLearningPath); var newCourseLearningPathsIds = new[] { "learningPathId2" }; // Act _sut.RemoveEventualLearningPaths(course, newCourseLearningPathsIds); // Assert Assert.That(course.CourseLearningPaths, Has.No.Member(existingLearningPath)); }
public void GetLearningPathsIdsToAdd_NoNewLearningPathId_ReturnEmptyList() { // Arrange var course = new Course("title", "creatorId", DateTime.Now); var existingLearningPath = new LearningPathCourse("learningPathId1", "courseId", 1); course.AddLearningPath(existingLearningPath); var newCourseLearningPathsIds = new[] { "learningPathId1" }; // Act var result = _sut.GetLearningPathsIdsToAdd(course, newCourseLearningPathsIds); // Assert Assert.That(result, Is.Empty); }