public void CancelJobThrowsContractException142() { try { Owner owner; Dictionary<Owner, List<Job>> dictionary; List<Job> list; Dictionary<JobType, List<Job>> dictionary1_; Dictionary<JobType, uint> dictionary2_; BenchmarkSystem.Scheduler scheduler; SBenchmarkSystem sBenchmarkSystem; Logger logger; BenchmarkSystem benchmarkSystem; owner = PexInvariant.CreateInstance<Owner>(); PexInvariant.SetField<string>((object)owner, "<Name>k__BackingField", "\0"); PexInvariant.CheckInvariant((object)owner); dictionary = new Dictionary<Owner, List<Job>>(0); dictionary[owner] = (List<Job>)null; Job[] jobs = new Job[0]; list = new List<Job>((IEnumerable<Job>)jobs); dictionary1_ = new Dictionary<JobType, List<Job>>(4); dictionary1_[JobType.SHORT] = (List<Job>)null; dictionary2_ = new Dictionary<JobType, uint>(1); dictionary2_[JobType.SHORT] = 0u; scheduler = PexInvariant.CreateInstance<BenchmarkSystem.Scheduler>(); PexInvariant.SetField<uint>((object)scheduler, "_shortJobsRunning", 0u); PexInvariant.SetField<uint>((object)scheduler, "_longJobsRunning", 0u); PexInvariant.SetField<uint>((object)scheduler, "_veryLongJobsRunning", 0u); PexInvariant.SetField<List<Job>>((object)scheduler, "_shortList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_longList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_veryLongList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_jobSequence", list); PexInvariant.SetField<Dictionary<JobType, List<Job>>> ((object)scheduler, "_listByJobtype", dictionary1_); PexInvariant.SetField<Dictionary<JobType, uint>> ((object)scheduler, "_counterByJobtype", dictionary2_); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobDone", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobFailed", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobTerminated", (EventHandler)null); PexInvariant.CheckInvariant((object)scheduler); sBenchmarkSystem = new SBenchmarkSystem(); logger = new Logger((BenchmarkSystem)sBenchmarkSystem); benchmarkSystem = PexInvariant.CreateInstance<BenchmarkSystem>(); PexInvariant.SetField<BenchmarkSystem.Scheduler> ((object)benchmarkSystem, "_scheduler", scheduler); PexInvariant.SetField<Logger>((object)benchmarkSystem, "_logger", logger); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobSubmitted", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobCancelled", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobRunning", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobTerminated", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobFailed", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobDone", (EventHandler)null); PexInvariant.SetField<List<Job>>((object)benchmarkSystem, "_threads", list); PexInvariant.SetField<Dictionary<Owner, List<Job>>> ((object)benchmarkSystem, "_jobs", dictionary); PexInvariant.SetField<bool>((object)benchmarkSystem, "_isFinishing", false); PexInvariant.SetField<BSStatus> ((object)benchmarkSystem, "<Status>k__BackingField", BSStatus.Ready); PexInvariant.CheckInvariant((object)benchmarkSystem); this.CancelJob(benchmarkSystem, (Job)null); throw new AssertFailedException("expected an exception of type ContractException"); } catch(Exception ex) { if (!PexContract.IsContractException(ex)) throw ex; } }
public void ExecuteAll544() { Owner owner; Dictionary<Owner, List<Job>> dictionary; List<Job> list; Dictionary<JobType, List<Job>> dictionary1_; Dictionary<JobType, uint> dictionary2_; BenchmarkSystem.Scheduler scheduler; SBenchmarkSystem sBenchmarkSystem; Logger logger; BenchmarkSystem benchmarkSystem; owner = PexInvariant.CreateInstance<Owner>(); PexInvariant.SetField<string>((object)owner, "<Name>k__BackingField", "\0"); PexInvariant.CheckInvariant((object)owner); dictionary = new Dictionary<Owner, List<Job>>(0); dictionary[owner] = (List<Job>)null; Job[] jobs = new Job[0]; list = new List<Job>((IEnumerable<Job>)jobs); dictionary1_ = new Dictionary<JobType, List<Job>>(4); dictionary1_[JobType.SHORT] = (List<Job>)null; dictionary2_ = new Dictionary<JobType, uint>(1); dictionary2_[JobType.SHORT] = 0u; scheduler = PexInvariant.CreateInstance<BenchmarkSystem.Scheduler>(); PexInvariant.SetField<uint>((object)scheduler, "_shortJobsRunning", 0u); PexInvariant.SetField<uint>((object)scheduler, "_longJobsRunning", 0u); PexInvariant.SetField<uint>((object)scheduler, "_veryLongJobsRunning", 0u); PexInvariant.SetField<List<Job>>((object)scheduler, "_shortList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_longList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_veryLongList", list); PexInvariant.SetField<List<Job>>((object)scheduler, "_jobSequence", list); PexInvariant.SetField<Dictionary<JobType, List<Job>>> ((object)scheduler, "_listByJobtype", dictionary1_); PexInvariant.SetField<Dictionary<JobType, uint>> ((object)scheduler, "_counterByJobtype", dictionary2_); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobDone", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobFailed", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)scheduler, "JobTerminated", (EventHandler)null); PexInvariant.CheckInvariant((object)scheduler); sBenchmarkSystem = new SBenchmarkSystem(); logger = new Logger((BenchmarkSystem)sBenchmarkSystem); benchmarkSystem = PexInvariant.CreateInstance<BenchmarkSystem>(); PexInvariant.SetField<BenchmarkSystem.Scheduler> ((object)benchmarkSystem, "_scheduler", scheduler); PexInvariant.SetField<Logger>((object)benchmarkSystem, "_logger", logger); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobSubmitted", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobCancelled", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobRunning", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobTerminated", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobFailed", (EventHandler)null); PexInvariant.SetField<EventHandler> ((object)benchmarkSystem, "JobDone", (EventHandler)null); PexInvariant.SetField<List<Job>>((object)benchmarkSystem, "_threads", list); PexInvariant.SetField<Dictionary<Owner, List<Job>>> ((object)benchmarkSystem, "_jobs", dictionary); PexInvariant.SetField<bool>((object)benchmarkSystem, "_isFinishing", false); PexInvariant.SetField<BSStatus> ((object)benchmarkSystem, "<Status>k__BackingField", BSStatus.Ready); PexInvariant.CheckInvariant((object)benchmarkSystem); this.ExecuteAll(benchmarkSystem); Assert.IsNotNull((object)benchmarkSystem); Assert.AreEqual<BSStatus>(BSStatus.Ready, benchmarkSystem.Status); }