Ejemplo n.º 1
0
    public async Task Move()
    {
        MovePayload received = null !;
        var         source   = new CancellationTokenSource();
        var         task     = PiperServer.Start(s => received = s, s => { }, source.Token);
        await PiperClient.SendMove("Foo", "Bar", "theExe", "TheArguments \"s\"", true, 10, source.Token);

        await Task.Delay(1000);

        source.Cancel();
        await task;
        await Verifier.Verify(received);
    }
Ejemplo n.º 2
0
        public static void AddMove(
            string tempFile,
            string targetFile,
            string?exe,
            string?arguments,
            bool canKill,
            int?processId)
        {
            if (!IsRunning)
            {
                return;
            }

            PiperClient.SendMove(tempFile, targetFile, exe, arguments, canKill, processId);
        }
Ejemplo n.º 3
0
        public static Task AddMove(
            string tempFile,
            string targetFile,
            string exe,
            string arguments,
            bool canKill,
            int?processId,
            CancellationToken cancellation = default)
        {
            if (!IsRunning)
            {
                return(Task.CompletedTask);
            }

            return(PiperClient.SendMove(tempFile, targetFile, exe, arguments, canKill, processId, cancellation));
        }
Ejemplo n.º 4
0
    public async Task SendOnly()
    {
        var file = Path.GetFullPath("temp.txt");

        File.Delete(file);
        await File.WriteAllTextAsync(file, "a");

        try
        {
            await PiperClient.SendMove(file, file, "theExe", "TheArguments \"s\"", true, 10, null);

            await PiperClient.SendDelete(file);
        }
        catch (InvalidOperationException)
        {
        }

        var settings = new VerifySettings();

        settings.ScrubLinesContaining("temp.txt");
        //TODO: add "scrub source dir" to verify and remove the below
        settings.ScrubLinesContaining("PiperClient");
        await Verifier.Verify(Logs, settings);
    }