public void Test_RemoveJobNoTInScheduler() { Scheduler s = new Scheduler(3, 10); Job phonyJob = new Job(new User("test", ""), 2500, 5, st => 10); try { s.RemoveJob(phonyJob); Assert.Fail("It was possible to remove a job not in the scheduler"); } catch (ArgumentException) { // This is good } }
public void Test_RemoveJobNull() { Scheduler s = new Scheduler(3, 10); try { s.RemoveJob(null); Assert.Fail("It was possible to remove a \"null\" job"); } catch (Exception e) { // If it is not a contract exception the test fails if (!e.ToString().ToLower().Contains("precondition failed")) { Assert.Fail("Unexpected exception thrown: " + e); } } }
public void Test_RemoveJobInScheduler() { Scheduler s = new Scheduler(3, 10); Job job = new Job(new User("test", ""), 2000, 5, st => 10); s.AddJob(job); // Remove a job in the scheduler s.RemoveJob(job); Assert.AreEqual(0, s.JobsInSequence.Count); }