コード例 #1
0
        public void GetCategories()
        {
            //Arrange

            //Act
            var categories = _providerUnderTest.GetCategories().ToList();

            //Assert
            categories.Should().NotBeNullOrEmpty();
            var category = categories.Single();

            category.SubCategories.Count.Should().Be(4);                                                       //infer the two frameworks, one duplicate, one standard sector and one de duplicated combined framework and standard sector
            category.SubCategories.Count(sc => sc.CategoryType == CategoryType.Framework).Should().Be(1);      //one framework
            category.SubCategories.Count(sc => sc.CategoryType == CategoryType.StandardSector).Should().Be(1); //one sector
            category.SubCategories.Count(sc => sc.CategoryType == CategoryType.Combined).Should().Be(2);       //one de duplicated combined framework and one de duplicated combined framework and standard sector
            var standardSector = category.SubCategories.First(sc => sc.CategoryType == CategoryType.StandardSector);

            standardSector.SubCategories.Count.Should().Be(2); //2 standards under the one sector
            var combinedFrameworkAndStandardSector = category.SubCategories.First(sc => sc.CodeName.Contains("STDSEC."));

            combinedFrameworkAndStandardSector.FullName.Should().Be("Duplicate Name");
            combinedFrameworkAndStandardSector.ParentCategoryCodeName.Should().Be("SSAT1.MFP");
            combinedFrameworkAndStandardSector.SubCategories.Count.Should().Be(1); //1 standards under the combined
            combinedFrameworkAndStandardSector.SubCategories[0].ParentCategoryCodeName.Should().Be("STDSEC.11|FW.14");
            var combinedFramework = category.SubCategories.First(sc => !sc.CodeName.Contains("STDSEC."));

            combinedFramework.FullName.Should().Be("Duplicate Framework Name");
            combinedFramework.SubCategories.Count.Should().Be(0);
        }