public async Task MaxInstancesToLaunchAsync() { DiffRunner.MaxInstancesToLaunch(1); try { await Task.Delay(500); ProcessCleanup.Refresh(); var result = await DiffRunner.LaunchAsync(file1, "fake.txt"); await Task.Delay(300); Assert.Equal(LaunchResult.StartedNewInstance, result); ProcessCleanup.Refresh(); result = await DiffRunner.LaunchAsync(file2, "fake.txt"); Assert.Equal(LaunchResult.TooManyRunningDiffTools, result); ProcessCleanup.Refresh(); DiffRunner.Kill(file1, "fake.txt"); DiffRunner.Kill(file2, "fake.txt"); } finally { DiffRunner.MaxInstancesToLaunch(5); } }
static Tests() { BuildServerDetector.Detected = false; DiffTools.AddTool( name: "MyTools", autoRefresh: true, isMdi: false, supportsText: true, requiresTarget: true, arguments: (path1, path2) => $"\"{path1}\" \"{path2}\"", exePath: diffToolPath, binaryExtensions: new[] { "knownBin" }); var binPath = AllFiles.Files["jpg"]; var newPath = Path.ChangeExtension(binPath.Path, "knownBin"); File.Copy(binPath.Path, newPath, true); AllFiles.UseFile(Category.Image, newPath); SharedVerifySettings.RegisterFileConverter <TypeToSplit>( "txt", (split, settings) => new ConversionResult( split.Info, new List <Stream> { new MemoryStream(FileHelpers.Utf8NoBOM.GetBytes(split.Property1)), new MemoryStream(FileHelpers.Utf8NoBOM.GetBytes(split.Property2)) })); DiffRunner.MaxInstancesToLaunch(int.MaxValue); }
public void MaxInstancesToLaunch() { #region MaxInstancesToLaunch DiffRunner.MaxInstancesToLaunch(10); #endregion }
static Tests() { BuildServerDetector.Detected = false; var diffToolPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../../FakeDiffTool/bin/FakeDiffTool.exe")); tool = new ResolvedDiffTool( name: DiffTool.VisualStudio, exePath: diffToolPath, buildArguments: (path1, path2) => $"\"{path1}\" \"{path2}\"", isMdi: false, supportsAutoRefresh: true, binaryExtensions: new string[] {}); DiffTools.ResolvedDiffTools = new List <ResolvedDiffTool> { tool }; DiffTools.ExtensionLookup = new Dictionary <string, ResolvedDiffTool> { { "txt", tool }, { "knownBin", tool }, }; var binPath = AllFiles.Files["jpg"]; AllFiles.Files = new Dictionary <string, EmptyFile> { { "knownBin", binPath }, }; SharedVerifySettings.RegisterFileConverter <TypeToSplit>( "txt", (split, settings) => new ConversionResult( split.Info, new List <Stream> { new MemoryStream(Encoding.UTF8.GetBytes(split.Property1)), new MemoryStream(Encoding.UTF8.GetBytes(split.Property2)) })); DiffRunner.MaxInstancesToLaunch(uint.MaxValue); }
static SharedVerifySettings() { DiffRunner.MaxInstancesToLaunch(5); }