public void SQLDataComponentTest_UpdateTest()
        {
            var component = new SQLDataComponent(new LoggerMock());

            InsertIfNeeded(component);

            var result = component.Find <JobConfiguration>(u => u.Name == "Test Job");

            Assert.IsNotNull(result);

            var job = result.FirstOrDefault();

            Assert.IsNotNull(job);
            string oldName = job.Name;

            job.Name = "Weeee" + Guid.NewGuid(); //Allows unit test to run over and over again without failing

            Assert.IsTrue(component.Update(job));

            var newJob = component.Find <JobConfiguration>(u => u.Name == job.Name).FirstOrDefault();

            Assert.IsNotNull(newJob);
            Assert.AreEqual(job.JobConfigurationId, newJob.JobConfigurationId);
            Assert.AreEqual(job.Name, newJob.Name);

            var notFound = component.Find <JobConfiguration>(u => u.Name == oldName);

            Assert.IsNull(notFound);
        }
        public void SQLDataComponentTest_DeleteWhereTest()
        {
            var component = new SQLDataComponent(new LoggerMock());

            InsertIfNeeded(component);

            Assert.IsTrue(component.Delete <JobConfiguration>(u => u.Name == "Test Job"));

            Assert.IsNull(component.Find <JobConfiguration>(u => u.Name == "Test Job"));
        }
        public void SQLDataComponentTest_FindWhereTest()
        {
            var component = new SQLDataComponent(new LoggerMock());

            InsertIfNeeded(component);

            var job = component.Find <JobConfiguration>(u => u.Name == "Test Job");

            Assert.IsNotNull(job);
            Assert.AreEqual(1, job.Count);

            var realJob = job.FirstOrDefault();

            Assert.IsNotNull(realJob);
            Assert.AreEqual("Test Job", realJob.Name);

            var jobToo = component.Find <JobConfiguration>(u => u.JobConfigurationId == -1);

            Assert.IsNull(jobToo);
        }
        public void SQLDataComponentTest_FindTest()
        {
            var component = new SQLDataComponent(new LoggerMock());

            InsertIfNeeded(component);

            var result = component.Find <JobConfiguration>(u => u.Name == "Test Job");

            Assert.IsNotNull(result);

            var job = result.FirstOrDefault();

            Assert.IsNotNull(job);

            var job1 = component.Find <JobConfiguration>(job.JobConfigurationId);

            Assert.IsNotNull(job1);
            Assert.AreEqual(job.JobConfigurationId, job1.JobConfigurationId);
            Assert.AreEqual(job.Name, job1.Name);
        }
        public void SQLDataComponentTest_DeleteTest()
        {
            var component = new SQLDataComponent(new LoggerMock());

            InsertIfNeeded(component);

            var job = component.Find <JobConfiguration>(u => u.Name == "Test Job");

            Assert.IsNotNull(job);
            Assert.AreEqual(1, job.Count);

            var job1 = job.FirstOrDefault();

            Assert.AreEqual("Test Job", job1.Name);

            Assert.IsTrue(component.Delete <JobConfiguration>(job1.JobConfigurationId));
            var find = component.Find <JobConfiguration>(job1.JobConfigurationId);

            Assert.IsNull(find);
        }