public void UpdateVisibiltyByKeywordFilter_Hit_in_Description_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            root.SubGroups.UpdateVisibiltyByKeywordFilter(".net");
            var visibleGroups = root.SubGroups.Where(g => g.Visible).ToArray();

            visibleGroups.Select(g => g.Title)
            .Is("General", "Tutorials");

            var general = visibleGroups[0];

            general.Resources
            .Where(r => r.Visible)
            .Select(r => r.Title)
            .Is("ASP.NET Blog's archives", "eShopOnBlazor");

            var tutorials = visibleGroups[1];

            tutorials.Resources
            .Where(r => r.Visible)
            .Select(r => r.Title)
            .Is("Blazor workshop");
        }
        public void SelectionState_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            var parentGroup = root.SubGroups[4];
            var childGroup1 = parentGroup.SubGroups[0];
            var childGroup2 = parentGroup.SubGroups[1];

            childGroup1.SelectionState = SelectionState.Unselected;
            parentGroup.SelectionState.Is(SelectionState.SelectedAny);

            parentGroup.SelectionState = SelectionState.Selected;
            childGroup1.SelectionState.Is(SelectionState.Selected);
            childGroup2.SelectionState.Is(SelectionState.Selected);

            childGroup1.SelectionState = SelectionState.Unselected;
            childGroup2.SelectionState = SelectionState.Unselected;
            parentGroup.SelectionState.Is(SelectionState.Unselected);

            childGroup1.SelectionState = SelectionState.Selected;
            childGroup2.SelectionState = SelectionState.Selected;
            parentGroup.SelectionState.Is(SelectionState.Selected);

            parentGroup.SelectionState = SelectionState.Unselected;
            childGroup1.SelectionState.Is(SelectionState.Unselected);
            childGroup2.SelectionState.Is(SelectionState.Unselected);
        }
        public void UpdateVisibiltyByKeywordFilter_Hit_in_Level2_Title_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            root.SubGroups.UpdateVisibiltyByKeywordFilter("file2");
            var visibleGroups = root.SubGroups.Where(g => g.Visible).ToArray();

            visibleGroups
            .Select(g => g.Title)
            .Is("Sample Projects");

            var sampleProject = visibleGroups[0];

            sampleProject.SubGroups
            .Where(g => g.Visible)
            .Select(g => g.Title)
            .Is("Cloud");

            var cloud = sampleProject.SubGroups.First(g => g.Visible);

            cloud.Resources
            .Where(r => r.Visible)
            .Select(r => r.Title)
            .Is("BlazorFile2Azure");
        }
Ejemplo n.º 4
0
        protected override async Task OnInitializedAsync()
        {
            var url = "https://raw.githubusercontent.com/AdrienTorris/awesome-blazor/master/README.md";
            var awesomeBlazorContents = await this.HttpClient.GetStringAsync(url);

            this.RootGroup       = AwesomeBlazorParser.ParseMarkdown(awesomeBlazorContents);
            this.ParsingComplete = true;
        }
        public void UpdateVisibiltyByKeywordFilter_Hit_MultiKeywords_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            root.SubGroups.UpdateVisibiltyByKeywordFilter(".net shop microsoft");
            var visibleGroups = root.SubGroups.Where(g => g.Visible).ToArray();

            visibleGroups
            .Select(g => g.Title)
            .Is("General");

            var general = visibleGroups[0];

            general.Resources
            .Where(r => r.Visible)
            .Select(r => r.Title)
            .Is("eShopOnBlazor");
        }
Ejemplo n.º 6
0
        public void EnumGroupsDescendants_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            root.SubGroups.EnumGroupsDescendants()
            .Select(g => g.Title)
            .Is(
                "Awesome Blazor",
                "Special event: \"Virtual Meetup\". [TODAY!]",
                "Introduction",
                "What is Blazor",
                "Get started",
                "General",
                "Sample Projects",
                "Authentication",
                "Cloud",
                "Tutorials");
        }
