Ejemplo n.º 1
0
        public void ShouldAddJobForValidJson()
        {
            // arrange
            var scheduler = new Mock <IScheduler>();
            var json      = string.Format("[{{\"JobType\": \"{0}\", \"Interval\": \"00:00:01\"}}]", typeof(DummyJob).AssemblyQualifiedName);
            var source    = new JsonConfigurationSource();

            var stream = new MemoryStream(Encoding.UTF8.GetBytes(json));

            // act
            source.Configure(scheduler.Object, stream);

            // assert
            scheduler.Verify(x => x.AddJob <DummyJob>(It.Is <JobSetup>(y => (y.WaitSource as IntervalWaitSource).Interval == TimeSpan.FromSeconds(1))), Times.Once);
        }