protected override void When()
 {
     Agent = new Domain.Agent(Bus, Worker, url => Repo, new string[]{}, Guid.NewGuid());
     Agent.JoinTheParty();
     buildMessage1 = new Build { RepoUrl = "http://fle", Revision = new RevisionInfo { Revision = "2" } };
     Agent.Handle(buildMessage1);
     buildMessage2 = new Build { RepoUrl = "http://flo", Revision = new RevisionInfo { Revision = "2" } };
     Agent.Handle(buildMessage2);
 }
 protected override void Given()
 {
     base.Given();
     var WorkerWithEvents = Worker;
     Worker = Substitute.For<Worker>(null,null);
     Worker.When(
         worker => worker.ExecutePipelineForRevision(Arg.Any<SourceRepoDriver>(), Arg.Is("2"))).Do(
             info => { throw new ApplicationException(); });
     Worker.When(
         worker => worker.ExecutePipelineForRevision(Arg.Any<SourceRepoDriver>(), Arg.Is("3"))).Do(
             callInfo => WorkerWithEvents.ExecutePipelineForRevision(null,null));
     Agent = new Domain.Agent(Bus, Worker, url => null, new string[] { }, Guid.NewGuid());
     try
     {
         Agent.Handle(new Build { RepoUrl = "asda", Revision = new RevisionInfo { Revision = "2" } });
     } catch(ApplicationException)
     {
     }
 }