public void GetCruiseServerSnapshotWithProjectsAdded()
        {
            Project project2 = new Project();
            project2.Name = TestQueueName2;
            Project project3 = new Project();
            project3.Name = TestQueueName3;
            configuration.AddProject(project2);
            configuration.AddProject(project3);

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                configuration,
                (IProjectStateManager)stateManagerMock.MockInstance);
            CruiseServerSnapshot cruiseServerSnapshot = queueManager.GetCruiseServerSnapshot();
            Assert.IsNotNull(cruiseServerSnapshot);
            bool found1 = false;
            bool found2 = false;
            bool found3 = false;
            foreach (ProjectStatus status in cruiseServerSnapshot.ProjectStatuses)
            {
                found1 |= (status.Name == TestQueueName);
                found2 |= (status.Name == TestQueueName2);
                found3 |= (status.Name == TestQueueName3);
            }
            if (!found1)
                Assert.Fail("Could not find " + TestQueueName);
            if (!found2)
                Assert.Fail("Could not find " + TestQueueName2);
            if (!found3)
                Assert.Fail("Could not find " + TestQueueName3);
        }
		public void ShouldBeAbleToSaveProjectsThatALoaderCanLoad()
		{
			ExecutableTask builder = new ExecutableTask();
			builder.Executable = "foo";
			FileSourceControl sourceControl = new FileSourceControl();
			sourceControl.RepositoryRoot = "bar";
			// Setup
			Project project1 = new Project();
			project1.Name = "Project One";
			project1.SourceControl = sourceControl;
			Project project2 = new Project();
			project2.Name = "Project Two";
			project2.SourceControl = sourceControl;
			ProjectList projectList = new ProjectList();
			projectList.Add(project1);
			projectList.Add(project2);

			DynamicMock mockConfiguration = new DynamicMock(typeof(IConfiguration));
			mockConfiguration.ExpectAndReturn("Projects", projectList);

			FileInfo configFile = new FileInfo(TempFileUtil.CreateTempFile(TempFileUtil.CreateTempDir(this), "loadernet.config"));

			// Execute
			DefaultConfigurationFileSaver saver = new DefaultConfigurationFileSaver(new NetReflectorProjectSerializer());
			saver.Save((IConfiguration) mockConfiguration.MockInstance, configFile);

			DefaultConfigurationFileLoader loader = new DefaultConfigurationFileLoader();
			IConfiguration configuration2 = loader.Load(configFile);

			// Verify
			Assert.IsNotNull (configuration2.Projects["Project One"]);
			Assert.IsNotNull (configuration2.Projects["Project Two"]);
			mockConfiguration.Verify();
		}
		public void SetUp()
		{
			mockStateManager = new DynamicMock(typeof(IStateManager));

			project = CreateProject();
			manager = new IntegrationResultManager(project);
		}
		public void CreateIntegrators()
		{
			Project project1 = new Project();
			project1.Name = "project1";
			Project project2 = new Project();
			project2.Name = "project2";

			Configuration config = new Configuration();
			config.AddProject(project1);
			config.AddProject(project2);
		}
		public void HasAttributesAssignedCorrectly()
		{
			IProject project = new Project();
			IntegrationRequest integrationRequest = new IntegrationRequest(BuildCondition.NoBuild, "Test", null);
			IIntegrationQueueNotifier integrationQueueNotifier = new TestIntegrationQueueCallback();

			IIntegrationQueueItem integrationQueueItem = new IntegrationQueueItem(project, integrationRequest, integrationQueueNotifier);

			Assert.AreEqual(project, integrationQueueItem.Project);
			Assert.AreEqual(integrationRequest, integrationQueueItem.IntegrationRequest);
			Assert.AreEqual(integrationQueueNotifier, integrationQueueItem.IntegrationQueueNotifier);
		}
        public void SetUp()
        {
            project = new Project();
            project.Name = TestQueueName;

            configuration = new Configuration();
            configuration.AddProject(project);
            stateManagerMock = new DynamicMock(typeof(IProjectStateManager));

            queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),            
                configuration,
                (IProjectStateManager)stateManagerMock.MockInstance);
        }
		public void ShouldHandleIncrementingLabelAfterInitialBuildFailsWithException()
		{
			IMock mockSourceControl = new DynamicMock(typeof (ISourceControl));
			mockSourceControl.ExpectAndThrow("GetModifications", new Exception("doh!"), new IsAnything(), new IsAnything());
			mockSourceControl.ExpectAndReturn("GetModifications", new Modification[] {new Modification()}, new IsAnything(), new IsAnything());

			Project project = new Project();
			project.Name = "test";
			project.SourceControl = (ISourceControl) mockSourceControl.MockInstance;
			project.StateManager = new StateManagerStub();
			try { project.Integrate(new IntegrationRequest(BuildCondition.ForceBuild, "test", null));}
			catch (Exception) { }

			project.Integrate(new IntegrationRequest(BuildCondition.ForceBuild, "test", null));
			Assert.AreEqual(IntegrationStatus.Success, project.CurrentResult.Status);
			Assert.AreEqual("1", project.CurrentResult.Label);
		}
		public void GetQueueNamesOrderedAlphabetically()
		{
			Project project2 = new Project();
			project2.Name = TestQueueName2;
			Project project3 = new Project();
			project3.Name = TestQueueName3;
			configuration.AddProject(project2);
			configuration.AddProject(project3);

			queueManager = new IntegrationQueueManager(new ProjectIntegratorListFactory(),
                configuration,
                (IProjectStateManager)stateManagerMock.MockInstance);
			string[] queueNames = queueManager.GetQueueNames();
			Assert.AreEqual(TestQueueName, queueNames[0]);
			Assert.AreEqual(TestQueueName3, queueNames[1]);
			Assert.AreEqual(TestQueueName2, queueNames[2]);
		}
