public void GetCourseValidationDetails_returns_expected_course_validation_details_for_all_centres_course() { // Given var expectedValidationDetails = new CourseValidationDetails { CentreId = 549, CourseCategoryId = 2, AllCentres = true, CentreHasApplication = true, }; // When var validationDetails = courseDataService.GetCourseValidationDetails(14038, 549); // Then validationDetails.Should().BeEquivalentTo(expectedValidationDetails); }
public void GetCourseValidationDetails_returns_expected_course_validation_details() { // Given var expectedValidationDetails = new CourseValidationDetails { CentreId = 101, CourseCategoryId = 2, AllCentres = false, CentreHasApplication = true, }; // When var validationDetails = courseDataService.GetCourseValidationDetails(100, 101); // Then validationDetails.Should().BeEquivalentTo(expectedValidationDetails); }
VerifyAdminUserCanViewCourse_should_return_false_when_course_is_all_centres_but_centre_doesnt_have_access() { // Given var validationDetails = new CourseValidationDetails { CentreId = 1, CourseCategoryId = 1, AllCentres = true, CentreHasApplication = false, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanViewCourse(1, 2, null); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 2)) .MustHaveHappenedOnceExactly(); result.Should().BeFalse(); }
VerifyAdminUserCanViewCourse_should_return_true_when_centreId_matches_and_admin_category_id_is_null() { // Given var validationDetails = new CourseValidationDetails { CentreId = 1, CourseCategoryId = 1, AllCentres = false, CentreHasApplication = false, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanViewCourse(1, 1, null); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 1)) .MustHaveHappenedOnceExactly(); result.Should().BeTrue(); }
public void VerifyAdminUserCanViewCourse_should_return_false_with_incorrect_categoryID() { // Given var validationDetails = new CourseValidationDetails { CentreId = 1, CourseCategoryId = 1, AllCentres = false, CentreHasApplication = false, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanViewCourse(1, 1, 2); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 1)) .MustHaveHappenedOnceExactly(); result.Should().BeFalse(); }
public void VerifyAdminUserCanViewCourse_should_return_true_when_course_is_not_at_centre_but_is_all_centres() { // Given var validationDetails = new CourseValidationDetails { CentreId = 2, CourseCategoryId = 2, AllCentres = true, CentreHasApplication = true, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanViewCourse(1, 1, 2); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 1)) .MustHaveHappenedOnceExactly(); result.Should().BeTrue(); }
public void VerifyAdminUserCanManageCourse_should_return_false_with_all_centres_course_on_different_centre() { // Given var validationDetails = new CourseValidationDetails { CentreId = 2, CourseCategoryId = 2, AllCentres = true, CentreHasApplication = true, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanManageCourse(1, 1, 2); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 1)) .MustHaveHappenedTwiceExactly(); result.Should().BeFalse(); }
public void VerifyAdminUserCanManageCourse_should_return_true_when_centreId_and_categoryId_match() { // Given var validationDetails = new CourseValidationDetails { CentreId = 2, CourseCategoryId = 2, AllCentres = false, CentreHasApplication = false, }; A.CallTo(() => courseDataService.GetCourseValidationDetails(A <int> ._, A <int> ._)) .Returns(validationDetails); // When var result = courseService.VerifyAdminUserCanManageCourse(1, 2, 2); // Then A.CallTo(() => courseDataService.GetCourseValidationDetails(1, 2)) .MustHaveHappenedTwiceExactly(); result.Should().BeTrue(); }