Esempio n. 1
0
        private async Task ConnectAndMakeTashRegistrationAsync()
        {
            var tashErrorsAndInfos = await TashAccessor.EnsureTashAppIsRunningAsync();

            if (tashErrorsAndInfos.AnyErrors())
            {
                MessageBox.Show(string.Join("\r\n", tashErrorsAndInfos.Errors), Properties.Resources.CouldNotConnectToTash, MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }

            var statusCode = await TashAccessor.PutControllableProcessAsync(Process.GetCurrentProcess());

            if (statusCode != HttpStatusCode.Created)
            {
                MessageBox.Show(string.Format(Properties.Resources.CouldNotMakeTashRegistration, statusCode.ToString()), Properties.Resources.TashHostWindowTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }
Esempio n. 2
0
    public async Task CanPutAndGetControllableProcess()
    {
        await LaunchTashAppIfNotRunning();

        var currentProcess = Process.GetCurrentProcess();
        var statusCode     = await _Sut.PutControllableProcessAsync(currentProcess);

        Assert.IsTrue(statusCode == HttpStatusCode.Created || statusCode == HttpStatusCode.NoContent);
        var process = await _Sut.GetControllableProcessAsync(currentProcess.Id);

        Assert.IsNotNull(process);
        Assert.AreEqual(currentProcess.ProcessName, process.Title);
    }