Esempio n. 9
0
		public void SetUp()
		{
            this.mocks = new MockRepository();
            workingDirPath = TempFileUtil.CreateTempDir("workingDir");
			artifactDirPath = TempFileUtil.CreateTempDir("artifactDir");
			Assert.IsTrue(Directory.Exists(workingDirPath));
			Assert.IsTrue(Directory.Exists(artifactDirPath));
			queue = new IntegrationQueue("foo", new DefaultQueueConfiguration("foo"), null);
			mockery = new Mockery();
			mockSourceControl = mockery.NewStrictMock(typeof (ISourceControl));
			mockStateManager = mockery.NewStrictMock(typeof (IStateManager));
			mockTrigger = mockery.NewStrictMock(typeof (ITrigger));
			mockLabeller = mockery.NewStrictMock(typeof (ILabeller));
			mockPublisher = mockery.NewStrictMock((typeof (ITask)));
			mockTask = mockery.NewStrictMock((typeof (ITask)));

			project = new Project();
			SetupProject();
		}
        public void SetUp()
        {
            workingDirPath = TempFileUtil.CreateTempDir("workingDirectory");
            artifactDirPath = TempFileUtil.CreateTempDir("artifactDirectory");
            Assert.IsTrue(Directory.Exists(workingDirPath));
            Assert.IsTrue(Directory.Exists(artifactDirPath));

            mockery = new Mockery();
            mockSourceControl = mockery.NewStrictMock(typeof (ISourceControl));
            mockStateManager = mockery.NewStrictMock(typeof (IStateManager));
            mockTrigger = mockery.NewStrictMock(typeof (ITrigger));
            mockLabeller = mockery.NewStrictMock(typeof (ILabeller));
            mockPublisher = mockery.NewStrictMock((typeof (ITask)));
            mockTask = mockery.NewStrictMock((typeof (ITask)));

            project1 = new Project();
            project2 = new Project();
            SetupProjects();
        }
		public void ShouldNotResetLabelIfGetModificationsThrowsException()
		{
			IMock mockSourceControl = new DynamicMock(typeof (ISourceControl));
			mockSourceControl.ExpectAndThrow("GetModifications", new Exception("doh!"), new IsAnything(), new IsAnything());
			mockSourceControl.ExpectAndReturn("GetModifications", new Modification[] {new Modification()}, new IsAnything(), new IsAnything());

			StateManagerStub stateManagerStub = new StateManagerStub();
			stateManagerStub.SaveState(IntegrationResultMother.CreateSuccessful("10"));
			
			Project project = new Project();
			project.Name = "test";
			project.SourceControl = (ISourceControl) mockSourceControl.MockInstance;
			project.StateManager = stateManagerStub;
			try { project.Integrate(new IntegrationRequest(BuildCondition.ForceBuild, "test", null));}
			catch (Exception) { }

            project.Integrate(new IntegrationRequest(BuildCondition.ForceBuild, "test", null));
			Assert.AreEqual(IntegrationStatus.Success, project.CurrentResult.Status);
			Assert.AreEqual("11", project.CurrentResult.Label);			
		}
		public void CreatesProjectIntegrators()
		{
			// Setup
			Project project1 = new Project();
			project1.Name = "Project 1";
			Project project2 = new Project();
			project2.Name = "Project 2";
			ProjectList projectList = new ProjectList();
			projectList.Add(project1);
			projectList.Add(project2);

			// Execute
			IntegrationQueueSet integrationQueues = new IntegrationQueueSet();
			IProjectIntegratorList integrators = new ProjectIntegratorListFactory().CreateProjectIntegrators(projectList, integrationQueues);

			// Verify
			Assert.AreEqual(2, integrators.Count);
			Assert.AreEqual(project1, integrators["Project 1"].Project );
			Assert.AreEqual(project2, integrators["Project 2"].Project );
		}
