public CCTrayProject[] GetProjectList(BuildServer server, bool newServer)
        {
            if (newServer)
            {
                // Clear the cache when adding a new server
                clientFactory.ResetCache(server.Url);
            }

            ICruiseServerManager manager;
            switch (server.Transport)
            {
                case BuildServerTransport.Remoting:
                    {
                        var client = GenerateRemotingClient(server);
                        manager = new RemotingCruiseServerManager(client, server);
                        break;
                    }

                case BuildServerTransport.Extension:
                    return new ExtensionTransportProjectListRetriever(server.ExtensionName).GetProjectList(server);
                default:
                    {
                        var client = GenerateHttpClient(server);
                        manager = new HttpCruiseServerManager(client, server);
                        break;
                    }
            }

            if (!string.IsNullOrEmpty(server.SecurityType))
            {
                manager.Login();
            }

            return manager.GetProjectList();
        }
		public void SetUp()
		{
            serverClient = mocks.DynamicMock<CruiseServerClientBase>();

			buildServer = new BuildServer(SERVER_URL);
            manager = new HttpCruiseServerManager(serverClient, buildServer);
		}
		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();
		}
        public CCTrayProject[] GetProjectList(BuildServer server, bool newServer)
        {
            if (newServer)
            {
                // Clear the cache when adding a new server
                clientFactory.ResetCache(server.Url);
            }

            ICruiseServerManager manager;

            switch (server.Transport)
            {
            case BuildServerTransport.Remoting:
            {
                var client = GenerateRemotingClient(server);
                manager = new RemotingCruiseServerManager(client, server);
                break;
            }

            case BuildServerTransport.Extension:
                return(new ExtensionTransportProjectListRetriever(server.ExtensionName).GetProjectList(server));

            default:
            {
                var client = GenerateHttpClient(server);
                manager = new HttpCruiseServerManager(client, server);
                break;
            }
            }

            if (!string.IsNullOrEmpty(server.SecurityType))
            {
                manager.Login();
            }

            return(manager.GetProjectList());
        }