예제 #1
0
        public void LocalizerCode_should_be_expected_value()
        {
            var subj    = new OrMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure = TestMatcherLocalizer.Failure(subj, "");

            Assert.Equal("spec.or", failure.Name.ToString());
        }
예제 #2
0
        public void LocalizerFailure_should_generate_negated_children()
        {
            var subj      = new OrMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure   = TestMatcherLocalizer.Failure(Matchers.Not(subj), "");
            var exception = failure.ToException();

            var label = exception.Message.Split('\n').Select(t => t.Trim()).First();

            Assert.Equal("Not expected to:", label);
        }
예제 #3
0
        public void CalculatesLogicalDisjunctionOfTwoMatchers()
        {
            for (int i = 0; i < truthTable.GetLength(0); i++)
            {
                Matcher arg1    = (Matcher)truthTable[i, 0];
                Matcher arg2    = (Matcher)truthTable[i, 1];
                Matcher matcher = new OrMatcher(arg1, arg2);

                Assert.AreEqual(truthTable[i, 2], matcher.Matches(ignored));
            }
        }
예제 #4
0
        // Adding a JobListener that is interested in all jobs of two particular groups:
        public static async Task AddAJobListener3()
        {
            NameValueCollection props = new NameValueCollection
            {
                { "quartz.serializer.type", "binary" }
            };
            StdSchedulerFactory factory   = new StdSchedulerFactory(props);
            IScheduler          scheduler = await factory.GetScheduler();

            IJobListener myJobListener = new GggJobListener();

            scheduler.ListenerManager.AddJobListener(myJobListener,
                                                     OrMatcher <JobKey> .Or(GroupMatcher <JobKey> .GroupEquals("myJobGroup"), GroupMatcher <JobKey> .GroupEquals("yourGroup")));
        }
예제 #5
0
        public void LocalizerFailure_should_generate_children()
        {
            var subj      = new OrMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure   = TestMatcherLocalizer.Failure(subj, "");
            var exception = failure.ToException();

            var lines    = exception.Message.Split('\n').Select(t => t.Trim()).Take(3);
            var expected = new [] {
                "Expected to:",
                "- be empty",
                "- or have count 0",
            };

            Assert.Equal(expected, lines);
        }
        /// <summary>
        /// Creador del servicio de campañas
        /// </summary>
        public CampaignService()
        {
            cLogger.Info("Iniciando CampaignService");

            iCampaignList = new List <Campaign>()
            {
            };
            iNewCampaignList = new List <Campaign>()
            {
            };

            iScheduler = StdSchedulerFactory.GetDefaultScheduler();

            iChangeImageJobKey     = new JobKey("CIJK");
            iUpdateCampaignsJobKey = new JobKey("UCJK");

            //Creacion de los jobs
            iChangeImageJob = JobBuilder.Create <ChangeImageJob>()
                              .WithIdentity(iChangeImageJobKey)
                              .Build();

            iUpdateCampaignsJob = JobBuilder.Create <UpdateCampaignsJob>()
                                  .WithIdentity(iUpdateCampaignsJobKey)
                                  .Build();

            iScheduler.Start();
            //Agrega este objeto como listener a los jobs anteriores
            iScheduler.ListenerManager.AddJobListener(this, OrMatcher <JobKey> .Or(KeyMatcher <JobKey> .KeyEquals <JobKey>(iChangeImageJobKey), KeyMatcher <JobKey> .KeyEquals <JobKey>(iUpdateCampaignsJobKey)));

            iUpdateAvailable = false;
            iUpdateDone      = false;

            iActualImage    = -1;
            iActualCampaign = 0;

            cLogger.Info("Iniciando CampaignService Jobs");

            //Se inician los jobs correspondientes, que luego se auto reinician
            StartUpdateCampaignsJob(DateTime.Now);
            StartChangeImageJob(CampaignService.DEFAULT_CHANGE_IMAGE_TIME);
        }
예제 #7
0
        public Service()
        {
            scheduler = StdSchedulerFactory.GetDefaultScheduler();


            index    = 1;
            newIndex = 1;
            updDisp  = false;
            updDone  = false;

            intervalJobKey        = new JobKey("iJK");
            anotherIntervalJobKey = new JobKey("aIJK");



            scheduler.Start();


            scheduler.ListenerManager.AddJobListener(this, OrMatcher <JobKey> .Or(KeyMatcher <JobKey> .KeyEquals <JobKey>(intervalJobKey), KeyMatcher <JobKey> .KeyEquals <JobKey>(anotherIntervalJobKey)));

            startIntervalJob(1);
            startAnotherIntervalJob(5);
        }
예제 #8
0
        public void Matches_should_detect_nominal()
        {
            var subj = new OrMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));

            Assert.True(subj.Matches(TestActual.Value("")));
        }