Esempio n. 1
0
        public void WhenRequestingACruiseProjectManagerWithAnHttpUrlConstructsANewDashboardCruiseProjectManager()
        {
            var serverAddress = "http://somethingOrOther";
            var server        = new BuildServer(serverAddress);
            var client        = mocks.DynamicMock <CruiseServerClientBase>();

            var clientFactory = mocks.StrictMock <ICruiseServerClientFactory>();

            Expect.Call(clientFactory.GenerateHttpClient(serverAddress, new ClientStartUpSettings()))
            .Constraints(new Equal(serverAddress), new Anything())
            .Return(client);
            var factory = new CruiseProjectManagerFactory(clientFactory);

            var serverManagers = new Dictionary <BuildServer, ICruiseServerManager>();

            serverManagers[server] = new HttpCruiseServerManager(client, server);

            mocks.ReplayAll();
            var manager = factory.Create(new CCTrayProject(server, ProjectName), serverManagers);

            Assert.AreEqual(ProjectName, manager.ProjectName);
            Assert.AreEqual(typeof(HttpCruiseProjectManager), manager.GetType());

            mocks.VerifyAll();
        }
Esempio n. 2
0
        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. 3
0
        public void GetProjectListWithAnExtensionProtocolValidExtension()
        {
            var server = new BuildServer("http://somethingOrOther", BuildServerTransport.Extension, "ThoughtWorks.CruiseControl.UnitTests.CCTrayLib.Monitoring.ExtensionProtocolStub,ThoughtWorks.CruiseControl.UnitTests", string.Empty);
            var mockCruiseManagerFactory = mocks.Create <ICruiseServerClientFactory>(MockBehavior.Strict).Object;
            var factory = new CruiseProjectManagerFactory(mockCruiseManagerFactory);

            CCTrayProject[] projectList = factory.GetProjectList(server, false);
            Assert.AreNotEqual(0, projectList.Length);

            mocks.VerifyAll();
        }
Esempio n. 4
0
        public void WhenRequestingACruiseProjectManagerWithAnExtensionProtocolValidExtension()
        {
            var server = new BuildServer("http://somethingOrOther", BuildServerTransport.Extension, "ThoughtWorks.CruiseControl.UnitTests.CCTrayLib.Monitoring.ExtensionProtocolStub,ThoughtWorks.CruiseControl.UnitTests", string.Empty);
            var mockCruiseManagerFactory = mocks.Create <ICruiseServerClientFactory>(MockBehavior.Strict).Object;
            var factory        = new CruiseProjectManagerFactory(mockCruiseManagerFactory);
            var serverManagers = new Dictionary <BuildServer, ICruiseServerManager>();

            var manager = factory.Create(new CCTrayProject(server, ProjectName), serverManagers);

            Assert.AreEqual(ProjectName, manager.ProjectName);

            mocks.VerifyAll();
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        public void WhenRequestingACruiseProjectManagerWithAnHttpUrlConstructsANewDashboardCruiseProjectManager()
        {
            var serverAddress = "http://somethingOrOther";
            var server        = new BuildServer(serverAddress);
            var client        = mocks.Create <CruiseServerClientBase>().Object;

            var clientFactory = mocks.Create <ICruiseServerClientFactory>(MockBehavior.Strict).Object;

            Mock.Get(clientFactory).Setup(_clientFactory => _clientFactory.GenerateHttpClient(serverAddress, It.IsAny <ClientStartUpSettings>()))
            .Returns(client);
            var factory = new CruiseProjectManagerFactory(clientFactory);

            var serverManagers = new Dictionary <BuildServer, ICruiseServerManager>();

            serverManagers[server] = new HttpCruiseServerManager(client, server);

            var manager = factory.Create(new CCTrayProject(server, ProjectName), serverManagers);

            Assert.AreEqual(ProjectName, manager.ProjectName);
            Assert.AreEqual(typeof(HttpCruiseProjectManager), manager.GetType());

            mocks.VerifyAll();
        }