public void StopClosesCommunications()
 {
     var cleaned = false;
     var channel = new ChannelStub
                       {
                           OnCleanUpAction = () => cleaned = true
                       };
     var server = new Server("Test", new[] { channel });
     var application = new Application
                           {
                               Configuration = server
                           };
     application.Stop();
     Assert.IsTrue(cleaned);
 }
 public void CloseCommunicationsCleansUpEachChannel()
 {
     var cleaned = false;
     var channel = new ChannelStub
                       {
                           OnCleanUpAction = () => cleaned = true
                       };
     var server = new Server("Test", new[] { channel });
     server.CloseCommunications();
     Assert.IsTrue(cleaned);
 }
 public void StartOpensCommunications()
 {
     var initialised = false;
     var channel = new ChannelStub
                       {
                           OnInitialiseAction = () => initialised = true
                       };
     var server = new Server("Test", new[] { channel });
     var application = new Application
                           {
                               Configuration = server
                           };
     application.Start();
     Assert.IsTrue(initialised);
 }
 public void OpenCommunicationsInitialisesEachChannel()
 {
     var initialised = false;
     var channel = new ChannelStub
                       {
                           OnInitialiseAction = () => initialised = true
                       };
     var server = new Server("Test", new[] { channel })
                      {
                          ActionInvoker = new ActionInvoker()
                      };
     server.OpenCommunications();
     Assert.IsTrue(initialised);
     Assert.AreSame(server.ActionInvoker, channel.Invoker);
 }