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);
        }
Esempio n. 2
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();
		}
Esempio n. 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.DoEvents();

            try
            {
                ICruiseManagerFactory remoteCruiseManagerFactory = new RemoteCruiseManagerFactory();
                ICruiseProjectManagerFactory cruiseProjectManagerFactory = new CruiseProjectManagerFactory( remoteCruiseManagerFactory );
                CCTrayMultiConfiguration configuration = new CCTrayMultiConfiguration( cruiseProjectManagerFactory, GetSettingsFilename() );

                MainForm mainForm = new MainForm(configuration);

                Application.Run(mainForm);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to start: " + ex, AppDomain.CurrentDomain.FriendlyName);
            }
        }
		public void ShouldCloneConfigurationAndOnlyBindToTheClone()
		{
			DynamicMock existingConfiguration = new DynamicMock(typeof(ICCTrayMultiConfiguration));
			existingConfiguration.Strict = true;
			CCTrayMultiConfiguration clonedConfiguration = new CCTrayMultiConfiguration(null, null, null);
			existingConfiguration.ExpectAndReturn("Clone", clonedConfiguration);
			
			NullReferenceException nullReference = null;
			try
			{
				new CCTrayMultiSettingsForm((ICCTrayMultiConfiguration)existingConfiguration.MockInstance);
			}
			catch (NullReferenceException e)
			{
				nullReference = e;
			}

			// As we are using a Strict mock, incorrect calls to the existing configuration 
			// will be caught by the verify.
			existingConfiguration.Verify();
			Assert.IsNull(nullReference,
				"There was a null reference exception not related to using existing configuration:\n{0}",
				nullReference);
		}
		public void CreatesAnEmptySettingsFileIfTheConfigFileIsNotFound()
		{
			mockProjectConfigFactory = new DynamicMock(typeof (ICruiseProjectManagerFactory));
			mockProjectConfigFactory.Strict = true;
			CCTrayMultiConfiguration configuration = new CCTrayMultiConfiguration(
				(ICruiseServerManagerFactory) mockServerConfigFactory.MockInstance,
				(ICruiseProjectManagerFactory) mockProjectConfigFactory.MockInstance,
				"config_file_that_isnt_present.xml");

			Assert.IsNotNull(configuration);
			Assert.AreEqual(0, configuration.Projects.Length);
			Assert.IsTrue(configuration.ShouldShowBalloonOnBuildTransition);
			Assert.IsNull(configuration.Audio.BrokenBuildSound);
			Assert.IsNull(configuration.Audio.FixedBuildSound);
			Assert.IsNull(configuration.Audio.StillFailingBuildSound);
			Assert.IsNull(configuration.Audio.StillSuccessfulBuildSound);
			Assert.IsFalse(configuration.X10.Enabled);
		}