Exemple #1
0
        public void Valid_name_and_connection_information()
        {
            //Arrange
            //Models.InstanceRepository repo = new QuartzAdmin.web.Models.InstanceRepository();
            FormCollection formData = new FormCollection();

            QuartzAdmin.web.Controllers.InstanceController controller = GetInstanceController();
            formData.Add("InstanceName", "MyFirstInstance");
            formData.Add("InstancePropertyKey1", "Red");
            formData.Add("InstancyPropertyValue1", "Dog");
            controller.ValueProvider = formData.ToValueProvider();

            //Act
            controller.Create(formData);
            InstanceModel newInstance = controller.Repository.GetByName("MyFirstInstance");

            //Assert
            Assert.IsNotNull(newInstance);
            Assert.AreEqual(formData["InstanceName"], newInstance.InstanceName);
        }
        public void List_all_triggers_in_an_instance()
        {
            // Arrange
            QuartzAdmin.web.Controllers.InstanceController controller = GetInstanceController();
            QuartzAdmin.web.Models.InstanceModel           instance   = GetTestInstance();
            controller.Repository.Save(instance);

            // Act
            ActionResult result          = controller.Connect(instance.InstanceName);
            int          countOfTriggers = 0;

            if (result is ViewResult)
            {
                if (((ViewResult)result).ViewData.Model is QuartzAdmin.web.Models.InstanceViewModel)
                {
                    countOfTriggers = ((QuartzAdmin.web.Models.InstanceViewModel)((ViewResult)result).ViewData.Model).Triggers.Count;
                }
            }

            // Assert
            Assert.IsTrue(countOfTriggers > 0);
        }
        public void Verify_quartz_is_running()
        {
            // Arrange
            QuartzAdmin.web.Controllers.InstanceController controller = GetInstanceController();
            QuartzAdmin.web.Models.InstanceModel           instance   = GetTestInstance();
            controller.Repository.Save(instance);

            // Act
            ActionResult result      = controller.Connect(instance.InstanceName);
            bool         isConnected = false;

            if (result is ViewResult)
            {
                if (((ViewResult)result).ViewData.Model is QuartzAdmin.web.Models.InstanceViewModel)
                {
                    isConnected = true;
                }
            }

            // Assert
            Assert.IsTrue(isConnected);
        }
        private QuartzAdmin.web.Controllers.InstanceController GetInstanceController()
        {
            QuartzAdmin.web.Controllers.InstanceController cont = new QuartzAdmin.web.Controllers.InstanceController(new Fakes.FakeInstanceRepository());

            return(cont);
        }
        private QuartzAdmin.web.Controllers.InstanceController GetInstanceController()
        {
            QuartzAdmin.web.Controllers.InstanceController cont = new QuartzAdmin.web.Controllers.InstanceController(new Fakes.FakeInstanceRepository());

            return cont;

        }