Esempio n. 13
0
        public void PublishResultsShouldNotCleanTemporaryResultsOnMergeFailure()
        {
            // Set up the test
            var result = this.mocks.StrictMock<IIntegrationResult>();
            var parameters = new List<NameValuePair>();
            SetupResult.For(result.Parameters).Return(parameters);
            SetupResult.For(result.Succeeded).Return(false);
            SetupResult.For(result.Modifications).Return(new Modification[0]);
            SetupResult.For(result.FailureUsers).Return(new ArrayList());
            SetupResult.For(result.FailureTasks).Return(new ArrayList());
            var results = new List<ITaskResult>();
            SetupResult.For(result.TaskResults).Return(results);
            var project = new Project();
            project.Publishers = new ITask[]
            {
                new PhantomPublisher(true)
            };
            var tempResult = new PhantomResult(p => { Assert.Fail("CleanUp() called"); });
            results.Add(tempResult);

            // Run the test
            this.mocks.ReplayAll();
            project.PublishResults(result);

            // Check the results
            this.mocks.VerifyAll();
        }
Esempio n. 14
0
        public void PublishResultsShouldCleanTemporaryResultsOnSuccess()
        {
            // Set up the test
            var result = this.mocks.StrictMock<IIntegrationResult>();
            var parameters = new List<NameValuePair>();
            SetupResult.For(result.Parameters).Return(parameters);
            SetupResult.For(result.Succeeded).Return(true);
            var results = new List<ITaskResult>();
            SetupResult.For(result.TaskResults).Return(results);
            var project = new Project();
            project.Publishers = new ITask[]
            {
                new PhantomPublisher(false)
            };
            var cleaned = false;
            var tempResult = new PhantomResult(p => { cleaned = true; });
            results.Add(tempResult);

            // Run the test
            this.mocks.ReplayAll();
            project.PublishResults(result);

            // Check the results
            this.mocks.VerifyAll();
            Assert.IsTrue(cleaned);
        }
