Ejemplo n.º 1
0
    static Tests()
    {
        BuildServerDetector.Detected = false;
        DiffRunner.Disabled          = 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);

        VerifierSettings.RegisterFileConverter <TypeToSplit>(
            (split, _) => new ConversionResult(
                split.Info,
                new List <Target>
        {
            new("txt", split.Property1),
            new("txt", split.Property2)
        }));
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 static DiffRunnerTests()
 {
     tool = DiffTools.AddTool(
         name: "FakeDiffTool",
         autoRefresh: true,
         isMdi: false,
         supportsText: true,
         requiresTarget: true,
         arguments: (path1, path2) => $"\"{path1}\" \"{path2}\"",
         exePath: FakeDiffTool.Exe,
         binaryExtensions: new[] { "knownBin" }) !;
 }
Ejemplo n.º 4
0
    public void OrderShouldNotMessWithAddTool()
    {
        string diffToolPath = FakeDiffTool.Exe;
        var    resolvedTool = DiffTools.AddTool(
            name: "MyCustomDiffTool",
            autoRefresh: true,
            isMdi: false,
            supportsText: true,
            requiresTarget: true,
            arguments: (tempFile, targetFile) => $"\"{tempFile}\" \"{targetFile}\"",
            exePath: diffToolPath,
            binaryExtensions: Enumerable.Empty <string>()) !;

        DiffTools.UseOrder(DiffTool.VisualStudio, DiffTool.AraxisMerge);
        Assert.Equal(resolvedTool.Name, DiffTools.Resolved.First().Name);
        Assert.True(DiffTools.TryFind("txt", out var forExtension));
        Assert.Equal(resolvedTool.Name, forExtension !.Name);
    }
Ejemplo n.º 5
0
    public void AddTool()
    {
        string diffToolPath = FakeDiffTool.Exe;

        #region AddTool
        var resolvedTool = DiffTools.AddTool(
            name: "MyCustomDiffTool",
            autoRefresh: true,
            isMdi: false,
            supportsText: true,
            requiresTarget: true,
            arguments: (tempFile, targetFile) => $"\"{tempFile}\" \"{targetFile}\"",
            exePath: diffToolPath,
            binaryExtensions: new[] { "jpg" }) !;
        #endregion
        Assert.Equal(resolvedTool.Name, DiffTools.Resolved.First().Name);
        Assert.True(DiffTools.TryFind("jpg", out var forExtension));
        Assert.Equal(resolvedTool.Name, forExtension !.Name);
    }
Ejemplo n.º 6
0
    public void LaunchAndKill()
    {
        if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            return;
        }
        DiffTools.AddTool(
            name: "FakeDiffTool",
            autoRefresh: true,
            isMdi: false,
            supportsText: true,
            requiresTarget: true,
            arguments: (path1, path2) => $"\"{path1}\" \"{path2}\"",
            exePath: FakeDiffTool.Exe,
            binaryExtensions: new[] { "knownBin" });
        var tempFile   = Path.Combine(SourceDirectory, "DiffRunner.file1.txt");
        var targetFile = Path.Combine(SourceDirectory, "DiffRunner.file2.txt");

        DiffRunner.Launch(tempFile, targetFile);
        Assert.True(IsRunning());
        ProcessCleanup.Refresh();
        DiffRunner.Kill(tempFile, targetFile);
        Assert.False(IsRunning());
    }