Beispiel #1
0
    public async Task Static()
    {
        VerifierSettings.RegisterComparer("staticComparerExt", Compare);
        VerifySettings settings = new();

        settings.UseExtension("staticComparerExt");
        await Verifier.Verify("TheText", settings);

        await Verifier.Verify("thetext", settings);
    }
Beispiel #2
0
    public async Task StaticComparer()
    {
        #region StaticComparer
        VerifierSettings.RegisterComparer(
            extension: "png",
            compare: CompareImages);
        await Verifier.VerifyFile("TheImage.png");

        #endregion
    }
Beispiel #3
0
    public async Task SettingsArePassed()
    {
        VerifierSettings.RegisterComparer(
            "SettingsArePassed",
            (_, _, _) => Task.FromResult(new CompareResult(true)));
        VerifySettings settings = new();

        settings.UseExtension("SettingsArePassed");
        await Verifier.Verify(new MemoryStream(new byte[] { 1 }), settings)
        .UseExtension("SettingsArePassed");
    }
Beispiel #4
0
    public async Task Static_with_message()
    {
        VerifierSettings.RegisterComparer("staticComparerExtMessage", CompareWithMessage);
        VerifySettings settings = new();

        settings.UseExtension("staticComparerExtMessage");
        settings.DisableDiff();
        settings.DisableClipboard();
        var exception = await Assert.ThrowsAsync <Exception>(() => Verifier.Verify("TheText", settings));

        Assert.Contains("theMessage", exception.Message);
    }
Beispiel #5
0
    public async Task SettingsArePassed()
    {
        VerifySettings?fromGlobal = null;

        VerifierSettings.RegisterComparer(
            "SettingsArePassed",
            (verifySettings, received, verified) =>
        {
            fromGlobal = verifySettings;
            return(Task.FromResult(new CompareResult(true)));
        });
        var settings = new VerifySettings();

        settings.UseExtension("SettingsArePassed");
        await Verifier.Verify(new MemoryStream(new byte[] { 1 }), settings);

        Assert.Same(fromGlobal, settings);
    }