public void StartsTimer()
 {
     var timer = new Mock<ITimer>();
     var parser = new Mock<IParser>();
     var testServer = new TestBuildServer(timer.Object, parser.Object);
     timer.Verify(t => t.Start(), Times.Never());
     testServer.StartMonitoring();
     timer.Verify(t => t.Start(), Times.Once());
 }
        public void RaisesErrorIfProblemParsing()
        {
            var timer = new Mock<ITimer>();
            var parser = new Mock<IParser>();
            var config = new Mock<IConfig>();

            var testException = new Exception();
            parser.Setup(p => p.GetPipelines()).Throws(testException);

            var testServer = new TestBuildServer(timer.Object, parser.Object);
            testServer.Initialise(config.Object);

            var errorThrown = false;
            testServer.ErrorParsing += (thrownException) =>
            {
                Assert.AreSame(testException, thrownException);
                errorThrown = true;
            };

            timer.Raise(t => t.Tick += null);

            Assert.IsTrue(errorThrown);
        }