コード例 #1
0
        public void TestShouldRunIntegrationAllowedByExclusionFilter()
        {
            ProjectForceFilter TestSubject = new ProjectForceFilter();

            TestSubject.ProjectFilters = new ProjectFilterList();

            ProjectFilter Project = new ProjectFilter();

            Project.Project = "TestProject";
            Project.ServerUri = "TestUri";

            Project.ExclusionFilters.Activities = new ProjectActivity[2] { ProjectActivity.Building, ProjectActivity.CheckingModifications };
            Project.ExclusionFilters.Conditions = new IntegrationStatus[1] { IntegrationStatus.Failure };

            RecorderIRemotingService RemotingRecorder = new RecorderIRemotingService();
            RecorderICruiseManager CruiseRecorder = new RecorderICruiseManager();
            ProjectStatus Stati = new ProjectStatus();

            Stati.Name = "TestProject";
            Stati.Activity = ProjectActivity.Sleeping;
            Stati.BuildStatus = IntegrationStatus.Success;

            CruiseRecorder.Recordings.GetProjectStatusRecording.ReturnValue = new ProjectStatus[1] { Stati };
            RemotingRecorder.Recordings.ConnectTypeStringRecording.ReturnValue = CruiseRecorder;
            Project.RemoteService = RemotingRecorder;

            TestSubject.ProjectFilters.Add(Project);

            bool Condition = TestSubject.ShouldRunIntegration(null, null);

            Assert.IsTrue(RemotingRecorder.Recordings.ConnectTypeStringRecording.Called);
            Assert.AreEqual("TestUri", RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedStringuri);
            Assert.AreEqual(typeof(ICruiseManager), RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedTypeproxyType);

            Assert.IsTrue(CruiseRecorder.Recordings.GetProjectStatusRecording.Called);

            Assert.IsTrue(Condition);
        }
コード例 #2
0
        public void TestShouldRunIntegrationBlockedByInclusionFilterCauseFailed()
        {
            ProjectTriggerFilter TestSubject = new ProjectTriggerFilter();

            RecorderITrigger TriggerRecorder = new RecorderITrigger();
            TriggerRecorder.Recordings.ShouldRunIntegrationRecording.ReturnValue = BuildCondition.IfModificationExists;

            TestSubject.InnerTrigger = TriggerRecorder;

            TestSubject.ProjectFilters = new ProjectFilterList();

            ProjectFilter Project = new ProjectFilter();

            Project.Project = "TestProject";
            Project.ServerUri = "TestUri";

            Project.InclusionFilters.Activities = new ProjectActivity[1] { ProjectActivity.Sleeping };
            Project.InclusionFilters.Conditions = new IntegrationStatus[1] { IntegrationStatus.Success };

            RecorderIRemotingService RemotingRecorder = new RecorderIRemotingService();
            RecorderICruiseManager CruiseRecorder = new RecorderICruiseManager();
            ProjectStatus Stati = new ProjectStatus();

            Stati.Name = "TestProject";
            Stati.Activity = ProjectActivity.Sleeping;
            Stati.BuildStatus = IntegrationStatus.Failure;

            CruiseRecorder.Recordings.GetProjectStatusRecording.ReturnValue = new ProjectStatus[1] { Stati };
            RemotingRecorder.Recordings.ConnectTypeStringRecording.ReturnValue = CruiseRecorder;
            Project.RemoteService = RemotingRecorder;

            TestSubject.ProjectFilters.Add(Project);

            BuildCondition Condition = TestSubject.ShouldRunIntegration();

            Assert.IsTrue(RemotingRecorder.Recordings.ConnectTypeStringRecording.Called);
            Assert.AreEqual("TestUri", RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedStringuri);
            Assert.AreEqual(typeof(ICruiseManager), RemotingRecorder.Recordings.ConnectTypeStringRecording.PassedTypeproxyType);

            Assert.IsTrue(CruiseRecorder.Recordings.GetProjectStatusRecording.Called);

            Assert.AreEqual(BuildCondition.NoBuild, Condition);
        }