public IEnumerator CanValidateAccessToken()
        {
            using (var test = StartTest())
                using (var processServer = new TestProcessServer(test.TaskManager, test.Environment,
                                                                 test.Configuration))
                {
                    var connectTask = processServer.Connect();
                    foreach (var frame in WaitForCompletion(connectTask))
                    {
                        yield return(frame);
                    }

                    var stopTask = processServer.Server.Stop("INVALID_ACCESS_TOKEN");
                    foreach (var frame in WaitForCompletion(stopTask))
                    {
                        yield return(frame);
                    }

                    Assert.True(stopTask.Status == TaskStatus.Faulted, "Server accepted invalid access token");
                }
        }
        public IEnumerator CanStartAndShutdown()
        {
            using (var test = StartTest())
                using (var processServer = new TestProcessServer(test.TaskManager, test.Environment,
                                                                 test.Configuration))
                {
                    var connectTask = processServer.Connect();
                    foreach (var frame in WaitForCompletion(connectTask))
                    {
                        yield return(frame);
                    }

                    var shutdownTask = processServer.Shutdown();
                    var wait         = Task.WhenAny(shutdownTask, Task.Delay(2000));
                    foreach (var frame in WaitForCompletion(wait))
                    {
                        yield return(frame);
                    }

                    Assert.True(wait.Result == shutdownTask, "Server did not shutdown on time");
                }
        }