Ejemplo n.º 1
0
        public void ShouldOnlyBuildBetween7AMAnd7PMOnWeekdays()
        {
            FilterTrigger outerTrigger = new FilterTrigger((DateTimeProvider)mockDateTime.Object);

            outerTrigger.StartTime    = "19:00";
            outerTrigger.EndTime      = "7:00";
            outerTrigger.InnerTrigger = trigger;

            trigger.StartTime = "0:00";
            trigger.EndTime   = "23:59:59";
            trigger.WeekDays  = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday };
            IntegrationRequest request = ModificationExistRequest();

            mockTrigger.Setup(_trigger => _trigger.Fire()).Returns(request);

            mockDateTime.SetupGet(provider => provider.Now).Returns(new DateTime(2006, 8, 10, 11, 30, 0, 0));             // Thurs midday
            Assert.AreEqual(request, outerTrigger.Fire(), "outerTrigger.Fire()");

            mockDateTime.SetupGet(provider => provider.Now).Returns(new DateTime(2006, 8, 10, 19, 30, 0, 0));             // Thurs evening
            Assert.IsNull(outerTrigger.Fire(), "outerTrigger.Fire()");

            mockDateTime.SetupGet(provider => provider.Now).Returns(new DateTime(2006, 8, 12, 11, 30, 0, 0));             // Sat midday
            Assert.IsNull(outerTrigger.Fire(), "outerTrigger.Fire()");

            mockDateTime.SetupGet(provider => provider.Now).Returns(new DateTime(2006, 8, 12, 19, 30, 0, 0));             // Sat evening
            Assert.IsNull(outerTrigger.Fire(), "outerTrigger.Fire()");
        }
Ejemplo n.º 2
0
        public void ShouldNotInvokeDecoratedTriggerWhenTimeAndWeekDayMatch()
        {
            mockTrigger.ExpectNoCall("Fire");
            mockDateTime.ExpectAndReturn("Now", new DateTime(2004, 12, 1, 10, 30, 0, 0));

            Assert.IsNull(trigger.Fire(), "trigger.Fire()");
        }
Ejemplo n.º 3
0
        public void ShouldNotInvokeDecoratedTriggerWhenTimeAndWeekDayMatch()
        {
            mockDateTime.SetupGet(provider => provider.Now).Returns(new DateTime(2004, 12, 1, 10, 30, 0, 0)).Verifiable();

            Assert.IsNull(trigger.Fire(), "trigger.Fire()");

            mockTrigger.VerifyNoOtherCalls();
        }