public void Initial_menu_should_have_list_of_section_card_view_model() { // Given const string sectionName = "TestSectionName"; const bool hasLearning = true; const double percentComplete = 12.00; const int customisationId = 1; const bool showPercentage = true; const string courseSettings = "{\"lm.sp\":true}"; // ShowPercentage = true var courseContent = CourseContentHelper.CreateDefaultCourseContent( customisationId: customisationId, courseSettings: courseSettings ); var section = CourseSectionHelper.CreateDefaultCourseSection( sectionName: sectionName, hasLearning: hasLearning, percentComplete: percentComplete ); courseContent.Sections.Add(section); var expectedSection = new SectionCardViewModel(section, customisationId, showPercentage); var expectedSectionList = new List <SectionCardViewModel> { expectedSection }; // When var initialMenuViewModel = new InitialMenuViewModel(courseContent); // Then initialMenuViewModel.Sections.Should().BeEquivalentTo(expectedSectionList); }
public void Section_should_return_customisation_id() { // Given const int customisationId = 10; const bool showPercentageCourseSetting = true; var section = CourseSectionHelper.CreateDefaultCourseSection(); // When var sectionCardViewModel = new SectionCardViewModel(section, customisationId, showPercentageCourseSetting); // Then sectionCardViewModel.CustomisationId.Should().Be(customisationId); }
public void Section_should_return_empty_string_if_has_learning_is_false() { // Given const bool hasLearning = false; const bool showPercentageCourseSetting = true; var section = CourseSectionHelper.CreateDefaultCourseSection(hasLearning: hasLearning); // When var sectionCardViewModel = new SectionCardViewModel(section, CustomisationId, showPercentageCourseSetting); // Then sectionCardViewModel.PercentComplete.Should().Be(""); }
public void Section_should_floor_percent_complete() { // Given const bool hasLearning = true; const double percentComplete = 16.6666666667; const double percentCompleteRounded = 16; const bool showPercentageCourseSetting = true; var section = CourseSectionHelper.CreateDefaultCourseSection( hasLearning: hasLearning, percentComplete: percentComplete ); // When var sectionCardViewModel = new SectionCardViewModel(section, CustomisationId, showPercentageCourseSetting); // Then sectionCardViewModel.PercentComplete.Should().Be($"{percentCompleteRounded}% learning complete"); }
public void Section_should_return_correct_string_if_has_learning_is_true() { // Given const bool hasLearning = true; const double percentComplete = 12.00; const bool showPercentageCourseSetting = true; var section = CourseSectionHelper.CreateDefaultCourseSection( hasLearning: hasLearning, percentComplete: percentComplete ); // When var sectionCardViewModel = new SectionCardViewModel(section, CustomisationId, showPercentageCourseSetting); // Then sectionCardViewModel.PercentComplete.Should().Be($"{percentComplete}% learning complete"); }