示例#1
0
        public void ShouldStopBuildIfTaskFails()
        {
            IntegrationResult result = IntegrationResultMother.CreateFailed();

            mockTask.Expect("Run", result);

            IMock secondTask = new DynamicMock(typeof(ITask));

            secondTask.ExpectNoCall("Run", typeof(IntegrationResult));

            project.Tasks = new ITask[] { (ITask)mockTask.MockInstance, (ITask)secondTask.MockInstance };
            project.Run(result);
            VerifyAll();
            secondTask.Verify();
        }
示例#2
0
        public void FailedIntegrationShouldAddModificationUsersToFailedUsers()
        {
            IIntegrationResult lastResult = IntegrationResultMother.CreateFailed();

            lastResult.FailureUsers.Add("user1");
            ExpectToLoadState(lastResult);

            IIntegrationResult newResult = manager.StartNewIntegration(ModificationExistRequest());

            Assert.AreEqual(1, newResult.FailureUsers.Count, "Mismatched count of inherited FailureUsers");

            Modification modification = new Modification();

            modification.UserName   = "******";
            newResult.Modifications = new Modification[] { modification };
            newResult.Status        = IntegrationStatus.Failure;
            mockStateManager.Expect("SaveState", newResult);
            manager.FinishIntegration();

            Assert.AreEqual(2, newResult.FailureUsers.Count, "Mismatched count of resulting FailureUsers");
        }
        public void FailedIntegrationShouldResetFailedTasksOnNextIntegration()
        {
            IIntegrationResult lastResult = IntegrationResultMother.CreateFailed();

            lastResult.FailureTasks.Add("task1");
            ExpectToLoadState(lastResult);

            IIntegrationResult newResult = manager.StartNewIntegration(ModificationExistRequest());

            Assert.AreEqual(0, newResult.FailureTasks.Count, "Mismatched count of inherited FailureTasks");

            Modification modification = new Modification();

            modification.UserName   = "******";
            newResult.Modifications = new Modification[] { modification };
            newResult.Status        = IntegrationStatus.Failure;
            newResult.FailureTasks.Add("task2");
            mockStateManager.Setup(_manager => _manager.SaveState(newResult)).Verifiable();
            manager.FinishIntegration();

            Assert.AreEqual(1, newResult.FailureTasks.Count, "Mismatched count of resulting FailureTasks");
        }
示例#4
0
        public void SuccessfulIntegrationShouldClearFailedUsersOnNextIntegration()
        {
            IIntegrationResult result1 = IntegrationResultMother.CreateFailed();

            result1.FailureUsers.Add("user1");
            ExpectToLoadState(result1);

            IIntegrationResult result2 = manager.StartNewIntegration(ModificationExistRequest());

            Assert.AreEqual(1, result2.FailureUsers.Count);

            Modification modification = new Modification();

            modification.UserName = "******";
            result2.Modifications = new Modification[] { modification };
            result2.Status        = IntegrationStatus.Success;
            mockStateManager.Expect("SaveState", result2);
            manager.FinishIntegration();
            Assert.AreEqual(1, result2.FailureUsers.Count);

            IIntegrationResult result3 = manager.StartNewIntegration(ModificationExistRequest());

            Assert.AreEqual(0, result3.FailureUsers.Count);
        }