Beispiel #1
0
        public void FindQueueFound()
        {
            DefaultQueueConfiguration queueConfig = new DefaultQueueConfiguration("Test Queue");
            Configuration             config      = new Configuration();

            config.QueueConfigurations.Add(queueConfig);
            IQueueConfiguration foundConfig = config.FindQueueConfiguration("Test Queue");

            Assert.IsNotNull(foundConfig);
            Assert.AreSame(queueConfig, foundConfig);
        }
Beispiel #2
0
        public void SetUp()
        {
            integrationQueues = new IntegrationQueueSet();
            integrationQueues.Add(TestQueueName, new DefaultQueueConfiguration(TestQueueName));
            integrationQueueUseFirst = integrationQueues[TestQueueName];

            // Generate a queue to test re-adding
            string secondQueueName         = "Test Queue #2";
            IQueueConfiguration readConfig = new DefaultQueueConfiguration(secondQueueName);

            readConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReAdd;
            integrationQueues.Add(secondQueueName, readConfig);
            integrationQueueReAdd = integrationQueues[secondQueueName];

            // Generate a queue to test re-adding to top
            var fourthQueueName = "Test Queue #4";
            var raddTopConfig   = new DefaultQueueConfiguration(fourthQueueName);

            raddTopConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReAddTop;
            integrationQueues.Add(fourthQueueName, raddTopConfig);
            integrationQueueReAddTop = integrationQueues[fourthQueueName];

            // Generate a queue to test replacing
            string thirdQueueName             = "Test Queue #3";
            IQueueConfiguration replaceConfig = new DefaultQueueConfiguration(thirdQueueName);

            replaceConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReplace;
            integrationQueues.Add(thirdQueueName, replaceConfig);
            integrationQueueReplace = integrationQueues[thirdQueueName];

            integrationRequestForceBuild           = new IntegrationRequest(BuildCondition.ForceBuild, "Test", null);
            integrationRequestIfModificationExists = new IntegrationRequest(BuildCondition.IfModificationExists, "Test", null);

            project1Mock        = new LatchMock(typeof(IProject));
            project1Mock.Strict = true;
            project1Mock.SetupResult("Name", "ProjectOne");
            project1Mock.SetupResult("QueueName", TestQueueName);
            project1Mock.SetupResult("QueuePriority", 0);

            project2Mock        = new LatchMock(typeof(IProject));
            project2Mock.Strict = true;
            project2Mock.SetupResult("Name", "ProjectTwo");
            project2Mock.SetupResult("QueueName", TestQueueName);
            project2Mock.SetupResult("QueuePriority", 0);

            project3Mock        = new LatchMock(typeof(IProject));
            project3Mock.Strict = true;
            project3Mock.SetupResult("Name", "ProjectThree");
            project3Mock.SetupResult("QueueName", TestQueueName);
            project3Mock.SetupResult("QueuePriority", 1);

            queueNotifier1Mock        = new LatchMock(typeof(IIntegrationQueueNotifier));
            queueNotifier1Mock.Strict = true;

            queueNotifier2Mock        = new LatchMock(typeof(IIntegrationQueueNotifier));
            queueNotifier2Mock.Strict = true;

            queueNotifier3Mock        = new LatchMock(typeof(IIntegrationQueueNotifier));
            queueNotifier3Mock.Strict = true;

            integrationQueueItem1 = new IntegrationQueueItem((IProject)project1Mock.MockInstance,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier1Mock.MockInstance);

            integrationQueueItem2 = new IntegrationQueueItem((IProject)project2Mock.MockInstance,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier2Mock.MockInstance);

            integrationQueueItem3 = new IntegrationQueueItem((IProject)project3Mock.MockInstance,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier3Mock.MockInstance);

            integrationQueueItem4 = new IntegrationQueueItem((IProject)project2Mock.MockInstance,
                                                             integrationRequestIfModificationExists, (IIntegrationQueueNotifier)queueNotifier2Mock.MockInstance);
        }
        public void SetUp()
        {
            integrationQueues = new IntegrationQueueSet();
            integrationQueues.Add(TestQueueName, new DefaultQueueConfiguration(TestQueueName));
            integrationQueueUseFirst = integrationQueues[TestQueueName];

            // Generate a queue to test re-adding
            string secondQueueName         = "Test Queue #2";
            IQueueConfiguration readConfig = new DefaultQueueConfiguration(secondQueueName);

            readConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReAdd;
            integrationQueues.Add(secondQueueName, readConfig);
            integrationQueueReAdd = integrationQueues[secondQueueName];

            // Generate a queue to test re-adding to top
            var fourthQueueName = "Test Queue #4";
            var raddTopConfig   = new DefaultQueueConfiguration(fourthQueueName);

            raddTopConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReAddTop;
            integrationQueues.Add(fourthQueueName, raddTopConfig);
            integrationQueueReAddTop = integrationQueues[fourthQueueName];

            // Generate a queue to test replacing
            string thirdQueueName             = "Test Queue #3";
            IQueueConfiguration replaceConfig = new DefaultQueueConfiguration(thirdQueueName);

            replaceConfig.HandlingMode = QueueDuplicateHandlingMode.ApplyForceBuildsReplace;
            integrationQueues.Add(thirdQueueName, replaceConfig);
            integrationQueueReplace = integrationQueues[thirdQueueName];

            integrationRequestForceBuild           = new IntegrationRequest(BuildCondition.ForceBuild, "Test", null);
            integrationRequestIfModificationExists = new IntegrationRequest(BuildCondition.IfModificationExists, "Test", null);

            project1Mock = new Mock <IProject>(MockBehavior.Strict);
            project1Mock.SetupGet(project => project.Name).Returns("ProjectOne");
            project1Mock.SetupGet(project => project.QueueName).Returns(TestQueueName);
            project1Mock.SetupGet(project => project.QueuePriority).Returns(0);

            project2Mock = new Mock <IProject>(MockBehavior.Strict);
            project2Mock.SetupGet(project => project.Name).Returns("ProjectTwo");
            project2Mock.SetupGet(project => project.QueueName).Returns(TestQueueName);
            project2Mock.SetupGet(project => project.QueuePriority).Returns(0);

            project3Mock = new Mock <IProject>(MockBehavior.Strict);
            project3Mock.SetupGet(project => project.Name).Returns("ProjectThree");
            project3Mock.SetupGet(project => project.QueueName).Returns(TestQueueName);
            project3Mock.SetupGet(project => project.QueuePriority).Returns(1);

            queueNotifier1Mock = new Mock <IIntegrationQueueNotifier>(MockBehavior.Strict);

            queueNotifier2Mock = new Mock <IIntegrationQueueNotifier>(MockBehavior.Strict);

            queueNotifier3Mock = new Mock <IIntegrationQueueNotifier>(MockBehavior.Strict);

            integrationQueueItem1 = new IntegrationQueueItem((IProject)project1Mock.Object,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier1Mock.Object);

            integrationQueueItem2 = new IntegrationQueueItem((IProject)project2Mock.Object,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier2Mock.Object);

            integrationQueueItem3 = new IntegrationQueueItem((IProject)project3Mock.Object,
                                                             integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier3Mock.Object);

            integrationQueueItem4 = new IntegrationQueueItem((IProject)project2Mock.Object,
                                                             integrationRequestIfModificationExists, (IIntegrationQueueNotifier)queueNotifier2Mock.Object);
        }