public void Init_Waits_UntilUpTestIsTrue()
        {
            var compose = new Mock <IDockerCompose>();

            compose.Setup(c => c.PauseMs).Returns(NumberOfMsInOneSec);
            compose.Setup(c => c.Up()).Returns(Task.Delay(5000));
            compose.Setup(c => c.Ps())
            .Returns(new[] { "--------", " Up ", " Up " });
            const string successText = "Everything is up";

            var logger = new ListLogger();
            var task   = new Task(() =>
                                  new DockerFixture(null)
                                  .Init(new[] { Path.GetTempFileName() }, "up", "down", 120,
                                        outputLinesFromUp => outputLinesFromUp.Contains(successText),
                                        compose.Object, new [] { logger }));

            task.Start();
            Thread.Sleep(100);
            logger.OnNext("foo");
            logger.OnNext(successText);
            task.Wait();

            compose.Verify(c => c.Init(It.IsAny <string>(), "up", "down"), Times.Once);
            compose.Verify(c => c.Up(), Times.Once);
        }
        public void Init_Throws_IfTestIsNeverTrue()
        {
            var compose = new Mock <IDockerCompose>();

            compose.Setup(c => c.PauseMs).Returns(NumberOfMsInOneSec);
            compose.Setup(c => c.Ps())
            .Returns(new[] { "--------", " Up ", " Up " });
            const string successText = "Everything is up";
            var          logger      = new ListLogger();

            compose.SetupGet(c => c.Logger).Returns(new [] { logger });

            Assert.Throws <AggregateException>(() =>
            {
                var task = new Task(() =>
                                    new DockerFixture(null)
                                    .Init(new[] { Path.GetTempFileName() }, "up", "down", 120,
                                          outputLinesFromUp => outputLinesFromUp.Contains(successText),
                                          compose.Object));
                task.Start();
                logger.OnNext("foo");
                logger.OnNext("bar");
                Thread.Sleep(100);
                logger.OnNext("foo");
                logger.OnNext("bar");
                task.Wait();
            });
        }