Exemple #1
0
        public void GetSectionAndTutorialsBySectionIdForCustomisation_returns_fully_populated_Section()
        {
            // Given
            var tutorialOne = new Tutorial(1, "Test", true, true);
            var tutorialTwo = new Tutorial(2, "Case", false, false);
            var tutorials   = new List <Tutorial> {
                tutorialOne, tutorialTwo
            };
            var section = new Section(1, "Section");

            A.CallTo(() => sectionContentDataService.GetSectionById(1))
            .Returns(section);
            A.CallTo(() => tutorialContentDataService.GetTutorialsBySectionId(A <int> ._, 1))
            .Returns(tutorials);

            // When
            var result = sectionService.GetSectionAndTutorialsBySectionIdForCustomisation(1, 1);

            // Then
            using (new AssertionScope())
            {
                A.CallTo(() => tutorialContentDataService.GetTutorialsBySectionId(A <int> ._, 1))
                .MustHaveHappenedOnceExactly();
                result?.SectionId.Should().Be(1);
                result?.SectionName.Should().Be("Section");
                result?.Tutorials.Should().BeEquivalentTo(tutorials);
            }
        }
Exemple #2
0
        public Section?GetSectionAndTutorialsBySectionIdForCustomisation(int customisationId, int sectionId)
        {
            var section = sectionContentDataService.GetSectionById(sectionId);

            if (section == null)
            {
                return(null);
            }

            section.Tutorials = tutorialContentDataService.GetTutorialsBySectionId(sectionId, customisationId);
            return(section);
        }