public void ShouldPopulateFromMinimalConfiguration()
        {
            string xml = @"<multiTrigger />";

            trigger = (MultipleTrigger)NetReflector.Read(xml);
            Assert.AreEqual(0, trigger.Triggers.Length);
            Assert.AreEqual(Operator.Or, trigger.Operator);
        }
        public void ShouldPopulateFromConfigurationWithComment()
        {
            string xml = @"<multiTrigger><!-- foo --><triggers><intervalTrigger /></triggers></multiTrigger>";

            trigger = (MultipleTrigger)NetReflector.Read(xml);
            Assert.AreEqual(1, trigger.Triggers.Length);
            Assert.AreEqual(typeof(IntervalTrigger), trigger.Triggers[0].GetType());
        }
        public void ShouldPopulateFromConfiguration()
        {
            string xml = @"<multiTrigger operator=""And""><triggers><intervalTrigger /></triggers></multiTrigger>";

            trigger = (MultipleTrigger)NetReflector.Read(xml);
            Assert.AreEqual(1, trigger.Triggers.Length);
            Assert.AreEqual(Operator.And, trigger.Operator);
        }
 public void Setup()
 {
     subTrigger1Mock  = new DynamicMock(typeof(ITrigger));
     subTrigger2Mock  = new DynamicMock(typeof(ITrigger));
     subTrigger1      = (ITrigger)subTrigger1Mock.MockInstance;
     subTrigger2      = (ITrigger)subTrigger2Mock.MockInstance;
     trigger          = new MultipleTrigger();
     trigger.Triggers = new ITrigger[] { subTrigger1, subTrigger2 };
 }
 public void Setup()
 {
     subTrigger1Mock  = new Mock <ITrigger>();
     subTrigger2Mock  = new Mock <ITrigger>();
     subTrigger1      = (ITrigger)subTrigger1Mock.Object;
     subTrigger2      = (ITrigger)subTrigger2Mock.Object;
     trigger          = new MultipleTrigger();
     trigger.Triggers = new ITrigger[] { subTrigger1, subTrigger2 };
 }
        /// <summary>
        /// Adds the triggers.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="triggers">The triggers.</param>
        private void AddTriggers(TreeNode parent, MultipleTrigger triggers)
        {
            if ((triggers != null) && (triggers.Triggers.Length > 0))
            {
                var triggersNode = this.AddNode(parent, "Triggers" + this.CountItems(triggers.Triggers), "triggers", null);
                foreach (var trigger in triggers.Triggers)
                {
                    var nodeName    = this.GetReflectionName(trigger, "(Unknown trigger)");
                    var triggerNode = this.AddNode(
                        triggersNode,
                        nodeName,
                        "trigger",
                        trigger);

                    this.AddTriggers(triggerNode, trigger as MultipleTrigger);
                }
            }
        }
 public void ShouldNotFailWhenNoTriggersAndIntegrationCompletedCalled()
 {
     trigger = new MultipleTrigger();
     trigger.IntegrationCompleted();
 }
 public void ShouldReturnNoBuildWhenNoTriggers()
 {
     trigger = new MultipleTrigger();
     Assert.IsNull(trigger.Fire());
 }
 public void ShouldReturnNeverIfNoTriggerExists()
 {
     trigger = new MultipleTrigger();
     Assert.AreEqual(DateTime.MaxValue, trigger.NextBuild);
 }