Ejemplo n.º 7
0
        public void Parse_Test()
        {
            var contents = TestFixture.GetContentsForTest();
            var root     = AwesomeBlazorParser.ParseMarkdown(contents);

            root.Resources.Any().IsFalse();
            root.SubGroups.Select(g => g.Title)
            .Is("Awesome Blazor",
                "Special event: \"Virtual Meetup\". [TODAY!]",
                "Introduction", "General", "Sample Projects", "Tutorials");

            var topTitle = root.SubGroups[0];

            topTitle.SelectionState.Is(SelectionState.Selected);
            topTitle.Resources.Any().IsFalse();
            topTitle.SubGroups.Any().IsFalse();
            topTitle.ParagraphsHtml.IsNot("");

            var specialEvent = root.SubGroups[1];

            specialEvent.SelectionState.Is(SelectionState.Selected);
            specialEvent.Resources.Any().IsFalse();
            specialEvent.SubGroups.Any().IsFalse();
            specialEvent.ParagraphsHtml.IsNot("");

            var introduction = root.SubGroups[2];

            introduction.SelectionState.Is(SelectionState.Selected);
            introduction.ParagraphsHtml.Is("");
            introduction.Resources.Any().IsFalse();
            introduction.SubGroups.Select(g => g.Title)
            .Is("What is Blazor", "Get started");

            var whatsBlazor = introduction.SubGroups[0];

            whatsBlazor.SelectionState.Is(SelectionState.Selected);
            whatsBlazor.Resources.Any().IsFalse();
            whatsBlazor.SubGroups.Any().IsFalse();
            whatsBlazor.ParagraphsHtml.IsNot("");

            var getStarted = introduction.SubGroups[1];

            getStarted.SelectionState.Is(SelectionState.Selected);
            getStarted.Resources.Any().IsFalse();
            getStarted.SubGroups.Any().IsFalse();
            getStarted.ParagraphsHtml.IsNot("");

            var general = root.SubGroups[3];

            general.SelectionState.Is(SelectionState.Selected);
            general.SubGroups.Any().IsFalse();
            general.ParagraphsHtml.Is("");
            general.Resources.Select(r => $"{r.Title} | {r.ResourceUrl}")
            .Is("ASP.NET Blog's archives | https://devblogs.microsoft.com/aspnet/category/blazor/",
                "eShopOnBlazor | https://github.com/dotnet-architecture/eShopOnBlazor");

            var sampleProjects = root.SubGroups[4];

            sampleProjects.SelectionState.Is(SelectionState.Selected);
            sampleProjects.ParagraphsHtml.Is("");
            sampleProjects.Resources.Any().IsFalse();
            sampleProjects.SubGroups.Select(g => g.Title)
            .Is("Authentication", "Cloud");

            var authentication = sampleProjects.SubGroups[0];

            authentication.SelectionState.Is(SelectionState.Selected);
            authentication.SubGroups.Any().IsFalse();
            authentication.ParagraphsHtml.Is("");
            authentication.Resources.Select(r => $"{r.Title} | {r.ResourceUrl}")
            .Is("BlazorBoilerplate | https://github.com/enkodellc/blazorboilerplate");

            var cloud = sampleProjects.SubGroups[1];

            cloud.SelectionState.Is(SelectionState.Selected);
            cloud.SubGroups.Any().IsFalse();
            cloud.ParagraphsHtml.Is("");
            cloud.Resources.Select(r => $"{r.Title} | {r.ResourceUrl}")
            .Is("BlazorAzure.WebApp | https://github.com/gpeipman/BlazorDemo/tree/master/BlazorAzure.WebApp",
                "BlazorFile2Azure | https://github.com/daltskin/BlazorFile2Azure");

            var tutorials = root.SubGroups[5];

            tutorials.SelectionState.Is(SelectionState.Selected);
            tutorials.SubGroups.Any().IsFalse();
            tutorials.ParagraphsHtml.Is("");
            tutorials.Resources.Select(r => $"{r.Title} | {r.ResourceUrl}")
            .Is("Blazor workshop | https://github.com/dotnet-presentations/blazor-workshop/");
        }