private static MainForm GetMainForm(string settingsFilename)
        {
            var remoteCruiseManagerFactory = new CruiseServerClientFactory();
            ICruiseServerManagerFactory cruiseServerManagerFactory = new CruiseServerManagerFactory(remoteCruiseManagerFactory);
            ICruiseProjectManagerFactory cruiseProjectManagerFactory = new CruiseProjectManagerFactory(remoteCruiseManagerFactory);
            CCTrayMultiConfiguration configuration = new CCTrayMultiConfiguration(cruiseServerManagerFactory, cruiseProjectManagerFactory, settingsFilename);

            return new MainForm(configuration);
        }
        public void WhenRequestingACruiseServerManagerWithAnExtensionProtocolCannotFindExtension()
        {
            var mockCruiseManagerFactory = mocks.StrictMock<ICruiseServerClientFactory>();
            var factory = new CruiseServerManagerFactory(mockCruiseManagerFactory);

            var server = new BuildServer("http://somethingOrOther", BuildServerTransport.Extension,
                                         "Extension.Unknown,Extension", string.Empty);

            mocks.ReplayAll();
            Assert.That(delegate { factory.Create(server); }, Throws.TypeOf<CCTrayLibException>());
        }
        public void WhenRequestingACruiseServerManagerWithAnExtensionProtocolEmptyExtension()
        {
            var mockCruiseManagerFactory = mocks.StrictMock<ICruiseServerClientFactory>();
            var factory = new CruiseServerManagerFactory(mockCruiseManagerFactory);

            var server = new BuildServer("http://somethingOrOther", BuildServerTransport.Extension, "New Extension", string.Empty);
            server.ExtensionName = null;

            mocks.ReplayAll();
            Assert.That(delegate { factory.Create(server); },
                        Throws.TypeOf<ArgumentOutOfRangeException>().With.Property("ParamName").EqualTo("name"));
        }
Exemple #4
0
		static void Main(string[] args) {
			string settingsFilename = GetSettingsFilename(args.ToList());

			var remoteCruiseManagerFactory = new CruiseServerClientFactory();
			ICruiseServerManagerFactory cruiseServerManagerFactory = new CruiseServerManagerFactory(remoteCruiseManagerFactory);
			ICruiseProjectManagerFactory cruiseProjectManagerFactory = new CruiseProjectManagerFactory(remoteCruiseManagerFactory);
			CCTrayMultiConfiguration configuration = new CCTrayMultiConfiguration(cruiseServerManagerFactory, cruiseProjectManagerFactory, settingsFilename);
			var sync = new NoOpSynchronizeInvoke();

			var controller = new MainFormController(configuration, sync, null);

			controller.StartServerMonitoring();

			Console.ReadKey();

			controller.StopServerMonitoring();
		}
		public void WhenRequestingACruiseServerManagerWithATCPUrlAsksTheCruiseManagerFactory()
		{
            var serverAddress = @"tcp://1.2.3.4";
            var server = new BuildServer(serverAddress);
            var mockCruiseManagerFactory = mocks.StrictMock<ICruiseServerClientFactory>();
            var factory = new CruiseServerManagerFactory(mockCruiseManagerFactory);
            var client = mocks.DynamicMock<CruiseServerClientBase>();
            Expect.Call(mockCruiseManagerFactory.GenerateRemotingClient(serverAddress, new ClientStartUpSettings()))
                .Constraints(new Equal(serverAddress), new Anything())
                .Return(client);

            mocks.ReplayAll();
            var manager = factory.Create(server);
			Assert.AreEqual(server.Url, manager.Configuration.Url);
			Assert.AreEqual(typeof (CachingCruiseServerManager), manager.GetType());

            mocks.VerifyAll();
		}
		public void WhenRequestingACruiseServerManagerWithAnHttpUrlConstructsANewHttpServerManagerDecoratedWithACachingServerManager()
		{
            var mockCruiseManagerFactory = mocks.StrictMock<ICruiseServerClientFactory>();
            var factory = new CruiseServerManagerFactory(mockCruiseManagerFactory);

            var serverAddress = "http://somethingOrOther";
            var server = new BuildServer(serverAddress);
            var client = mocks.DynamicMock<CruiseServerClientBase>();
            Expect.Call(mockCruiseManagerFactory.GenerateHttpClient(serverAddress, new ClientStartUpSettings()))
                .Constraints(new Equal(serverAddress), new Anything())
                .Return(client);

            mocks.ReplayAll();
            var manager = factory.Create(server);
			Assert.AreEqual(server.Url, manager.Configuration.Url);
			Assert.AreEqual(typeof (CachingCruiseServerManager), manager.GetType());

            mocks.VerifyAll();
		}
        public void WhenRequestingACruiseServerManagerWithAnExtensionProtocolValidExtension()
        {
            var mockCruiseManagerFactory = mocks.StrictMock<ICruiseServerClientFactory>();
            var factory = new CruiseServerManagerFactory(mockCruiseManagerFactory);

            var server = new BuildServer("http://somethingOrOther", BuildServerTransport.Extension, "ThoughtWorks.CruiseControl.UnitTests.CCTrayLib.Monitoring.ExtensionProtocolStub,ThoughtWorks.CruiseControl.UnitTests", "Some settings");

            mocks.ReplayAll();
            var manager = factory.Create(server);
            Assert.AreEqual(server.Url, manager.Configuration.Url);
            Assert.AreEqual(server.ExtensionName, "ThoughtWorks.CruiseControl.UnitTests.CCTrayLib.Monitoring.ExtensionProtocolStub,ThoughtWorks.CruiseControl.UnitTests");
            Assert.AreEqual(server.ExtensionSettings, "Some settings");

            mocks.VerifyAll();
        }