From 0d638b53e6fcb134f5dd371696f7b732fcc96e76 Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Fri, 1 Mar 2024 10:27:57 +0800 Subject: [PATCH] feat: percy snapshot (#9747) --- .github/workflows/ci.yml | 8 + Directory.Packages.props | 1 - test/docfx.Snapshot.Tests/PercyTest.cs | 138 ++ ...-BuildFromProject.Class1.html.verified.png | 3 - ...i-CatLibrary.Cat-2.html-q-cat.verified.png | 3 - .../api-CatLibrary.html-term-cat.verified.png | 3 - .../1152x648/api-CatLibrary.html.verified.png | 3 - ...-csharp_coding_standards.html.verified.png | 3 - ...ypescript-markdown-extensions.verified.png | 3 - .../1152x648/index.html.verified.png | 3 - .../restapi-petstore.html.verified.png | 3 - ...-BuildFromProject.Class1.html.verified.png | 3 - ...i-CatLibrary.Cat-2.html-q-cat.verified.png | 3 - .../api-CatLibrary.html-term-cat.verified.png | 3 - .../api-CatLibrary.html.verified.png | 3 - ...-csharp_coding_standards.html.verified.png | 3 - ...ypescript-markdown-extensions.verified.png | 3 - .../1920x1080/index.html.verified.png | 3 - .../restapi-petstore.html.verified.png | 3 - ...-BuildFromProject.Class1.html.verified.png | 3 - ...i-CatLibrary.Cat-2.html-q-cat.verified.png | 3 - .../api-CatLibrary.html-term-cat.verified.png | 3 - .../375x812/api-CatLibrary.html.verified.png | 3 - ...-csharp_coding_standards.html.verified.png | 3 - ...ypescript-markdown-extensions.verified.png | 3 - .../375x812/index.html.verified.png | 3 - .../restapi-petstore.html.verified.png | 3 - ...-BuildFromProject.Class1.html.verified.png | 3 - ...i-CatLibrary.Cat-2.html-q-cat.verified.png | 3 - .../api-CatLibrary.html-term-cat.verified.png | 3 - .../768x600/api-CatLibrary.html.verified.png | 3 - ...-csharp_coding_standards.html.verified.png | 3 - ...ypescript-markdown-extensions.verified.png | 3 - .../768x600/index.html.verified.png | 3 - .../restapi-petstore.html.verified.png | 3 - ...BuildFromProject.Class1.html.verified.html | 1039 --------- ...-CatLibrary.Cat-2.html-q-cat.verified.html | 1114 --------- ...api-CatLibrary.html-term-cat.verified.html | 536 ----- .../html/api-CatLibrary.html.verified.html | 488 ---- ...csharp_coding_standards.html.verified.html | 366 --- ...pescript-markdown-extensions.verified.html | 560 ----- .../html/index.html.verified.html | 218 -- .../html/restapi-petstore.html.verified.html | 2056 ----------------- test/docfx.Snapshot.Tests/SamplesTest.cs | 142 -- .../docfx.Snapshot.Tests.csproj | 1 - 45 files changed, 146 insertions(+), 6617 deletions(-) create mode 100644 test/docfx.Snapshot.Tests/PercyTest.cs delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-BuildFromProject.Class1.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.Cat-2.html-q-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html-term-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-csharp_coding_standards.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/index.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/restapi-petstore.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-BuildFromProject.Class1.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.Cat-2.html-q-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html-term-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-csharp_coding_standards.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/index.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/restapi-petstore.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-BuildFromProject.Class1.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.Cat-2.html-q-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html-term-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-csharp_coding_standards.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/index.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/restapi-petstore.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-BuildFromProject.Class1.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.Cat-2.html-q-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html-term-cat.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-csharp_coding_standards.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/index.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/restapi-petstore.html.verified.png delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.Cat-2.html-q-cat.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html-term-cat.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-csharp_coding_standards.html.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/index.html.verified.html delete mode 100644 test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/restapi-petstore.html.verified.html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 811bec07918..6adc731c861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,14 @@ jobs: - run: dotnet test -c Release -f net6.0 --no-build --collect:"XPlat Code Coverage" if: matrix.os == 'ubuntu-latest' + - run: npm i -g @percy/cli + if: matrix.os == 'ubuntu-latest' + + - run: percy exec -- dotnet test -c Release -f net8.0 --filter Stage=Percy --no-build --collect:"XPlat Code Coverage" + if: matrix.os == 'ubuntu-latest' + env: + PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} + - uses: codecov/codecov-action@v4 if: matrix.os == 'ubuntu-latest' diff --git a/Directory.Packages.props b/Directory.Packages.props index 7652a21a304..bb19805025c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -39,7 +39,6 @@ - diff --git a/test/docfx.Snapshot.Tests/PercyTest.cs b/test/docfx.Snapshot.Tests/PercyTest.cs new file mode 100644 index 00000000000..0a3c3c47ac1 --- /dev/null +++ b/test/docfx.Snapshot.Tests/PercyTest.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Net.Http.Json; +using System.Net.NetworkInformation; +using System.Text.RegularExpressions; +using Docfx.Common; +using Microsoft.Playwright; + +namespace Docfx.Tests; + +[Trait("Stage", "Percy")] +public class PercyTest +{ + private class PercyFactAttribute : FactAttribute + { + public PercyFactAttribute() + { + Skip = IsActiveLocalTcpPort(5338) ? null : "Run percy tests with `percy exec`"; + } + } + + private static readonly string s_samplesDir = Path.GetFullPath("../../../../../samples"); + + private static readonly string[] s_screenshotUrls = + [ + "index.html", + "articles/markdown.html?tabs=windows%2Ctypescript#markdown-extensions", + "articles/markdown.html?dark", + "articles/csharp_coding_standards.html", + "api/BuildFromProject.Class1.html", + "api/CatLibrary.html?dark", + "api/CatLibrary.html?term=cat", + "api/CatLibrary.Cat-2.html?q=cat", + "restapi/petstore.html", + ]; + + static PercyTest() + { + Microsoft.Playwright.Program.Main(["install", "chromium"]); + } + + [PercyFact] + public async Task SeedHtml() + { + var samplePath = $"{s_samplesDir}/seed"; + Clean(samplePath); + + var docfxPath = Path.GetFullPath(OperatingSystem.IsWindows() ? "docfx.exe" : "docfx"); + Assert.Equal(0, Exec(docfxPath, $"metadata {samplePath}/docfx.json")); + Assert.Equal(0, Exec(docfxPath, $"build {samplePath}/docfx.json")); + + const int port = 8089; + var _ = Task.Run(() => Program.Main(["serve", "--port", $"{port}", $"{samplePath}/_site"])) + .ContinueWith(x => + { + Logger.LogError("Failed to run `dotnet serve` command. " + x.Exception.ToString()); + }, TaskContinuationOptions.OnlyOnFaulted); + + // Wait until web server started. + bool isStarted = SpinWait.SpinUntil(() => { Thread.Sleep(100); return IsActiveLocalTcpPort(port); }, TimeSpan.FromSeconds(10)); + + using var playwright = await Playwright.CreateAsync(); + var browser = await playwright.Chromium.LaunchAsync(); + var page = await browser.NewPageAsync(new()); + + foreach (var url in s_screenshotUrls) + { + await page.GotoAsync($"http://localhost:{port}/{url}"); + await page.WaitForFunctionAsync("window.docfx.ready"); + await page.WaitForFunctionAsync("window.docfx.searchReady"); + + if (url.Contains("?dark")) + { + await page.EvaluateAsync($"() => document.documentElement.setAttribute('data-bs-theme', 'dark')"); + } + + await Task.Delay(200); + + if (url.Contains("?term=cat")) + { + await (await page.QuerySelectorAsync("#search-query")).FillAsync("cat"); + await page.WaitForFunctionAsync("window.docfx.searchResultReady"); + } + + var name = $"{Regex.Replace(url, "[^a-zA-Z0-9-_.]", "-")}"; + await PercySnapshot(page, name); + } + + await page.CloseAsync(); + } + + private static async Task PercySnapshot(IPage page, string name) + { + using (var http = new HttpClient()) + { + // https://www.browserstack.com/docs/percy/integrate/build-your-sdk + // # Step 2: Fetch and inject the DOM JavaScript into the browser + var domjs = await http.GetStringAsync("http://localhost:5338/percy/dom.js"); + await page.AddScriptTagAsync(new() { Content = domjs }); + var domSnapshot = await page.EvaluateAsync("PercyDOM.serialize()"); + var res = await http.PostAsJsonAsync("http://localhost:5338/percy/snapshot", new + { + domSnapshot, + url = page.Url, + name + }); + } + } + + private static int Exec(string filename, string args, string workingDirectory = null) + { + var psi = new ProcessStartInfo(filename, args); + psi.EnvironmentVariables.Add("DOCFX_SOURCE_BRANCH_NAME", "main"); + if (workingDirectory != null) + psi.WorkingDirectory = Path.GetFullPath(workingDirectory); + var process = Process.Start(psi); + process.WaitForExit(); + return process.ExitCode; + } + + private static void Clean(string samplePath) + { + if (Directory.Exists($"{samplePath}/_site")) + Directory.Delete($"{samplePath}/_site", recursive: true); + + if (Directory.Exists($"{samplePath}/_site_pdf")) + Directory.Delete($"{samplePath}/_site_pdf", recursive: true); + } + + private static bool IsActiveLocalTcpPort(int port) + { + var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); + var tcpConnInfoArray = ipGlobalProperties.GetActiveTcpListeners(); + return tcpConnInfoArray.Any(x => x.Port == port); + } +} diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-BuildFromProject.Class1.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-BuildFromProject.Class1.html.verified.png deleted file mode 100644 index f630dd6e543..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-BuildFromProject.Class1.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:994dc98ccf9de444f37d359c21337005d8db490a8243bb5aafb7b7a5df6c0b04 -size 122805 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.Cat-2.html-q-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.Cat-2.html-q-cat.verified.png deleted file mode 100644 index e6ab5509ce2..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.Cat-2.html-q-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fd1efae9246960a43f669ea22c28b606c388b5ddac6e332e338189234ef8771b -size 132359 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html-term-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html-term-cat.verified.png deleted file mode 100644 index 2da86818157..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html-term-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00ee517f387255a827f9c02b43f2bd864b728e79012487a9ca6cc1162ecfe708 -size 157266 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html.verified.png deleted file mode 100644 index 2e0022707ca..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/api-CatLibrary.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:21b373f1c6e54d7f5a2f894e3987d10a49ce8e71fd554578d29ead6a121641b2 -size 107997 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-csharp_coding_standards.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-csharp_coding_standards.html.verified.png deleted file mode 100644 index 114c1257a6f..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-csharp_coding_standards.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:888c5aa93c0370cdfb8212f234f3f0a95967e6d790f11e85ce8a7ccaa7c75744 -size 169624 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png deleted file mode 100644 index d4768e36a7d..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cee816438d6ce9a532b8fd76e6eaa3b0fedb31f497c7b2d29553bfa93777f709 -size 99604 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/index.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/index.html.verified.png deleted file mode 100644 index cb5c2fbe186..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/index.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ca91a96cec5e5f49a52dcbd9b6495bfb2d30676347b10165e2c38f934926d234 -size 117249 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/restapi-petstore.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/restapi-petstore.html.verified.png deleted file mode 100644 index 2c71ae4d834..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1152x648/restapi-petstore.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dc2910aae7fd5cd71faac48653e2674e13a2207c5a93e5cdf0cd8df2c585be3d -size 98419 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-BuildFromProject.Class1.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-BuildFromProject.Class1.html.verified.png deleted file mode 100644 index 33baf6f1456..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-BuildFromProject.Class1.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:85ccaa65279cf1fcf829822b50216598cc3673dd53235016facded35d9aaa0e7 -size 523974 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.Cat-2.html-q-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.Cat-2.html-q-cat.verified.png deleted file mode 100644 index 960278ba50f..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.Cat-2.html-q-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bfc3499b6fe1c2e79c1b7dc784b5684f1a581f0e200315d10c0d836e066423dc -size 861585 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html-term-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html-term-cat.verified.png deleted file mode 100644 index 3ac13f20f02..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html-term-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:927f5e138b75271cf160a2be2fcfc20ed794be42922fe2b19655e64eeb3eb4c7 -size 479547 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html.verified.png deleted file mode 100644 index 765cf8decc8..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/api-CatLibrary.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e4a113d1da091aa827b600c9c1d62695b31b34fe7298b25d42ce6e43b6786502 -size 194808 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-csharp_coding_standards.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-csharp_coding_standards.html.verified.png deleted file mode 100644 index 9aa389ba7db..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-csharp_coding_standards.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fedec210b8828f4fe68dda209107aa8dc09b82efc67913690480fb1f2345af6b -size 1035177 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png deleted file mode 100644 index 78287e1666e..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ac534f6c4c308408825b1e2428a8fe657c6e96c31db948a1c7af4e1bc6c71ff -size 935811 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/index.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/index.html.verified.png deleted file mode 100644 index 861eea8829e..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/index.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a3ac65afee60eb9a981012e603f54e822f5010e0160d259279f0abf18e7874d -size 181230 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/restapi-petstore.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/restapi-petstore.html.verified.png deleted file mode 100644 index 8fcf01502d0..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/1920x1080/restapi-petstore.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a9a1756dcd82b69a9866f83e9e6e06a63deffc0a7a08ddd73c1006223a828259 -size 1337037 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-BuildFromProject.Class1.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-BuildFromProject.Class1.html.verified.png deleted file mode 100644 index 4ffc3b69d04..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-BuildFromProject.Class1.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d865dfa3544396f411e065d4514947207ffcc8672a02d80ce9846cb7a34aff8 -size 350530 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.Cat-2.html-q-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.Cat-2.html-q-cat.verified.png deleted file mode 100644 index 94aeb7b6882..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.Cat-2.html-q-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:33c12b0d71671031a73c1b291abffa9c405d91db052fa94abe3cba94431e8799 -size 682153 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html-term-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html-term-cat.verified.png deleted file mode 100644 index f12ca953df2..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html-term-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6800f52dc930b1add8d07fc41010bdea1dbacf3c9911e3ac9e0142ff29a4e266 -size 695603 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html.verified.png deleted file mode 100644 index 4c933c3ca47..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/api-CatLibrary.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bb56bff8d9d59ae86025e0c7bba022e9dbe53469a783e41dba7dd7eebb297c64 -size 131998 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-csharp_coding_standards.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-csharp_coding_standards.html.verified.png deleted file mode 100644 index 69dcd51dc79..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-csharp_coding_standards.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:736abed12eca474dd845f8339178c6c86dfe1de48ddf383bcafa0324a953ddf7 -size 1041039 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png deleted file mode 100644 index 826ee32b251..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:47d1f74bcc4431fd1ee8ff07fbedc37d911c6aabfa9db4291344ed1087b66773 -size 530071 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/index.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/index.html.verified.png deleted file mode 100644 index 0f0049620b9..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/index.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f5e31841d9ca2f90b6ac431ccf26a54241a75e986b97cf4d399dc722e1710a1f -size 175275 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/restapi-petstore.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/restapi-petstore.html.verified.png deleted file mode 100644 index 24effdf13f5..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/375x812/restapi-petstore.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3cbf1f270c1f9a18df5d67ccd746ccab8a44ebc06a60feefa63cbe8e388df874 -size 1086009 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-BuildFromProject.Class1.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-BuildFromProject.Class1.html.verified.png deleted file mode 100644 index abdca12ab40..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-BuildFromProject.Class1.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9af00306c4f1211fce595e46b631faeaf0fcc4ca0a24bbb648cbb4061df7e3e3 -size 96009 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.Cat-2.html-q-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.Cat-2.html-q-cat.verified.png deleted file mode 100644 index cce3b362bd1..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.Cat-2.html-q-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c4f226ad841a6e2ee6c27da4659fcbeecfd29fba480b079dfe268e917f74f199 -size 94817 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html-term-cat.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html-term-cat.verified.png deleted file mode 100644 index b61efb153c8..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html-term-cat.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3ff2dd9fbd1f7c6fea9632f5d771a2319e8f56e837ce1e3ca3d34033999ff638 -size 116179 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html.verified.png deleted file mode 100644 index 371862c31e6..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/api-CatLibrary.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a6d11908fa2d3801ada2f970695395b35fdbffb44de7a287329a9f9f7aec4e2f -size 93829 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-csharp_coding_standards.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-csharp_coding_standards.html.verified.png deleted file mode 100644 index 3d7e8ffbb16..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-csharp_coding_standards.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b81744c678be0a61568a59b0d05fa1ba5deb23f03fc18527e313e3b70dde706b -size 118712 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png deleted file mode 100644 index eeaf4807f11..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e60ee574ca3a463f41f5fcdb0d41880c9e39ad447e6bef89d6b2ccd3988cb9b -size 83432 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/index.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/index.html.verified.png deleted file mode 100644 index df71965831a..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/index.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:95faa6344312b7013eb9f0d33afde7a3a4f62db49297db12246e5f165d6d5166 -size 105310 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/restapi-petstore.html.verified.png b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/restapi-petstore.html.verified.png deleted file mode 100644 index dc2afd682d0..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/768x600/restapi-petstore.html.verified.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ddaeb1a0b6c5a42a8188131ee53689355cf0743b1989d2946d3a034179c8f484 -size 60338 diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html deleted file mode 100644 index 264b44d3203..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-BuildFromProject.Class1.html.verified.html +++ /dev/null @@ -1,1039 +0,0 @@ - - - Class Class1 | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
- - - -

-Class Class1 -

- -
-
Namespace
BuildFromProject
-
Assembly
BuildFromProject.dll
-
- -
-
- -
-
public class Class1 : IClass1
-
- - - - -
-
Inheritance
-
- -
Class1
-
-
- -
-
Implements
-
-
IClass1
-
-
- - -
-
Inherited Members
-
- - - - - - - -
- - - - - - -

Methods

- - - - -

- Issue1651() - -

- -

Pricing models are used to calculate theoretical option values

-
  • 1Black Scholes
  • 2Black76
  • 3Black76Fut
  • 4Equity Tree
  • 5Variance Swap
  • 6Dividend Forecast
-
-
- -
-
public void Issue1651()
-
- - - - - - - - - - - - - - - -

- Issue1887() - -

- -

IConfiguration related helper and extension routines.

-
-
- -
-
public void Issue1887()
-
- - - - - - - - - - - - - - - -

- Issue2623() - -

- -
-
- -
-
public void Issue2623()
-
- - - - - - - - -

Examples

-
MyClass myClass = new MyClass();
-
-void Update()
-{
-    myClass.Execute();
-}
-
- - -

Remarks

-

For example:

-
MyClass myClass = new MyClass();
-
-void Update()
-{
-    myClass.Execute();
-}
-
-
- - - - - - -

- Issue2723() - -

- -
-
- -
-
public void Issue2723()
-
- - - - - - - - - -

Remarks

-
-
Note
-

This is a <note>. & " '

-
-

Inline <angle brackets>.

-

link

-
for (var i = 0; i > 10; i++) // & " '
-var range = new Range<int> { Min = 0, Max = 10 };
-
-
var range = new Range<int> { Min = 0, Max = 10 };
-
- - - - - - -

- Issue4017() - -

- -
-
- -
-
public void Issue4017()
-
- - - - - - - - -

Examples

-
public void HookMessageDeleted(BaseSocketClient client)
-{
-    client.MessageDeleted += HandleMessageDelete;
-}
-
-public Task HandleMessageDelete(Cacheable<IMessage, ulong> cachedMessage, ISocketMessageChannel channel)
-{
-    // check if the message exists in cache; if not, we cannot report what was removed
-    if (!cachedMessage.HasValue) return;
-    var message = cachedMessage.Value;
-    Console.WriteLine($"A message ({message.Id}) from {message.Author} was removed from the channel {channel.Name} ({channel.Id}):"
-        + Environment.NewLine
-        + message.Content);
-    return Task.CompletedTask;
-}
- - -

Remarks

-
void Update()
-{
-    myClass.Execute();
-}
-
- - - - - - -

- Issue4392() - -

- -
-
- -
-
public void Issue4392()
-
- - - - - - - - - -

Remarks

-

@"\\?\" @"\\?\"

-
- - - - - - -

- Issue7484() - -

- -
-
- -
-
public void Issue7484()
-
- - - - - - - - - -

Remarks

-

There's really no reason to not believe that this class can test things.

-
TermDescription
A TermA Description
Bee TermBee Description
-
- - - - - - -

- Issue8764<T>() - -

- -
-
- -
-
public void Issue8764<T>() where T : unmanaged
-
- - - -

Type Parameters

-
-
T
-
-
- - - - - - - - - - - - -

- Issue896() - -

- -

Test

-
-
- -
-
public void Issue896()
-
- - - - - - - - - - - -
-
See Also
-
- - -
-
- - - - -

- Issue9216() - -

- -

Calculates the determinant of a 3-dimensional matrix:

-

A=|a11a12a13a21a22a23a31a32a33|

-

Returns the smallest value:

-

{a,a<bb,b>a

-
-
- -
-
public static double Issue9216()
-
- - -

Returns

-
-
double
-
-
- - - - - - - - - - - - - -

- XmlCommentIncludeTag() - -

- -

This method should do something...

-
-
- -
-
public void XmlCommentIncludeTag()
-
- - - - - - - - - -

Remarks

-

This is remarks.

-
- - - - - -
- - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.Cat-2.html-q-cat.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.Cat-2.html-q-cat.verified.html deleted file mode 100644 index e99f32cf7b3..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.Cat-2.html-q-cat.verified.html +++ /dev/null @@ -1,1114 +0,0 @@ - - - Class Cat<T, K> | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
- - - -

-Class Cat<T, K> -

- -
-
Namespace
CatLibrary
-
Assembly
CatLibrary.dll
-
- -

Here's main class of this Demo.

-

You can see mostly type of article within this class and you for more detail, please see the remarks.

-

-

this class is a template class. It has two Generic parameter. they are: T and K.

-

The extension method of this class can refer to ICatExtension class

-
-
-

This is a class talking about CAT.

-
-

NOTE -This is a CAT class

-
-

Refer to IAnimal to see other animals.

-
- -
-
[Serializable]
-[Obsolete]
-public class Cat<T, K> : ICat, IAnimal where T : class, new() where K : struct
-
- - - -

Type Parameters

-
-
T
-

This type should be class and can new instance.

-
-
K
-

This type is a struct type, class type can't be used for this parameter.

-
-
- -
-
Inheritance
-
- -
Cat<T, K>
-
-
- -
-
Implements
-
- - -
-
- - -
-
Inherited Members
-
- - - - - - -
- -
-
Extension Methods
-
- - -
- - -

Examples

-

Here's example of how to create an instance of this class. As T is limited with class and K is limited with struct.

-
var a = new Cat(object, int)();
-int catNumber = new int();
-unsafe
-{
-    a.GetFeetLength(catNumber);
-}
-

As you see, here we bring in pointer so we need to add unsafe keyword.

- - -

Remarks

-

THIS is remarks overridden in MARKDWON file

-
- - -

Constructors

- - - - -

- Cat() - -

- -

Default constructor.

-
-
- -
-
public Cat()
-
- - - - - - - - - - - - - - - -

- Cat(string, out int, string, bool) - -

- -

It's a complex constructor. The parameter will have some attributes.

-
-
- -
-
public Cat(string nickName, out int age, string realName, bool isHealthy)
-
- -

Parameters

-
-
nickName string
-

it's string type.

-
-
age int
-

It's an out and ref parameter.

-
-
realName string
-

It's an out paramter.

-
-
isHealthy bool
-

It's an in parameter.

-
-
- - - - - - - - - - - - - - -

- Cat(T) - -

- -

Constructor with one generic parameter.

-
-
- -
-
public Cat(T ownType)
-
- -

Parameters

-
-
ownType T
-

This parameter type defined by class.

-
-
- - - - - - - - - - - - -

Fields

- - - -

- isHealthy - -

- -

Field with attribute.

-
-
- -
-
[ContextStatic]
-[NonSerialized]
-[Obsolete]
-public bool isHealthy
-
- - - - -

Field Value

-
-
bool
-
-
- - - - - - - - - -

Properties

- - - - -

- Age - -

- -

Hint cat's age.

-
-
- -
-
[Obsolete]
-protected int Age { get; set; }
-
- - - - - -

Property Value

-
-
int
-
-
- - - - - - - - - - -

- this[string] - -

- -

This is index property of Cat. You can see that the visibility is different between get and set method.

-
-
- -
-
public int this[string a] { protected get; set; }
-
- -

Parameters

-
-
a string
-

Cat's name.

-
-
- - - - -

Property Value

-
-
int
-

Cat's number.

-
-
- - - - - - - - - - -

- Name - -

- -

EII property.

-
-
- -
-
public string Name { get; }
-
- - - - - -

Property Value

-
-
string
-
-
- - - - - - - - -

Methods

- - - - -

- Override CalculateFood Name - -

- -

It's an overridden summary in markdown format

-
-
-

This is overriding methods. You can override parameter descriptions for methods, you can even add exceptions to methods. Check the intermediate obj folder to see the data model of the generated method/class. Override Yaml header should follow the data structure.

-
- -
-
public Dictionary<string, List<int>> CalculateFood(DateTime date)
-
- -

Parameters

-
-
date DateTime
-

This is overridden description for a parameter. id must be specified.

-
-
- -

Returns

-
-
Dictionary<string, List<int>>
-

It's overridden description for return. type must be specified.

-
-
- - - - - - - - -

Exceptions

-
-
ArgumentException
-

This is an overridden argument exception. you can add additional exception by adding different exception type.

-
-
- - - - - -

- Equals(object) - -

- -

Override the method of Object.Equals(object obj).

-
-
- -
-
public override bool Equals(object obj)
-
- -

Parameters

-
-
obj object
-

Can pass any class type.

-
-
- -

Returns

-
-
bool
-

The return value tell you whehter the compare operation is successful.

-
-
- - - - - - - - - - - - - -

- GetTailLength(int*, params object[]) - -

- -

It's an unsafe method. -As you see, catName is a pointer, so we need to add unsafe keyword.

-
-
- -
-
public long GetTailLength(int* catName, params object[] parameters)
-
- -

Parameters

-
-
catName int*
-

Thie represent for cat name length.

-
-
parameters object[]
-

Optional parameters.

-
-
- -

Returns

-
-
long
-

Return cat tail's length.

-
-
- - - - - - - - - - - - - -

- Jump(T, K, ref bool) - -

- -

This method have attribute above it.

-
-
- -
-
[Conditional("Debug")]
-public void Jump(T ownType, K anotherOwnType, ref bool cheat)
-
- -

Parameters

-
-
ownType T
-

Type come from class define.

-
-
anotherOwnType K
-

Type come from class define.

-
-
cheat bool
-

Hint whether this cat has cheat mode.

-
-
- - - - - - - - - -

Exceptions

-
-
ArgumentException
-

This is an argument exception

-
-
- - - -

Events

- - - -

- ownEat - -

- -

Eat event of this cat

-
-
- -
-
[Obsolete("This _event handler_ is deprecated.")]
-public event EventHandler ownEat
-
- - - - - - -

Event Type

-
-
EventHandler
-
-
- - - - - - - -

Operators

- - - - -

- operator +(Cat<T, K>, int) - -

- -

Addition operator of this class.

-
-
- -
-
public static int operator +(Cat<T, K> lsr, int rsr)
-
- -

Parameters

-
-
lsr Cat<T, K>
-

..

-
-
rsr int
-

~~

-
-
- -

Returns

-
-
int
-

Result with int type.

-
-
- - - - - - - - - - - - - -

- explicit operator Tom(Cat<T, K>) - -

- -

Expilicit operator of this class.

-

It means this cat can evolve to change to Tom. Tom and Jerry.

-
-
- -
-
public static explicit operator Tom(Cat<T, K> src)
-
- -

Parameters

-
-
src Cat<T, K>
-

Instance of this class.

-
-
- -

Returns

-
-
Tom
-

Advanced class type of cat.

-
-
- - - - - - - - - - - - - -

- operator -(Cat<T, K>, int) - -

- -

Similar with operaotr +, refer to that topic.

-
-
- -
-
public static int operator -(Cat<T, K> lsr, int rsr)
-
- -

Parameters

-
-
lsr Cat<T, K>
-
-
rsr int
-
-
- -

Returns

-
-
int
-
-
- - - - - - - - - - - - -
- - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html-term-cat.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html-term-cat.verified.html deleted file mode 100644 index 5ead831785a..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html-term-cat.verified.html +++ /dev/null @@ -1,536 +0,0 @@ - - - Namespace CatLibrary | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
- -

Namespace CatLibrary

-
-
-
- -

Namespaces

-
-
CatLibrary.Core
-
-
-

Classes

-
-
CatException<T>
-
-
-
-
Cat<T, K>
-

Here's main class of this Demo.

-

You can see mostly type of article within this class and you for more detail, please see the remarks.

-

-

this class is a template class. It has two Generic parameter. they are: T and K.

-

The extension method of this class can refer to ICatExtension class

-
-
-
-
Complex<T, J>
-
-
-
-
ICatExtension
-

It's the class that contains ICat interface's extension method.

-

This class must be public and static.

-

Also it shouldn't be a geneic class

-
-
-
-
Tom
-

Tom class is only inherit from Object. Not any member inside itself.

-
-
-
-
TomFromBaseClass
-

TomFromBaseClass inherits from @

-
-
-

Interfaces

-
-
IAnimal
-

This is basic interface of all animal.

-
-
-
-
ICat
-

Cat's interface

-
-
-

Delegates

-
-
FakeDelegate<T>
-

Fake delegate

-
-
-
-
MRefDelegate<K, T, L>
-

Generic delegate with many constrains.

-
-
-
-
MRefNormalDelegate
-

Delegate in the namespace

-
-
- - -
- -
-
- - -
- -
- -
-
- -
-
9 results for "cat"
-
-
- -
http:/localhost:8089/apipage/CatLibrary.ICat.html
-
Interface ICat Namespace CatLibrary Assembly CatLibrary.dll Cat's interface public interface ICat : IAnimal Implements IAnimal Extension Methods ICatExtension.Play(ICat, ContainersRefType.ColorType) ICatExtension.Sleep(ICat, long) eat eat event of cat. Every cat must implement this event. event EventHandler eat Event Type EventHandler...
-
-
- -
http:/localhost:8089/md/CatLibrary.ICat.html
-
Interface ICat Namespace: CatLibrary Assembly: CatLibrary.dll Cat's interface public interface ICat : IAnimal Implements IAnimal Extension Methods ICatExtension.Play(ICat, ContainersRefType.ColorType), ICatExtension.Sleep(ICat, long) eat eat event of cat. Every cat must implement this event. event EventHandler eat Event Type EventHandler...
-
-
- -
http:/localhost:8089/api/CatLibrary.Cat-2.html
-
... used for this parameter. Inheritance object Cat<T, K> Implements ICat IAnimal Inherited Members object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Extension Methods ICatExtension.Play(ICat, ContainersRefType.ColorType) ICatExtension.Sleep(ICat, long) Examples Here's example of how to create an instance of this class. As T is limited with class and K is limited with struct. var a = new Cat(object, int)(); int catNumber = new int(); unsafe { a.GetFeetLength(catNumber); } As you see, here we bring in pointer so we need to add unsafe keyword. Remarks THIS is remarks overridden in MARKDWON file Constructors Cat() Default constructor. public Cat() Cat(string, out int, string, bool) It's a complex constructor. The parameter will have some attributes. public Cat(string nickName, out int age, string realName, bool isHealthy) Parameters nickName string it's string type. age int It's an out and ref parameter. realName str...
-
-
- -
http:/localhost:8089/apipage/CatLibrary.Cat-2.html
-
Class Cat<T, K> Deprecated Namespace CatLibrary Assembly CatLibrary.dll Here's main class of this Demo. You can see mostly type of article within this class and you for more detail, please see the remarks. this class is a template class. It has two Generic parameter. they are: T and K. The extension method of this class can refer to ICatExtension class [Serializable] [Obsolete] public class Cat<T, K> : ICat, IAnimal where T : class, new() where K : struct Type Parameters T This type should be class and can new instance. K This ...
-
-
- -
http:/localhost:8089/md/CatLibrary.Cat-2.html
-
... object ← Cat<T, K> Implements ICat, IAnimal Inherited Members object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString() Extension Methods ICatExtension.Play(ICat, ContainersRefType.ColorType), ICatExtension.Sleep(ICat, long) Examples Here's example of how to create an instance of this class. As T is limited with class and K is limited with struct. var a = new Cat(object, int)(); int catNumber = new int(); unsafe { a.GetFeetLength(catNumber); } As you see, here we bring in pointer so we need to add unsafe keyword. Remarks Here's all the content you can see in this class. Constructors Cat() Default constructor. public Cat() Cat(T) Constructor with one generic parameter. public Cat(T ownType) Parameters ownType T This parameter type defined by class. Cat(string, out int, string, bool) It's a complex constructor. The parameter will have some attributes. public Cat(string nickName, out int ...
-
-
- -
http:/localhost:8089/api/CatLibrary.ICat.html
-
Interface ICat Namespace CatLibrary Assembly CatLibrary.dll Cat's interface public interface ICat : IAnimal Inherited Members IAnimal.Name IAnimal.this[int] IAnimal.Eat() IAnimal.Eat<Tool>(Tool) IAnimal.Eat(string) Extension Methods ICatExtension.Play(ICat, ContainersRefType.ColorType) ICatExtension.Sleep(ICat, long) Events eat eat event of cat. Every cat must implement this event. event EventHandler eat Event Type EventHandler...
-
-
- -
http:/localhost:8089/api/CatLibrary.ICatExtension.html
-
...ass ICatExtension Namespace CatLibrary Assembly CatLibrary.dll It's the class that contains ICat interface's extension method. This class must be public and static. Also it shouldn't be a geneic class public static class ICatExtension Inheritance object ICatExtension Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Methods Play(ICat, ColorType) Extension method to let cat play public static void Play(this ICat icat, ContainersRefType.ColorType toy) Parameters icat ICat Cat toy ContainersRefType.ColorType Something to play Sleep(ICat, long) Extension method hint that how long the cat can sleep. public static void Sleep(this ICat icat, long hours) Parameters icat ICat The type will be extended. hours long The length of sleep....
-
-
- -
http:/localhost:8089/apipage/CatLibrary.ICatExtension.html
-
...CatExtension Namespace CatLibrary Assembly CatLibrary.dll It's the class that contains ICat interface's extension method. This class must be public and static. Also it shouldn't be a geneic class public static class ICatExtension Inheritance object ICatExtension Inherited Members object.Equals(object?) object.Equals(object?, object?) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object?, object?) object.ToString() Methods Play(ICat, ColorType) Extension method to let cat play public static void Play(this ICat icat, ContainersRefType.ColorType toy) Parameters icat ICat Cat toy ContainersRefType.ColorType Something to play Sleep(ICat, long) Extension method hint that how long the cat can sleep. public static void Sleep(this ICat icat, long hours) Parameters icat ICat The type will be extended. hours long The length of sleep....
-
-
- -
http:/localhost:8089/md/CatLibrary.ICatExtension.html
-
...on Namespace: CatLibrary Assembly: CatLibrary.dll It's the class that contains ICat interface's extension method. This class must be public and static. Also it shouldn't be a geneic class public static class ICatExtension Inheritance object ← ICatExtension Inherited Members object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString() Methods Play(ICat, ColorType) Extension method to let cat play public static void Play(this ICat icat, ContainersRefType.ColorType toy) Parameters icat ICat Cat toy ContainersRefType.ColorType Something to play Sleep(ICat, long) Extension method hint that how long the cat can sleep. public static void Sleep(this ICat icat, long hours) Parameters icat ICat The type will be extended. hours long The length of sleep....
-
-
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html.verified.html deleted file mode 100644 index b337a0bac4d..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/api-CatLibrary.html.verified.html +++ /dev/null @@ -1,488 +0,0 @@ - - - Namespace CatLibrary | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
- -

Namespace CatLibrary

-
-
-
- -

Namespaces

-
-
CatLibrary.Core
-
-
-

Classes

-
-
CatException<T>
-
-
-
-
Cat<T, K>
-

Here's main class of this Demo.

-

You can see mostly type of article within this class and you for more detail, please see the remarks.

-

-

this class is a template class. It has two Generic parameter. they are: T and K.

-

The extension method of this class can refer to ICatExtension class

-
-
-
-
Complex<T, J>
-
-
-
-
ICatExtension
-

It's the class that contains ICat interface's extension method.

-

This class must be public and static.

-

Also it shouldn't be a geneic class

-
-
-
-
Tom
-

Tom class is only inherit from Object. Not any member inside itself.

-
-
-
-
TomFromBaseClass
-

TomFromBaseClass inherits from @

-
-
-

Interfaces

-
-
IAnimal
-

This is basic interface of all animal.

-
-
-
-
ICat
-

Cat's interface

-
-
-

Delegates

-
-
FakeDelegate<T>
-

Fake delegate

-
-
-
-
MRefDelegate<K, T, L>
-

Generic delegate with many constrains.

-
-
-
-
MRefNormalDelegate
-

Delegate in the namespace

-
-
- - -
- -
-
- - -
- -
- -
-
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-csharp_coding_standards.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-csharp_coding_standards.html.verified.html deleted file mode 100644 index fbdc46d6076..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-csharp_coding_standards.html.verified.html +++ /dev/null @@ -1,366 +0,0 @@ - - - C# Coding Standards | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
-

C# Coding Standards

- -

Introduction

-

The coding standard will be used in conjunction with customized version of StyleCop and FxCop [TODO] during both development and build process. This will help ensure that the standard is followed by all developers on the team in a consistent manner.

-
-

"Any fool can write code that a computer can understand. Good programmers write code that humans understand".

-

Martin Fowler. Refactoring: Improving the design of existing code.

-
-

Purpose

-

The aim of this section is to define a set of C# coding standards to be used by CAPS build team to guarantee maximum legibility, reliability, re-usability and homogeneity of our code. Each section is marked Mandatory or Recommended. Mandatory sections, will be enforced during code reviews as well as tools like StyleCop and FxCop, and code will not be considered complete until it is compliant.

-

Scope

-

This section contains general C# coding standards which can be applied to any type of application developed in C#, based on Framework Design Guidelines.

-

It does not pretend to be a tutorial on C#. It only includes a set of limitations and recommendations focused on clarifying the development.

-

Tools

-
    -
  • Resharper is a great 3rd party code cleanup and style tool.
  • -
  • StyleCop analyzes C# srouce code to enforce a set of style and consistency rules and has been integrated into many 3rd party development tools such as Resharper.
  • -
  • FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements.
  • -
  • C# Stylizer does many of the style rules automatically
  • -
-

Highlights of Coding Standards

-

This section is not intended to give a summary of all the coding standards that enabled by our customized StyleCop, but to give a highlight of some rules one will possibly meet in daily coding life. It also provides some recommended however not mandatory(which means not enabled in StyleCop) coding standards.

- -

Only one public class is allowed per file.

-

The file name is derived from the class name.

-
	Class   : Observer
-	Filename: Observer.cs
-
-

Class Definition Order (Mandatory)

-

The class definition contains class members in the following order, from less restricted scope (public) to more restrictive (private):

-
    -
  • Nested types, e.g. classes, enum, struct, etc.
  • -
  • Field members, e.g. member variables, const, etc.
  • -
  • Member functions -
      -
    • Constructors
    • -
    • Finalizer (Do not use unless absolutely necessary)
    • -
    • Methods (Properties, Events, Operations, Overridables, Static)
    • -
    • Private nested types
    • -
    -
  • -
-

Naming (Mandatory)

-
    -
  • DO use PascalCasing for all public member, type, and namespace names consisting of multiple words.

    -
      PropertyDescriptor
    -  HtmlTag
    -  IOStream
    -
    -
  • -
-

NOTE: A special case is made for two-letter acronyms in which both letters are capitalized, e.g. IOStream

-
    -
  • DO use camelCasing for parameter names.

    -
      propertyDescriptor
    -  htmlTag
    -  ioStream
    -
    -
  • -
  • DO start with underscore for private fields

    -
      private readonly Guid _userId = Guid.NewGuid();
    -
    -
  • -
  • DO start static readonly fields, constants with capitalized case

    -
      private static readonly IEntityAccessor EntityAccessor = null;
    -  private const string MetadataName = "MetadataName";
    -
    -
  • -
  • DO NOT capitalize each word in so-called closed-form compound words.

    -
  • -
  • DO have "Async" explicitly in the Async method name to notice people how to use it properly

    -
  • -
-

Formatting (Mandatory)

-
    -
  • DO use spaces over tabs, and always show all spaces/tabs in IDE
  • -
-
-

Tips

-

Visual Studio > TOOLS > Options > Text Editor > C# > Tabs > Insert spaces (Tab size: 4)

-

Visual Studio > Edit > Advanced > View White Space

-
-
    -
  • DO add using inside namespace declaration

    -
      namespace Microsoft.Content.Build.BuildWorker.UnitTest
    -  {
    -  	using System;
    -  }
    -
    -
  • -
  • DO add a space when:

    -
      -
    1. for (var i = 0; i < 1; i++)
    2. -
    3. if (a == b)
    4. -
    -
  • -
-

Cross-platform coding

-

Our code should supports multiple operating systems. Don't assume we only run (and develop) on Windows. Code should be sensitvie to the differences between OS's. Here are some specifics to consider.

-
    -
  • DO use Enviroment.NewLine instead of hard-coding the line break instead of \r\n, as Windows uses \r\n and OSX/Linux uses \n.
  • -
-
-

Note

-

Be aware that thes line-endings may cause problems in code when using @"" text blocks with line breaks.

-
-
    -
  • DO Use Path.Combine() or Path.DirectorySeparatorChar to separate directories. If this is not possible (such as in scripting), use a forward slash /. Windows is more forgiving than Linux in this regard.
  • -
-

Unit tests and functional tests

-

Assembly naming

-

The unit tests for the Microsoft.Foo assembly live in the Microsoft.Foo.Tests assembly.

-

The functional tests for the Microsoft.Foo assmebly live in the Microsoft.Foo.FunctionalTests assmebly.

-

In general there should be exactly one unit test assebmly for each product runtime assembly. In general there should be one functional test assembly per repo. Exceptions can be made for both.

-

Unit test class naming

-

Test class names end with Test and live in the same namespace as the class being tested. For example, the unit tests for the Microsoft.Foo.Boo class would be in a Microsoft.Foo.Boo class in the test assembly.

-

Unit test method naming

-

Unit test method names must be descriptive about what is being tested, under what conditions, and what the expectations are. Pascal casing and underscores can be used to improve readability. The following test names are correct:

-
PublicApiArgumentsShouldHaveNotNullAnnotation
-Public_api_arguments_should_have_not_null_annotation
-
-

The following test names are incorrect:

-
Test1
-Constructor
-FormatString
-GetData
-
-

Unit test structure

-

The contents of every unit test should be split into three distinct stages, optionally separated by these comments:

-
// Arrange
-// Act
-// Assert
-
-

The crucial thing here is the Act stage is exactly one statement. That one statement is nothing more than a call to the one method that you are trying to test. keeping that one statement as simple as possible is also very important. For example, this is not ideal:

-
int result = myObj.CallSomeMethod(GetComplexParam1(), GetComplexParam2(), GetComplexParam3());
-
-

This style is not recomended because way too many things can go wrong in this one statement. All the GetComplexParamN() calls can throw for a variety of reasons unrelated to the test itself. It is thus unclear to someone running into a problem why the failure occured.

-

The ideal pattern is to move the complex parameter building into the `Arrange section:

-
// Arrange
-P1 p1 = GetComplexParam1();
-P2 p2 = GetComplexParam2();
-P3 p3 = GetComplexParam3();
-
-// Act
-int result = myObj.CallSomeMethod(p1, p2, p3);
-
-// Assert
-Assert.AreEqual(1234, result);
-
-

Now the only reason the line with CallSomeMethod() can fail is if the method itself blew up.

-

Testing exception messages

-

In general testing the specific exception message in a unit test is important. This ensures that the exact desired exception is what is being tested rather than a different exception of the same type. In order to verify the exact exception it is important to verify the message.

-
var ex = Assert.Throws<InvalidOperationException>(
-    () => fruitBasket.GetBananaById(1234));
-Assert.Equal(
-    "1234",
-    ex.Message);
-
-

Use xUnit.net's plethora of built-in assertions

-

xUnit.net includes many kinds of assertions – please use the most appropriate one for your test. This will make the tests a lot more readable and also allow the test runner report the best possible errors (whether it's local or the CI machine). For example, these are bad:

-
Assert.Equal(true, someBool);
-
-Assert.True("abc123" == someString);
-
-Assert.True(list1.Length == list2.Length);
-
-for (int i = 0; i < list1.Length; i++) {
-    Assert.True(
-        String.Equals
-            list1[i],
-            list2[i],
-            StringComparison.OrdinalIgnoreCase));
-}
-
-

These are good:

-
Assert.True(someBool);
-
-Assert.Equal("abc123", someString);
-
-// built-in collection assertions!
-Assert.Equal(list1, list2, StringComparer.OrdinalIgnoreCase);
-
-

Parallel tests

-

By default all unit test assemblies should run in parallel mode, which is the default. Unit tests shouldn't depend on any shared state, and so should generally be runnable in parallel. If the tests fail in parallel, the first thing to do is to figure out why; do not just disable parallel tests!

-

For functional tests it is reasonable to disable parallel tests.

- -
- - - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.html deleted file mode 100644 index b0b77d837e8..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/articles-markdown.html-tabs-windows-2Ctypescript-markdown-extensions.verified.html +++ /dev/null @@ -1,560 +0,0 @@ - - - Markdown | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
-

Markdown

- -

Markdown is a lightweight markup language with plain text formatting syntax. Docfx supports CommonMark compliant Markdown parsed through the Markdig parsing engine.

-

Link to Math Expressions

-

Block Quotes

-
-

This is a block quote.

-
-

Alerts

-
-
Note
-

Information the user should notice even if skimming.

-
-
-
Tip
-

Optional information to help a user be more successful.

-
-
-
Important
-

Essential information required for user success.

-
-
-
Caution
-

Negative potential consequences of an action.

-
-
-
Warning
-

Dangerous certain consequences of an action.

-
-
-
MY TODO
-

This is a TODO.

-
-

Image

-

alt-text

-

Mermaid Diagrams

-

Flowchart

-
Text
One
Two
Hard
Round
Decision
Result 1
Result 2
-

Code Snippet

-

The example highlights lines 2, line 5 to 7 and lines 9 to the end of the file.

-
using System;
-using Azure;
-using Azure.Storage;
-using Azure.Storage.Blobs;
-
-class Program
-{
-    static void Main(string[] args)
-    {
-        // Define the connection string for the storage account
-        string connectionString = "DefaultEndpointsProtocol=https;AccountName=<your-account-name>;AccountKey=<your-account-key>;EndpointSuffix=core.windows.net";
-
-        // Create a new BlobServiceClient using the connection string
-        var blobServiceClient = new BlobServiceClient(connectionString);
-
-        // Create a new container
-        var container = blobServiceClient.CreateBlobContainer("mycontainer");
-
-        // Upload a file to the container
-        using (var fileStream = File.OpenRead("path/to/file.txt"))
-        {
-            container.UploadBlob("file.txt", fileStream);
-        }
-
-        // Download the file from the container
-        var downloadedBlob = container.GetBlobClient("file.txt").Download();
-        using (var fileStream = File.OpenWrite("path/to/downloaded-file.txt"))
-        {
-            downloadedBlob.Value.Content.CopyTo(fileStream);
-        }
-    }
-}
-

Math Expressions

-

This sentence uses $ delimiters to show math inline: 3x1+(1+x)2

-

The Cauchy-Schwarz Inequality

-

(k=1nakbk)2(k=1nak2)(k=1nbk2)

-

This expression uses \$ to display a dollar sign: $4

-

To split $100 in half, we calculate 100/2

-

Custom Syntax Highlighting

-
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-06-01' = {
-  name: 'hello'
-  // (...)
-}
-
-

Tabs

-
- - -
- -

Content for Windows...

-
-
- -

The above tab group was created with the following syntax:

-
# [Linux](#tab/linux)
-
-Content for Linux...
-
-# [Windows](#tab/windows)
-
-Content for Windows...
-
----
-
-

Tabs are indicated by using a specific link syntax within a Markdown header. The syntax can be described as follows:

-
# [Tab Display Name](#tab/tab-id)
-
-

A tab starts with a Markdown header, #, and is followed by a Markdown link [](). The text of the link will become the text of the tab header, displayed to the customer. In order for the header to be recognized as a tab, the link itself must start with #tab/ and be followed by an ID representing the content of the tab. The ID is used to sync all same-ID tabs across the page. Using the above example, when a user selects a tab with the link #tab/windows, all tabs with the link #tab/windows on the page will be selected.

-

Dependent tabs

-

It's possible to make the selection in one set of tabs dependent on the selection in another set of tabs. Here's an example of that in action:

-
- - - - -
- -

TypeScript content for Windows...

-
- -
- -

Notice how changing the Linux/Windows selection above changes the content in the .NET and TypeScript tabs. This is because the tab group defines two versions for each .NET and TypeScript, where the Windows/Linux selection above determines which version is shown for .NET/TypeScript. Here's the markup that shows how this is done:

-
# [.NET](#tab/dotnet/linux)
-
-.NET content for Linux...
-
-# [.NET](#tab/dotnet/windows)
-
-.NET content for Windows...
-
-# [TypeScript](#tab/typescript/linux)
-
-TypeScript content for Linux...
-
-# [TypeScript](#tab/typescript/windows)
-
-TypeScript content for Windows...
-
-# [REST API](#tab/rest)
-
-REST API content, independent of platform...
-
----
-
-

Details

-
-Demo -
root@server# apt-get install nano
-
-
- -
- - - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - -
\ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/index.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/index.html.verified.html deleted file mode 100644 index f00f4a2d2d5..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/index.html.verified.html +++ /dev/null @@ -1,218 +0,0 @@ - - - docfx-seed | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
-

docfx-seed

- -

Description

-

This is a sample docfx documentation project. It contains .NET source code and markdown files. -docfx.json is the configuration file for running docfx. -docfx will generate a static website as similar to http://docascode.github.io/docfx-seed.

-

How to run

-

Under Windows

-
    -
  • Download and unzip docfx.zip to run docfx.exe directly!
  • -
  • Run docfx under current repo! Website will be generated under _site folder.
  • -
  • Run any web hosting tool to host _site folder, e.g. docfx serve _site.
  • -
-

Cross platform and use dnx

-

As a prerequisite, you will need to install DNVM and DNX. -###Quick Start

-
    -
  • dnvm upgrade to get the latest dnvm.

    -
  • -
  • Add feed https://www.myget.org/F/aspnetrelease/api/v2/ to Nuget.config

    -
    -

    For Windows, the nuget config file is %AppData%\NuGet\NuGet.config.

    -
    -
    -

    For Linux/OSX, the nuget config file is ~/.config/NuGet/NuGet.config.

    -
    -
    -
  • -
  • dnu commands install docfx to install docfx as a command

    -
  • -
  • Run docfx under current repo! Website will be generated under _site folder.

    -
  • -
  • Run any web hosting tool to host _site folder, e.g. docfx serve _site.

    -
  • -
-

Further information about docfx

-

docfx is a tool to generate documentation towards .NET source code and markdown files. Please refer to docfx to get start. The docfx website itself is generated by docfx!

- -
- - - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/restapi-petstore.html.verified.html b/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/restapi-petstore.html.verified.html deleted file mode 100644 index 76d7baf1171..00000000000 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedHtml/html/restapi-petstore.html.verified.html +++ /dev/null @@ -1,2056 +0,0 @@ - - - Pet Store APIs | docfx seed website - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-
Table of Contents
- -
-
- -
-
-
- -
-
- - - -
- -
- -

Swagger Petstore

-
-

Describe APIs in Pet Store

-
-

pet

-

Description for pet tag

-
- - - | - Improve this Doc - - - View Source - -

addPet

-

Add a new pet to the store

-
-
Request
-
-
POST /pet
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - Pet -

Pet object that needs to be added to the store

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
405 - - -

Invalid input

-
-
-
- - - - | - Improve this Doc - - - View Source - -

updatePet

-

Update an existing pet

-
-
Request
-
-
PUT /pet
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - Pet -

Pet object that needs to be added to the store

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
400 - - -

Invalid ID supplied

-
-
404 - - -

Pet not found

-
-
405 - - -

Validation exception

-
-
-
- - - | - Improve this Doc - - - View Source - -

findPetsByStatus

-

Finds Pets by status

-
-

Multiple status values can be provided with comma separated strings

-
-
Request
-
-
GET /pet/findByStatus?status
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*status - - -

Status values that need to be considered for filter

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - Pet[] -

successful operation

-
-
400 - - -

Invalid status value

-
-
-
- - - | - Improve this Doc - - - View Source - -

findPetsByTags

-

Finds Pets by tags

-
-

Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

-
-
Request
-
-
GET /pet/findByTags?tags
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*tags - - -

Tags to filter by

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - Pet[] -

successful operation

-
-
400 - - -

Invalid tag value

-
-
-
- - - | - Improve this Doc - - - View Source - -

deletePet

-

Deletes a pet

-
-
Request
-
-
DELETE /pet/{petId}
-
-
Parameters
-
- - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
api_key - - -
*petId - - -

Pet id to delete

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
400 - - -

Invalid ID supplied

-
-
404 - - -

Pet not found

-
-
-
- - - | - Improve this Doc - - - View Source - -

getPetById

-

Find pet by ID

-
-

Returns a single pet

-
-
Request
-
-
GET /pet/{petId}
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*petId - - -

ID of pet to return

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - Pet -

successful operation

-
-
400 - - -

Invalid ID supplied

-
-
404 - - -

Pet not found

-
-
-
- - - | - Improve this Doc - - - View Source - -

updatePetWithForm

-

Updates a pet in the store with form data

-
-
Request
-
-
POST /pet/{petId}
-
-
Parameters
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*petId - - -

ID of pet that needs to be updated

-
name - - -

Updated name of the pet

-
status - - -

Updated status of the pet

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
405 - - -

Invalid input

-
-
-
- - - | - Improve this Doc - - - View Source - -

uploadFile

-

uploads an image

-
-
Request
-
-
POST /pet/{petId}/uploadImage
-
-
Parameters
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*petId - - -

ID of pet to update

-
additionalMetadata - - -

Additional data to pass to server

-
file - - -

file to upload

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - ApiResponse -

successful operation

-
-
-
-

store

-

Access to Petstore orders

-
-

Additional description for store tag

-
- - - | - Improve this Doc - - - View Source - -

addPet

-

Add a new pet to the store

-
-
Request
-
-
POST /pet
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - Pet -

Pet object that needs to be added to the store

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
405 - - -

Invalid input

-
-
-
- - - - | - Improve this Doc - - - View Source - -

getInventory

-

Returns pet inventories by status

-
-

Returns a map of status codes to quantities

-
-
Request
-
-
GET /store/inventory
-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - object - -

successful operation

-
-
-
- - - | - Improve this Doc - - - View Source - -

placeOrder

-

Place an order for a pet

-
-
Request
-
-
POST /store/order
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - Order -

order placed for purchasing the pet

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - Order -

successful operation

-
-
400 - - -

Invalid Order

-
-
-
- - - | - Improve this Doc - - - View Source - -

deleteOrder

-

Delete purchase order by ID

-
-

For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors

-
-
Request
-
-
DELETE /store/order/{orderId}
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*orderId - - -

ID of the order that needs to be deleted

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
400 - - -

Invalid ID supplied

-
-
404 - - -

Order not found

-
-
-
- - - | - Improve this Doc - - - View Source - -

getOrderById

-

Find purchase order by ID

-
-

For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions

-
-
Request
-
-
GET /store/order/{orderId}
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*orderId - - -

ID of pet that needs to be fetched

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - Order -

successful operation

-
-
400 - - -

Invalid ID supplied

-
-
404 - - -

Order not found

-
-
-
-

user

-

Operations about user

-
- - - | - Improve this Doc - - - View Source - -

createUser

-

Create user

-
-

This can only be done by the logged in user.

-
-
Request
-
-
POST /user
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - User -

Created user object

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
default - - -

successful operation

-
-
-
- - - | - Improve this Doc - - - View Source - -

createUsersWithArrayInput

-

Creates list of users with given input array

-
-
Request
-
-
POST /user/createWithArray
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - User[] -

List of user object

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
default - - -

successful operation

-
-
-
- - - | - Improve this Doc - - - View Source - -

createUsersWithListInput

-

Creates list of users with given input array

-
-
Request
-
-
POST /user/createWithList
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*body - - User[] -

List of user object

-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
default - - -

successful operation

-
-
-
- - - | - Improve this Doc - - - View Source - -

loginUser

-

Logs user into the system

-
-
Request
-
-
GET /user/login?username&password
-
-
Parameters
-
- - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*username - - -

The user name for login

-
*password - - -

The password for login in clear text

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - string - -

successful operation

-
-
400 - - -

Invalid username/password supplied

-
-
-
- - - | - Improve this Doc - - - View Source - -

logoutUser

-

Logs out current logged in user session

-
-
Request
-
-
GET /user/logout
-
-
-
Responses
-
- - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
default - - -

successful operation

-
-
-
- - - | - Improve this Doc - - - View Source - -

deleteUser

-

Delete user

-
-

This can only be done by the logged in user.

-
-
Request
-
-
DELETE /user/{username}
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*username - - -

The name that needs to be deleted

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
400 - - -

Invalid username supplied

-
-
404 - - -

User not found

-
-
-
- - - | - Improve this Doc - - - View Source - -

getUserByName

-

Get user by user name

-
-
Request
-
-
GET /user/{username}
-
-
Parameters
-
- - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*username - - -

The name that needs to be fetched. Use user1 for testing.

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
200 - - User -

successful operation

-
-
400 - - -

Invalid username supplied

-
-
404 - - -

User not found

-
-
-
-

Other APIs

- - - | - Improve this Doc - - - View Source - -

updateUser

-

Updated user

-
-

This can only be done by the logged in user.

-
-
Request
-
-
PUT /user/{username}
-
-
Parameters
-
- - - - - - - - - - - - - - - - - - - - - - -
NameTypeDefaultNotes
*username - - -

name that need to be updated

-
*body - - User -

Updated user object

-
-
-
Responses
-
- - - - - - - - - - - - - - - - - - - - - - -
Status CodeTypeDescriptionSamples
400 - - -

Invalid user supplied

-
-
404 - - -

User not found

-
-
-
-

Definitions

- -

Pet

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeNotes
category - - Category[] -
id - integer - (int64) - -
name - string - -
photoUrls - array - -
status - string - -

pet status in the store

-
tags - - Tag[] -
- -

Category

-
- - - - - - - - - - - - - - - - - - - -
NameTypeNotes
id - integer - (int64) - -
name - string - -
- -

Tag

-
- - - - - - - - - - - - - - - - - - - -
NameTypeNotes
id - integer - (int64) - -
name - string - -
- -

ApiResponse

-
- - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeNotes
code - integer - (int32) - -
message - string - -
type - string - -
- -

Order

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeNotes
complete - boolean - -
id - integer - (int64) - -
petId - integer - (int64) - -
quantity - integer - (int32) - -
shipDate - string - (date-time) - -
status - string - -

Order Status

-
- -

User

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeNotes
email - string - -
firstName - string - -
id - integer - (int64) - -
lastName - string - -
password - string - -
phone - string - -
userStatus - integer - (int32) - -

User Status

-
username - string - -
- -
- - - - -
- - -
- -
- -
-
-
- Made with docfx -
-
-
- - - \ No newline at end of file diff --git a/test/docfx.Snapshot.Tests/SamplesTest.cs b/test/docfx.Snapshot.Tests/SamplesTest.cs index 9f256cbbaa9..a08f28ef6f3 100644 --- a/test/docfx.Snapshot.Tests/SamplesTest.cs +++ b/test/docfx.Snapshot.Tests/SamplesTest.cs @@ -1,19 +1,13 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Concurrent; using System.Diagnostics; -using System.Net.NetworkInformation; using System.Text; using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; -using System.Text.RegularExpressions; -using Docfx.Common; using Docfx.Dotnet; -using ImageMagick; -using Microsoft.Playwright; using UglyToad.PdfPig; using UglyToad.PdfPig.Actions; using UglyToad.PdfPig.Annotations; @@ -34,29 +28,8 @@ public SnapshotFactAttribute() private static readonly string s_samplesDir = Path.GetFullPath("../../../../../samples"); - private static readonly string[] s_screenshotUrls = new[] - { - "index.html", - "articles/markdown.html?tabs=windows%2Ctypescript#markdown-extensions", - "articles/csharp_coding_standards.html", - "api/BuildFromProject.Class1.html", - "api/CatLibrary.html", - "api/CatLibrary.html?term=cat", - "api/CatLibrary.Cat-2.html?q=cat", - "restapi/petstore.html", - }; - - private static readonly (int width, int height, string theme, bool fullPage)[] s_viewports = new[] - { - (1920, 1080, "light", true), - (1152, 648, "light", false), - (768, 600, "dark", false), - (375, 812, "dark", true), - }; - static SamplesTest() { - Microsoft.Playwright.Program.Main(new[] { "install", "chromium" }); Process.Start("dotnet", $"build \"{s_samplesDir}/seed/dotnet/assembly/BuildFromAssembly.csproj\"").WaitForExit(); } @@ -123,114 +96,6 @@ object ToBookmarks(IEnumerable nodes) } } - [SnapshotFact] - public async Task SeedHtml() - { - if (!OperatingSystem.IsLinux()) - return; - - var samplePath = $"{s_samplesDir}/seed"; - Clean(samplePath); - - var docfxPath = Path.GetFullPath(OperatingSystem.IsWindows() ? "docfx.exe" : "docfx"); - Assert.Equal(0, Exec(docfxPath, $"metadata {samplePath}/docfx.json")); - Assert.Equal(0, Exec(docfxPath, $"build {samplePath}/docfx.json")); - - const int port = 8089; - var _ = Task.Run(() => Program.Main(new[] { "serve", "--port", $"{port}", $"{samplePath}/_site" })) - .ContinueWith(x => - { - Logger.LogError("Failed to run `dotnet serve` command. " + x.Exception.ToString()); - }, TaskContinuationOptions.OnlyOnFaulted); - - // Wait until web server started. - bool isStarted = SpinWait.SpinUntil(() => { Thread.Sleep(100); return IsActiveLocalTcpPort(port); }, TimeSpan.FromSeconds(10)); - - using var playwright = await Playwright.CreateAsync(); - var browser = await playwright.Chromium.LaunchAsync(); - var htmlUrls = new ConcurrentDictionary(); - - await Parallel.ForEachAsync(s_viewports, async (viewport, _) => - { - var (width, height, theme, fullPage) = viewport; - var isMobile = width < 500; - var page = await browser.NewPageAsync(new() - { - ViewportSize = new() { Width = width, Height = height }, - IsMobile = isMobile, - HasTouch = isMobile, - ReducedMotion = ReducedMotion.Reduce, - }); - - foreach (var url in s_screenshotUrls) - { - await page.GotoAsync($"http://localhost:{port}/{url}"); - await page.WaitForFunctionAsync("window.docfx.ready"); - await page.WaitForFunctionAsync("window.docfx.searchReady"); - await page.EvaluateAsync($"() => document.documentElement.setAttribute('data-bs-theme', '{theme}')"); - await Task.Delay(200); - - if (url.Contains("?term=cat")) - { - if (isMobile) - { - await (await page.QuerySelectorAsync("[data-bs-target='#navpanel']")).ClickAsync(); - await page.WaitForSelectorAsync("#navpanel.show"); - } - - await (await page.QuerySelectorAsync("#search-query")).FillAsync("cat"); - await page.WaitForFunctionAsync("window.docfx.searchResultReady"); - } - - var directory = $"{nameof(SamplesTest)}.{nameof(SeedHtml)}/{width}x{height}"; - var fileName = $"{Regex.Replace(url, "[^a-zA-Z0-9-_.]", "-")}"; - - // Verify HTML files once - if (theme is "light" && htmlUrls.TryAdd(url, url)) - { - var html = await page.ContentAsync(); - await - Verify(new Target("html", NormalizeHtml(html))) - .UseDirectory($"{nameof(SamplesTest)}.{nameof(SeedHtml)}/html") - .UseFileName(fileName) - .AutoVerify(includeBuildServer: false); - } - - var bytes = await page.ScreenshotAsync(new() { FullPage = fullPage }); - await - Verify(new Target("png", new MemoryStream(bytes))) - .UseStreamComparer((received, verified, _) => CompareImage(received, verified, fileName)) - .UseDirectory(directory) - .UseFileName(fileName) - .AutoVerify(includeBuildServer: false); - } - - await page.CloseAsync(); - }); - - static Task CompareImage(Stream received, Stream verified, string fileName) - { - using var receivedImage = new MagickImage(received); - using var verifiedImage = new MagickImage(verified); - using var diffImage = new MagickImage(); - var diff = receivedImage.Compare(verifiedImage, ErrorMetric.Fuzz, diffImage); - if (diff <= 0.001) - { - return Task.FromResult(CompareResult.Equal); - } - - return Task.FromResult(CompareResult.NotEqual($"Image diff: {diff}")); - } - - static string NormalizeHtml(string html) - { - html = Regex.Replace(html, "", ""); - html = Regex.Replace(html, @"mermaid-\d+", ""); - html = Regex.Replace(html, @"flowchart-\w+-\d", ""); - return html; - } - } - [SnapshotFact] public async Task SeedMarkdown() { @@ -323,11 +188,4 @@ private void ScrubFile(string path, StringBuilder builder) })); } } - - private static bool IsActiveLocalTcpPort(int port) - { - var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); - var tcpConnInfoArray = ipGlobalProperties.GetActiveTcpListeners(); - return tcpConnInfoArray.Any(x => x.Port == port); - } } diff --git a/test/docfx.Snapshot.Tests/docfx.Snapshot.Tests.csproj b/test/docfx.Snapshot.Tests/docfx.Snapshot.Tests.csproj index 3c1f7ebca4d..24c17a9ecf2 100644 --- a/test/docfx.Snapshot.Tests/docfx.Snapshot.Tests.csproj +++ b/test/docfx.Snapshot.Tests/docfx.Snapshot.Tests.csproj @@ -1,6 +1,5 @@ -