Example #1
0
        public void CanCreateASimpleJobDefinition()
        {
            using (var session = EmbeddedRavenProvider.DocumentStore.OpenSession())
            {
                var    sut               = new JobManager(session, DataServiceTestHelper.GetEventReporter().Object, new Mock <TypeLoader>().Object);
                string assemblyName      = Guid.NewGuid().ToString();
                string className         = Guid.NewGuid().ToString();
                int    intervalMinutes   = 10;
                int    delayStartMinutes = 20;
                string jobName           = Guid.NewGuid().ToString();

                var result = sut.CreateSimpleJob(jobName, Guid.NewGuid(), assemblyName, className, intervalMinutes, delayStartMinutes);
                Assert.IsNotNull(result);
                Assert.AreNotEqual(0, result.Id);

                var dbItem = session.Load <JobDefinition>(result.Id);
                Assert.IsNotNull(dbItem);
                Assert.AreEqual(jobName, dbItem.JobName);
                Assert.AreEqual(assemblyName, dbItem.AssemblyName);
                Assert.AreEqual(className, dbItem.ClassName);
                Assert.IsInstanceOf <JobSimpleSchedule>(dbItem.Schedule);
                Assert.AreEqual(intervalMinutes, ((JobSimpleSchedule)dbItem.Schedule).IntervalMinutes);
                Assert.AreEqual(delayStartMinutes, ((JobSimpleSchedule)dbItem.Schedule).DelayStartMinutes);

                session.Delete(dbItem);
                session.SaveChanges();
            }
        }
		public void CanCreateASimpleJobDefinition()
		{
			using (var session = EmbeddedRavenProvider.DocumentStore.OpenSession())
			{
				var sut = new JobManager(session, DataServiceTestHelper.GetEventReporter().Object, new Mock<TypeLoader>().Object);
				string assemblyName = Guid.NewGuid().ToString();
				string className = Guid.NewGuid().ToString();
				int intervalMinutes = 10;
				int delayStartMinutes = 20;
				string jobName = Guid.NewGuid().ToString();

				var result = sut.CreateSimpleJob(jobName, Guid.NewGuid(), assemblyName, className, intervalMinutes, delayStartMinutes);
				Assert.IsNotNull(result);
				Assert.AreNotEqual(0, result.Id);

				var dbItem = session.Load<JobDefinition>(result.Id);
				Assert.IsNotNull(dbItem);
				Assert.AreEqual(jobName, dbItem.JobName);
				Assert.AreEqual(assemblyName, dbItem.AssemblyName);
				Assert.AreEqual(className, dbItem.ClassName);
				Assert.IsInstanceOf<JobSimpleSchedule>(dbItem.Schedule);
				Assert.AreEqual(intervalMinutes, ((JobSimpleSchedule)dbItem.Schedule).IntervalMinutes);
				Assert.AreEqual(delayStartMinutes, ((JobSimpleSchedule)dbItem.Schedule).DelayStartMinutes);

				session.Delete(dbItem);
				session.SaveChanges();
			}
		}