public ApiApprovalTests() : base() { verifySettings = new VerifySettings(); verifySettings.UseExtension("cs"); VerifierSettings.OnVerifyMismatch((filePair, message) => DiffPlexReporter.Report(filePair.Received, filePair.Verified, message)); }
public async Task OnHandlersSample() { VerifierSettings.OnFirstVerify( receivedFile => { Debug.WriteLine(receivedFile); return(Task.CompletedTask); }); VerifierSettings.OnVerifyMismatch( (filePair, message) => { Debug.WriteLine(filePair.Received); Debug.WriteLine(filePair.Verified); Debug.WriteLine(message); return(Task.CompletedTask); }); await Verifier.Verify("value"); }
public async Task OnVerifyMismatch() { var onFirstVerifyCalled = false; var onVerifyMismatchCalled = false; VerifierSettings.OnFirstVerify( filePair => { if (filePair.Name.Contains("OnVerifyMismatch")) { onFirstVerifyCalled = true; } return(Task.CompletedTask); }); VerifierSettings.OnVerifyMismatch( (filePair, _) => { if (filePair.Name.Contains("OnVerifyMismatch")) { Assert.NotEmpty(filePair.Received); Assert.NotNull(filePair.Received); Assert.NotEmpty(filePair.Verified); Assert.NotNull(filePair.Verified); onVerifyMismatchCalled = true; } return(Task.CompletedTask); }); await Assert.ThrowsAsync <Exception>( async() => { DiffRunner.Disabled = true; await Verifier.Verify("value"); }); DiffRunner.Disabled = false; Assert.False(onFirstVerifyCalled); Assert.True(onVerifyMismatchCalled); }
public Task OnHandlersSample() { VerifierSettings.OnVerify( before: () => { Debug.WriteLine("before"); }, after: () => { Debug.WriteLine("after"); }); VerifierSettings.OnFirstVerify( receivedFile => { Debug.WriteLine(receivedFile); return(Task.CompletedTask); }); VerifierSettings.OnVerifyMismatch( (filePair, message) => { Debug.WriteLine(filePair.Received); Debug.WriteLine(filePair.Verified); Debug.WriteLine(message); return(Task.CompletedTask); }); return(Verifier.Verify("value")); }