Ejemplo n.º 1
0
        public static Task AddDeleteAsync(string file, CancellationToken cancellation = default)
        {
            if (!IsRunning)
            {
                return(Task.CompletedTask);
            }

            return(PiperClient.SendDeleteAsync(file, cancellation));
        }
Ejemplo n.º 2
0
        public static void AddDelete(string file)
        {
            if (!IsRunning)
            {
                return;
            }

            PiperClient.SendDelete(file);
        }
Ejemplo n.º 3
0
 public Task MoveJson() =>
 Verify(
     PiperClient.BuildMovePayload(
         "theTempFilePath",
         "theTargetFilePath",
         "theExePath",
         "TheArguments",
         true,
         1000));
Ejemplo n.º 4
0
    public async Task Move()
    {
        MovePayload received = null !;
        var         source   = new CancellationTokenSource();
        var         task     = PiperServer.Start(s => received = s, s => { }, source.Token);
        await PiperClient.SendMoveAsync("Foo", "Bar", "theExe", "TheArguments \"s\"", true, 10, source.Token);

        await Task.Delay(1000);

        source.Cancel();
        await task;
        await Verifier.Verify(received);
    }
Ejemplo n.º 5
0
    public async Task Delete()
    {
        DeletePayload received = null !;
        var           source   = new CancellationTokenSource();
        //var task = PiperServer.Start(s => { }, s => received = s, source.Token);
        await PiperClient.SendDeleteAsync("Foo", source.Token);

        await Task.Delay(1000);

        source.Cancel();
        //await task;
        await Verifier.Verify(received);
    }
Ejemplo n.º 6
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.º 7
0
        public static Task AddMoveAsync(
            string tempFile,
            string targetFile,
            string?exe,
            string?arguments,
            bool canKill,
            int?processId,
            CancellationToken cancellation = default)
        {
            if (!IsRunning)
            {
                return(Task.CompletedTask);
            }

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

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

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

            await PiperClient.SendDeleteAsync(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);
    }