コード例 #1
0
        public void TestShouldRunIntegrationAllowedByExclusionFilter()
        {
            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.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);

            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.IfModificationExists, Condition);
        }
コード例 #2
0
        public void TestShouldRunIntegrationInnerNoBuild()
        {
            ProjectTriggerFilter TestSubject = new ProjectTriggerFilter();

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

            TestSubject.InnerTrigger = TriggerRecorder;

            BuildCondition Condition = TestSubject.ShouldRunIntegration();

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