Example #1
0
        public static void Commander() => Describe(nameof(TastyCommander), () =>
        {
            (Uri connectionString, TastyScope scope, TastyCommander commander, AsyncTestReporter reporter)CreateRemote()
            {
                var connectionString = InMemoryConnectionStringBuilder.CreateNewConnection();

                var scope = new TastyScope()
                {
                    LoadPlugins    = false,
                    ClearBeforeRun = false,
                    //This would block the interactive run
                    IsInteractiveRunHook = () => Task.FromResult(false)
                }
                .UseInMemoryTransport()
                .UseRemoteReporter();

                scope.It("A test case", () => true);
                scope.ParseConnectionString = () => TastyRemoteDefaults.ParseConnectionString(connectionString.ToString());

                var commander = new TastyCommander()
                {
                    LoadPlugins = false
                }
                .UseInMemoryTransport();

                var reporter = A.Fake <AsyncTestReporter>();
                commander.RegisterReporter(reporter);

                return(connectionString, scope, commander, reporter);
            }

            It("Remote scope will be executed", async() =>
            {
                var(connectionString, scope, commander, reporter) = CreateRemote();
                var remote = commander.ConnectToRemote(connectionString);

                var runner = scope.Run();

                await Task.WhenAll(remote, runner);

                A.CallTo(reporter).MustHaveHappened();
            });

            It("Remote scope succeeds with non zero exit code", async() =>
            {
Example #2
0
 public static TastyCommander Use(TastyCommander commander)
 {
     UseCommanderWasCalled = true;
     return(commander);
 }
Example #3
0
 private static Task WaitForInput(IList <SerializableTastyCommand> commands, TastyCommander commander)
 => Promise(async(resolve) =>