Example #1
0
 TempRepoContext(Reference tempBranchReference, string tempBranchName, string tempBranchRefName, VerifyBase verifyBase)
 {
     this.tempBranchReference = tempBranchReference;
     TempBranchName           = tempBranchName;
     this.tempBranchRefName   = tempBranchRefName;
     this.verifyBase          = verifyBase;
 }
Example #2
0
    public static Task VerifySnippets(
        this VerifyBase verifyBase,
        string markdownContent,
        List <Snippet> availableSnippets,
        List <string> snippetSourceFiles,
        IReadOnlyList <Include>?includes = null)
    {
        if (includes == null)
        {
            includes = Array.Empty <Include>();
        }

        var markdownProcessor = new MarkdownProcessor(
            snippets: availableSnippets.ToDictionary(),
            appendSnippetGroup: SimpleSnippetMarkdownHandling.AppendGroup,
            snippetSourceFiles: snippetSourceFiles,
            tocLevel: 2,
            writeHeader: true,
            includes: includes,
            rootDirectory: "c:/root");
        var stringBuilder = new StringBuilder();

        using var reader = new StringReader(markdownContent);
        using var writer = new StringWriter(stringBuilder);
        var processResult = markdownProcessor.Apply(reader, writer, "sourceFile");
        var output        = new
        {
            processResult.MissingSnippets,
            processResult.UsedSnippets,
            content = stringBuilder.ToString()
        };

        return(verifyBase.Verify(output));
    }
Example #3
0
        public static Task VerifyCSharp(this string s, VerifyBase verifyBase)
        {
            var verifySettings = new VerifySettings();

            verifySettings.UseExtension("cs");

            return(verifyBase.Verify(s, verifySettings));
        }
Example #4
0
    public static async Task <TempRepoContext> Create(string tempBranchName, VerifyBase verifyBase)
    {
        var newReference = new NewReference($"refs/heads/{tempBranchName}", "af72f8e44eb53d26969b1316491a294f3401f203");

        await Client.DeleteBranch(tempBranchName);

        var tempBranchReference = await Client.GitHubClient.Git.Reference.Create("SimonCropp", "GitHubSync.TestRepository", newReference);

        return(new TempRepoContext(tempBranchReference, tempBranchName, $"refs/heads/{tempBranchName}", verifyBase));
    }
Example #5
0
 public static async Task Verify(this IGremlinQueryBase query, VerifyBase verifyBase)
 {
     await verifyBase.Verify(
         JsonConvert.SerializeObject(
             await query
             .Cast <object>()
             .ToArrayAsync(),
             Formatting.Indented),
         Settings);
 }