Esempio n. 15
0
        public void RetrieveBuildFinalStatusReturnsDataStoreResult()
        {
            var dataStoreMock = this.mocks.StrictMock<IDataStore>();
            var project = new Project
                {
                    DataStore = dataStoreMock
                };
            var buildName = "testBuild";
            var expected = new ItemStatus();
            Expect.Call(dataStoreMock.LoadProjectSnapshot(project, buildName)).Return(expected);

            this.mocks.ReplayAll();
            var actual = project.RetrieveBuildFinalStatus(buildName);

            this.mocks.VerifyAll();
            Assert.AreSame(expected, actual);
        }
Esempio n. 16
0
 public void RetrieveBuildFinalStatusReturnsNullIfThereIsNoDataStore()
 {
     var project = new Project();
     var status = project.RetrieveBuildFinalStatus("testBuild");
 }
Esempio n. 17
0
                GetBuildGraph(int amountOfBuilds, Boolean buildsAreInSameDay)
        {        
            CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultBuildSpecifier[] builds;
            CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultProjectSpecifier ProjectSpecifier;
            CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultServerSpecifier ServerSpecifier;
            CruiseControl.WebDashboard.Dashboard.DefaultLinkFactory LinkFactory;
            CruiseControl.WebDashboard.Dashboard.DefaultBuildNameFormatter BuildNameFormatter;
            CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultUrlBuilder UrlBuilder;
            CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultCruiseUrlBuilder CruiseUrlBuilder;
            CruiseControl.Core.Project project;

            project = new CruiseControl.Core.Project();
            project.Name = "TestProject";

            ServerSpecifier = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultServerSpecifier("local");

            ProjectSpecifier = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultProjectSpecifier(ServerSpecifier,project.Name);
            
            builds = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultBuildSpecifier[amountOfBuilds];

            for(int i=0; i < amountOfBuilds; i++)
            {
                if (buildsAreInSameDay)                
                    builds[i] = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultBuildSpecifier( ProjectSpecifier , string.Format(System.Globalization.CultureInfo.CurrentCulture,"log20050801015223Lbuild.0.0.0.{0}.xml", i) );
                  else
                    builds[i] = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultBuildSpecifier( ProjectSpecifier , string.Format(System.Globalization.CultureInfo.CurrentCulture,"log200508{0}015223Lbuild.0.0.0.{1}.xml", (i+1).ToString("00"), i) );
            }

            UrlBuilder = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultUrlBuilder();
            CruiseUrlBuilder = new CruiseControl.Core.Reporting.Dashboard.Navigation.DefaultCruiseUrlBuilder(UrlBuilder);
            BuildNameFormatter = new CruiseControl.WebDashboard.Dashboard.DefaultBuildNameFormatter();
            
            LinkFactory = new  CruiseControl.WebDashboard.Dashboard.DefaultLinkFactory(UrlBuilder,CruiseUrlBuilder,BuildNameFormatter);
        
            return new CruiseControl.WebDashboard.Plugins.Statistics.BuildGraph(builds, LinkFactory, new Translations("en-US"));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IntegrationResultManager" /> class.	
 /// </summary>
 /// <param name="project">The project.</param>
 /// <remarks></remarks>
 public IntegrationResultManager(Project project)
 {
     this.project = project;
 }
Esempio n. 19
0
		public void LoadMinimalProjectXmlFromConfiguration()
		{
			string xml = @"
<project name=""foo"" />";

			project = (Project) NetReflector.Read(xml);
			Assert.AreEqual("foo", project.Name);
			Assert.AreEqual(Project.DefaultUrl(), project.WebURL);
			Assert.AreEqual(0, project.ModificationDelaySeconds); //TODO: is this the correct default?  should quiet period be turned off by default?  is this sourcecontrol specific?
			Assert.IsTrue(project.SourceControl is NullSourceControl);
			Assert.IsTrue(project.Labeller is DefaultLabeller);
			Assert.AreEqual(typeof(MultipleTrigger), project.Triggers.GetType());
			Assert.AreEqual(1, project.Publishers.Length);
			Assert.IsTrue(project.Publishers[0] is XmlLogPublisher);
			Assert.AreEqual(1, project.Tasks.Length);
			Assert.AreEqual(typeof(NullTask), project.Tasks[0].GetType());
			Assert.AreEqual(0, project.ExternalLinks.Length);
			VerifyAll();
		}
        public void ValidatePassesForTasksSection()
        {
            var task = new ParallelTask();
            var project = new Project
            {
                Tasks = new ITask[]
                {
                    task
                }
            };
            var errorProcessor = mocks.StrictMock<IConfigurationErrorProcesser>();
            mocks.ReplayAll();

            task.Validate(null, ConfigurationTrace.Start(project), errorProcessor);
            mocks.VerifyAll();
        }
 // ToDo - componentize NetReflector.Write, use that, and test (using a mock)
 public string Serialize(Project project)
 {
     StringWriter buffer = new StringWriter();
     new ReflectorTypeAttribute("project").Write(new XmlTextWriter(buffer), project);
     return buffer.ToString();
 }
Esempio n. 22
0
		public void LoadFullySpecifiedProjectFromConfiguration()
		{
			string xml = @"
<project name=""foo"" webURL=""http://localhost/ccnet"" modificationDelaySeconds=""60"" category=""category1"" queue=""queueName1"" queuePriority=""1"">
	<workingDirectory>c:\my\working\directory</workingDirectory>
	<sourcecontrol type=""filesystem"">
		<repositoryRoot>C:\</repositoryRoot>
	</sourcecontrol>
	<labeller type=""defaultlabeller"" />
	<state type=""state"" />
	<triggers>
		<scheduleTrigger time=""23:30"" buildCondition=""ForceBuild"" />
	</triggers>
	<publishers>
		<xmllogger logDir=""C:\temp"" />
		<nullTask />
	</publishers>
	<prebuild>
		<nullTask />
	</prebuild>
	<tasks>
		<merge />
	</tasks>
	<externalLinks>
		<externalLink name=""My Report"" url=""url1"" />
		<externalLink name=""My Other Report"" url=""url2"" />
	</externalLinks>
</project>";

			project = (Project) NetReflector.Read(xml);
			Assert.AreEqual("foo", project.Name);
			Assert.AreEqual("http://localhost/ccnet", project.WebURL);
			Assert.AreEqual("category1", project.Category);
			Assert.AreEqual("queueName1", project.QueueName);
			Assert.AreEqual(1, project.QueuePriority);
			Assert.AreEqual(60, project.ModificationDelaySeconds);
			Assert.IsTrue(project.SourceControl is FileSourceControl);
			Assert.IsTrue(project.Labeller is DefaultLabeller);
			Assert.IsTrue(project.StateManager is FileStateManager);
			Assert.AreEqual(1, ((MultipleTrigger)project.Triggers).Triggers.Length);
			Assert.AreEqual(typeof(ScheduleTrigger), ((MultipleTrigger)project.Triggers).Triggers[0].GetType());
			Assert.IsTrue(project.Publishers[0] is XmlLogPublisher);
			Assert.IsTrue(project.Publishers[1] is NullTask);
			Assert.IsTrue(project.Tasks[0] is MergeFilesTask);
			Assert.IsTrue(project.PrebuildTasks[0] is NullTask);
			Assert.AreEqual("My Other Report", project.ExternalLinks[1].Name);
			Assert.AreEqual(@"c:\my\working\directory", project.ConfiguredWorkingDirectory);
			VerifyAll();
		}
Esempio n. 23
0
		public void LoadMinimalProjectXmlWithAnEmptyTriggersBlock()
		{
			string xml = @"
<project name=""foo"">
	<triggers/>
</project>";

			project = (Project) NetReflector.Read(xml);
			Assert.AreEqual(typeof(MultipleTrigger), project.Triggers.GetType());
		}
        /// <summary>
        /// Initialises the server.
        /// </summary>
        /// <param name="mocks">The mocks repository.</param>
        /// <param name="buildName">Name of the build.</param>
        /// <param name="buildLog">The build log.</param>
        /// <returns>The initialised server.</returns>
        private static CruiseServer InitialiseServer(MockRepository mocks, string buildName, string buildLog)
        {
            // Add some projects
            var projects = new ProjectList();
            var project = new Project
            {
                Name = testProjectName
            };
            projects.Add(project);

            // Mock the configuration
            var configuration = mocks.StrictMock<IConfiguration>();
            SetupResult.For(configuration.Projects)
                .Return(projects);
            SetupResult.For(configuration.SecurityManager)
                .Return(new NullSecurityManager());

            // Mock the configuration service
            var configService = mocks.StrictMock<IConfigurationService>();
            SetupResult.For(configService.Load())
                .Return(configuration);
            Expect.Call(() => { configService.AddConfigurationUpdateHandler(null); })
                .IgnoreArguments();

            // Mock the integration repostory
            var repository = mocks.StrictMock<IIntegrationRepository>();
            SetupResult.For(repository.GetBuildLog(buildName))
                .Return(buildLog);

            // Mock the project integrator
            var projectIntegrator = mocks.StrictMock<IProjectIntegrator>();
            SetupResult.For(projectIntegrator.Project)
                .Return(project);
            SetupResult.For(projectIntegrator.IntegrationRepository)
                .Return(repository);

            // Mock the queue manager
            var queueManager = mocks.StrictMock<IQueueManager>();
            Expect.Call(() => { queueManager.AssociateIntegrationEvents(null, null); })
                .IgnoreArguments();
            SetupResult.For(queueManager.GetIntegrator(testProjectName))
                .Return(projectIntegrator);

            // Mock the queue manager factory
            var queueManagerFactory = mocks.StrictMock<IQueueManagerFactory>();
            SetupResult.For(queueManagerFactory.Create(null, configuration, null))
                .Return(queueManager);
            IntegrationQueueManagerFactory.OverrideFactory(queueManagerFactory);

            // Mock the execution environment
            var execEnviron = mocks.StrictMock<IExecutionEnvironment>();
            SetupResult.For(execEnviron.GetDefaultProgramDataFolder(ApplicationType.Server))
                .Return(string.Empty);

            // Initialise the server
            mocks.ReplayAll();
            var server = new CruiseServer(
                configService,
                null,
                null,
                null,
                null,
                execEnviron,
                null);
            return server;
        }
Esempio n. 25
0
		public void ShouldCallIntegratableWhenIntegrateCalled()
		{
			DynamicMock integratableMock = new DynamicMock(typeof (IIntegratable));
			project = new Project((IIntegratable) integratableMock.MockInstance);
			SetupProject();

            DynamicMock resultMock = new DynamicMock(typeof(IIntegrationResult));
            resultMock.SetupResult("Status", IntegrationStatus.Unknown);
            resultMock.SetupResult("StartTime", DateTime.Now);
            resultMock.SetupResult("Succeeded", false);

            

			IIntegrationResult result = (IIntegrationResult)resultMock.MockInstance;
			IntegrationRequest request = ForceBuildRequest();
			integratableMock.ExpectAndReturn("Integrate", result, request);
			Assert.AreEqual(result, project.Integrate(request));
			VerifyAll();
		}
		protected void SetUp()
		{
			projectSerializerMock = new DynamicMock(typeof (IProjectSerializer));

			integratorMock1 = new DynamicMock(typeof (IProjectIntegrator));
			integratorMock2 = new DynamicMock(typeof (IProjectIntegrator));
			integratorMock3 = new DynamicMock(typeof (IProjectIntegrator));
			integrator1 = (IProjectIntegrator) integratorMock1.MockInstance;
			integrator2 = (IProjectIntegrator) integratorMock2.MockInstance;
			integrator3 = (IProjectIntegrator) integratorMock3.MockInstance;
            integratorMock1.SetupResult("Name", "Project 1");
			integratorMock2.SetupResult("Name", "Project 2");
			integratorMock3.SetupResult("Name", "Project 3");

			fileSystem = mocks.DynamicMock<IFileSystem>();
			executionEnvironment = mocks.DynamicMock<IExecutionEnvironment>();

			SetupResult.For(executionEnvironment.IsRunningOnWindows).Return(true);
			SetupResult.For(executionEnvironment.GetDefaultProgramDataFolder(ApplicationType.Server)).Return(applicationDataPath);
			SetupResult.For(fileSystem.DirectoryExists(applicationDataPath)).Return(true);
			mocks.ReplayAll();

			integrationQueue = null; // We have no way of injecting currently.

			configuration = new Configuration();
			project1 = new Project();
			project1.Name = "Project 1";
            integratorMock1.SetupResult("Project", project1);
			
			project2 = new Project();
			project2.Name = "Project 2";
            integratorMock2.SetupResult("Project", project1);

			mockProject = new DynamicMock(typeof(IProject));
			mockProject.SetupResult("Name", "Project 3");
            mockProject.SetupResult("QueueName", "Project 3");
            mockProject.SetupResult("QueueName", "Project 3");
            mockProjectInstance = (IProject)mockProject.MockInstance;
			mockProject.SetupResult("Name", "Project 3");
            mockProject.SetupResult("StartupMode", ProjectStartupMode.UseLastState);
            integratorMock3.SetupResult("Project", mockProjectInstance);

			configuration.AddProject(project1);
			configuration.AddProject(project2);
			configuration.AddProject(mockProjectInstance);

			integratorList = new ProjectIntegratorList();
			integratorList.Add(integrator1);
			integratorList.Add(integrator2);
			integratorList.Add(integrator3);
            
			configServiceMock = new DynamicMock(typeof (IConfigurationService));
			configServiceMock.ExpectAndReturn("Load", configuration);

			projectIntegratorListFactoryMock = new DynamicMock(typeof (IProjectIntegratorListFactory));
			projectIntegratorListFactoryMock.ExpectAndReturn("CreateProjectIntegrators", integratorList, configuration.Projects, integrationQueue);

            stateManagerMock = new DynamicMock(typeof(IProjectStateManager));
            stateManagerMock.SetupResult("CheckIfProjectCanStart", true, typeof(string));

			server = new CruiseServer((IConfigurationService) configServiceMock.MockInstance,
			                          (IProjectIntegratorListFactory) projectIntegratorListFactoryMock.MockInstance,
			                          (IProjectSerializer) projectSerializerMock.MockInstance,
                                      (IProjectStateManager)stateManagerMock.MockInstance,
									  fileSystem,
									  executionEnvironment,
                                      null);
		}
		private Project CreateProject()
		{	
			project = new Project();
			project.Name = "project";
			project.ConfiguredWorkingDirectory = @"c:\temp";
			project.StateManager = (IStateManager) mockStateManager.MockInstance;
			project.ConfiguredArtifactDirectory = project.ConfiguredWorkingDirectory;            
			return project;
		}
        public void ValidateFailsForPublishersSection()
        {
            var task = new ParallelTask();
            var project = new Project
            {
                Publishers = new ITask[]
                {
                    task
                }
            };
            var errorProcessor = mocks.StrictMock<IConfigurationErrorProcesser>();
            Expect.Call(() =>
            {
                errorProcessor.ProcessWarning(string.Empty);
            }).IgnoreArguments();
            mocks.ReplayAll();

            task.Validate(null, ConfigurationTrace.Start(project), errorProcessor);
            mocks.VerifyAll();
        }
Esempio n. 29
0
        public void Test2()
        {
            Project TestProject = new Project();
            TestProject.Name = "Test Project";

            TestProject.IntegrationFilter = this;

            NetReflectorProjectSerializer Izer = new NetReflectorProjectSerializer();
            string Serialized = Izer.Serialize(TestProject);
            Console.WriteLine(Serialized);
            Project Clone = Izer.Deserialize(Serialized);
        }