public Task DecompileExample() { var decompile = Ildasm.Decompile(testResult.AssemblyPath, "AssemblyToProcess.Example"); var settings = new VerifySettings(); settings.AutoVerify(); return(Verifier.Verify(decompile, settings)); }
void AutoVerify() { #region AutoVerify var settings = new VerifySettings(); settings.AutoVerify(); #endregion }
static async Task RunTest( string extension, Func <object> initialTarget, Func <object> secondTarget, bool hasMatchingDiffTool, bool hasExistingReceived, bool autoVerify, VerifySettings settings, string uniqueTestName) { settings.UseExtension(extension); if (autoVerify) { settings.AutoVerify(); } var projectDirectory = AttributeReader.GetProjectDirectory(); var prefix = Path.Combine(projectDirectory, uniqueTestName); var danglingFile = Path.Combine(projectDirectory, $"{prefix}.01.verified.{extension}"); FilePair file = new(extension, prefix); DeleteAll(danglingFile, file.Verified, file.Received); await File.WriteAllTextAsync(danglingFile, ""); if (hasExistingReceived) { await File.WriteAllTextAsync(file.Received, ""); } FileNameBuilder.ClearPrefixList(); await InitialVerify(initialTarget, hasMatchingDiffTool, settings, file); if (!autoVerify) { RunClipboardCommand(); } AssertNotExists(danglingFile); FileNameBuilder.ClearPrefixList(); await ReVerify(initialTarget, settings, file); FileNameBuilder.ClearPrefixList(); await InitialVerify(secondTarget, hasMatchingDiffTool, settings, file); if (!autoVerify) { RunClipboardCommand(); } FileNameBuilder.ClearPrefixList(); await ReVerify(secondTarget, settings, file); }
async Task RunSplitTest( TypeToSplit initialTarget, TypeToSplit secondTarget, bool hasMatchingDiffTool, bool hasExistingReceived, bool autoVerify) { var settings = new VerifySettings(); if (autoVerify) { settings.AutoVerify(); } var prefix = Path.Combine(SourceDirectory, $"{Context.UniqueTestName}."); var danglingFile = $"{prefix}03.verified.txt"; var info = new FilePair("txt", $"{prefix}info"); var file1 = new FilePair("txt", $"{prefix}00"); var file2 = new FilePair("txt", $"{prefix}01"); DeleteAll(danglingFile, info.Received, info.Verified, file1.Verified, file1.Received, file2.Verified, file2.Received); File.WriteAllText(danglingFile, ""); if (hasExistingReceived) { File.WriteAllText(info.Received, ""); File.WriteAllText(file1.Received, ""); File.WriteAllText(file2.Received, ""); } await InitialVerifySplit(initialTarget, hasMatchingDiffTool, settings, info, file1, file2); if (!autoVerify) { RunClipboardCommand(); } AssertNotExists(danglingFile); await ReVerifySplit(initialTarget, settings, info, file1, file2); await InitialVerifySplit(secondTarget, hasMatchingDiffTool, settings, info, file1, file2); if (!autoVerify) { RunClipboardCommand(); } await ReVerifySplit(secondTarget, settings, info, file1, file2); }
public async Task Split( bool hasExistingReceived, bool autoVerify) { var initialTarget = new TypeToSplit("info1", "value1", "value2"); var secondTarget = new TypeToSplit("info2", "value1.1", "value2.1"); var settings = new VerifySettings(); if (autoVerify) { settings.AutoVerify(); } var uniqueTestName = TestNameBuilder.GetUniqueTestName("Tests_Split", Info.OfMethod <Tests>("Split"), new object[] { hasExistingReceived, autoVerify }); settings.UseParameters(hasExistingReceived, autoVerify); var prefix = Path.Combine(SourceDirectory, $"{uniqueTestName}."); var danglingFile = $"{prefix}03.verified.txt"; var info = new FilePair("txt", $"{prefix}info"); var file1 = new FilePair("txt", $"{prefix}00"); var file2 = new FilePair("txt", $"{prefix}01"); DeleteAll(danglingFile, info.Received, info.Verified, file1.Verified, file1.Received, file2.Verified, file2.Received); File.WriteAllText(danglingFile, ""); if (hasExistingReceived) { File.WriteAllText(info.Received, ""); File.WriteAllText(file1.Received, ""); File.WriteAllText(file2.Received, ""); } await InitialVerifySplit(initialTarget, true, settings, info, file1, file2); if (!autoVerify) { RunClipboardCommand(); } AssertNotExists(danglingFile); await ReVerifySplit(initialTarget, settings, info, file1, file2); await InitialVerifySplit(secondTarget, true, settings, info, file1, file2); if (!autoVerify) { RunClipboardCommand(); } await ReVerifySplit(secondTarget, settings, info, file1, file2); }
public MenuBuilderTest(ITestOutputHelper output) : base(output) { settings = new VerifySettings(); settings.AutoVerify(); file1 = "file1.txt"; file2 = "file2.txt"; file3 = "file3.txt"; file4 = "file4.txt"; File.WriteAllText(file1, ""); File.WriteAllText(file2, ""); File.WriteAllText(file3, ""); File.WriteAllText(file4, ""); }
async Task RunTest( string extension, Func <object> initialTarget, Func <object> secondTarget, bool hasMatchingDiffTool, bool hasExistingReceived, bool autoVerify) { var settings = new VerifySettings(); settings.UseExtension(extension); if (autoVerify) { settings.AutoVerify(); } var prefix = Path.Combine(SourceDirectory, $"{Context.UniqueTestName}"); var danglingFile = Path.Combine(SourceDirectory, $"{prefix}.01.verified.{extension}"); var file = new FilePair(extension, prefix); DeleteAll(danglingFile, file.Verified, file.Received); File.WriteAllText(danglingFile, ""); if (hasExistingReceived) { File.WriteAllText(file.Received, ""); } await InitialVerify(initialTarget, hasMatchingDiffTool, settings, file); if (!autoVerify) { RunClipboardCommand(); } AssertNotExists(danglingFile); await ReVerify(initialTarget, settings, file); await InitialVerify(secondTarget, hasMatchingDiffTool, settings, file); if (!autoVerify) { RunClipboardCommand(); } await ReVerify(secondTarget, settings, file); }
public async Task AutoVerifyMissing() { var received = Path.Combine(SourceDirectory, $"Tests.AutoVerifyMissing.{Namer.Runtime}.received.txt"); var verified = Path.Combine(SourceDirectory, $"Tests.AutoVerifyMissing.{Namer.Runtime}.verified.txt"); File.Delete(received); File.Delete(verified); var settings = new VerifySettings(); settings.AutoVerify(); settings.UniqueForRuntime(); await Verify("content", settings); Assert.False(File.Exists(received), received); Assert.True(File.Exists(verified), verified); }
public async Task Split( bool hasExistingReceived, bool autoVerify) { TypeToSplit initialTarget = new("info1", "value1", "value2"); TypeToSplit secondTarget = new("info2", "value1.1", "value2.1"); var settings = new VerifySettings(); if (autoVerify) { settings.AutoVerify(); } var method = GetType().GetMethod("Split") !; var concat = ParameterBuilder.Concat(method, new object[] { hasExistingReceived, autoVerify }); var uniqueTestName = $"Tests.Split_{concat}"; settings.UseParameters(hasExistingReceived, autoVerify); var prefix = Path.Combine(AttributeReader.GetProjectDirectory(), $"{uniqueTestName}."); var danglingFile = $"{prefix}03.verified.txt"; FilePair file0 = new("txt", $"{prefix}00"); FilePair file1 = new("txt", $"{prefix}01"); FilePair file2 = new("txt", $"{prefix}02"); DeleteAll(danglingFile, file0.Received, file0.Verified, file1.Verified, file1.Received, file2.Verified, file2.Received); await File.WriteAllTextAsync(danglingFile, ""); if (hasExistingReceived) { await File.WriteAllTextAsync(file0.Received, ""); await File.WriteAllTextAsync(file1.Received, ""); await File.WriteAllTextAsync(file2.Received, ""); } FileNameBuilder.ClearPrefixList(); await InitialVerifySplit(initialTarget, true, settings, file0, file1, file2); if (!autoVerify) { RunClipboardCommand(); } AssertNotExists(danglingFile); FileNameBuilder.ClearPrefixList(); await ReVerifySplit(initialTarget, settings, file0, file1, file2); FileNameBuilder.ClearPrefixList(); await InitialVerifySplit(secondTarget, true, settings, file0, file1, file2); if (!autoVerify) { RunClipboardCommand(); } FileNameBuilder.ClearPrefixList(); await ReVerifySplit(secondTarget, settings, file0, file1, file2); }