コード例 #1
0
        public async Task GetGeneratedOutputAsync_Component()
        {
            // Act
            await ComponentDocument.GetGeneratedOutputAsync();

            // Assert
            Assert.NotNull(ComponentHostDocument.GeneratedCodeContainer.Output);
            Assert.Contains("ComponentBase", ComponentHostDocument.GeneratedCodeContainer.Output.GeneratedCode);
        }
コード例 #2
0
        public async Task GetGeneratedOutputAsync_Component()
        {
            // Act
            await ComponentDocument.GetGeneratedOutputAsync();

            // Assert
            Assert.NotNull(ComponentHostDocument.GeneratedDocumentContainer.OutputCSharp);
            Assert.Contains("ComponentBase", ComponentHostDocument.GeneratedDocumentContainer.OutputCSharp.GeneratedCode, StringComparison.Ordinal);
        }
コード例 #3
0
        public async Task<ComponentDocument> GetComponentDocumentation(string componentName)
        {
            var documentation = await Client.GetStringAsync($"_content/Append.AntDesign.Documentation/examples/{componentName}/Index.md");
            var indexOfAPI = documentation.IndexOf("# API");
            var beforeAPI = documentation.Substring(0, indexOfAPI);
            var afterApi = documentation.Substring(indexOfAPI);

            var examples = GetAllExamplesForComponent(componentName);

            ComponentDocument doc = new ComponentDocument(beforeAPI,afterApi, examples);
            return doc;
        }
コード例 #4
0
        protected override async Task OnParametersSetAsync()
        {
            await base.OnParametersSetAsync();

            examples.Clear();
            StateHasChanged();

            document = await DocumentationService.GetComponentDocumentation(ComponentName);

            await foreach (var example in document.Examples)
            {
                examples.Add(example);
                StateHasChanged();
            }
        }