/// <summary> /// Performs the concrete request operation and returns the output /// as a byte array. /// </summary> /// <param name="context">The HTTP context to perform the request for.</param> /// <param name="model">The model passed in the request's content body.</param> /// <returns>The result of the request.</returns> protected override object PerformRequest(HttpContextBase context, ScheduledJobRecord model) { if (model == null) { throw new ArgumentNullException("model", "model cannot be null."); } if (this.ScheduleId > 0) { model.ScheduleId = this.ScheduleId; using (IDbTransaction transaction = Repository.BeginTransaction()) { try { ScheduleRecord schedule = Repository.GetSchedule(this.ScheduleId, transaction); if (schedule != null) { if ("PUT".Equals(this.Verb, StringComparison.OrdinalIgnoreCase)) { model.Id = Helper.RouteIntValue(1); if (model.Id != null && model.Id > 0) { model = Repository.UpdateScheduledJob(model, transaction); } else { BadRequest(); } } else { model = Repository.CreateScheduledJob(model, transaction); } Repository.SignalWorkers(schedule.ApplicationName, WorkerSignal.RefreshSchedules, transaction); } else { NotFound(); } transaction.Commit(); } catch { transaction.Rollback(); throw; } } } else { BadRequest(); } return(new { Id = model.Id }); }
// This would be better implemented if weeknumber wasn't an argument, but // rather it loaded according to currentWeekNumber. I can't imagine a // scenario in which you'd want to load something different from // currentWeekNumber. This was what was causing the previous bug with // edits in one week showing up in another. ?? Did I write this C.G? // Cause I'm thinking selecting another week number in the Combobox means that // you can jump around week numbers private void LoadWeek(int weeknumber) { isInitialising = true; //Clear the current rows dgScheduleView.Rows.Clear(); try { IList <ScheduleRecord> list = scheduleModel.GetWeek(weeknumber); foreach (ScheduleRecord record in list) { //match the fields in record with those to go in the datagrid dgScheduleView.Rows.Add(CreateDataGridRow(record)); } lblTitle.Text = ScheduleRecord.WeekName(weeknumber - 1); } catch (Exception e) { MessageBox.Show("Exception occured loading week " + weeknumber + "\r\n" + e.ToString(), "Exception Loading Week", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { isInitialising = false; } }
public void InitialiseUI() { for (int i = 1; i <= ScheduleEditingModel.NUMBER_OF_WEEKS; i++) { cbWeekSelector.Items.Add(ScheduleRecord.WeekName(i - 1)); } cbWeekSelector.SelectedIndex = 0; }
public void SchedulerCanScheduleBeEnqueued() { var repository = new Mock <IRepository>(); repository.Setup(r => r.GetScheduleDateExistsForSchedule(It.IsAny <long>(), It.IsAny <DateTime>(), It.IsAny <IDbTransaction>())).Returns(false); var factory = new Mock <IRepositoryFactory>(); factory.Setup(f => f.Create()).Returns(repository.Object); var logger = new Mock <ILogger>(); DateTime?scheduleDate; DateTime now = DateTime.UtcNow.FloorWithSeconds(); ScheduleRecord schedule = new ScheduleRecord() { Id = 1, RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = now }; Scheduler scheduler = new Scheduler( 1, BlueCollarSection.Section.ApplicationName, QueueNameFilters.Any(), BlueCollarSection.Section.WorkerHeartbeat, factory.Object, logger.Object); DateTime begin = now.AddSeconds(-1); DateTime end = now; Assert.IsTrue(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNotNull(scheduleDate); begin = end; end = begin.AddSeconds(1); Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); begin = now.AddSeconds(-2); end = now.AddSeconds(-1); Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); begin = now.AddDays(1).AddSeconds(-1); end = now.AddDays(1); Assert.IsTrue(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNotNull(scheduleDate); schedule.RepeatType = ScheduleRepeatType.None; Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); }
public async Task <ActionResult> Edit(PatientEditViewModel model, CancellationToken cancellationToken) { if (ModelState.IsValid) { string newFileName; if (model.PatientId == 0) { Patient patient = model.ToEntity(model, new Patient()); patient.UserId = Int32.Parse(User.Identity.GetUserId()); Patient newPatient = _patientService.Save(patient); model.PatientId = newPatient.PatientId; String newPhoto = SavePatientPhoto(model.UserPhoto, model.PatientId, model.Photo); if (!String.IsNullOrEmpty(newPhoto)) { model.Photo = newPhoto; } if (model.ScheduleRecordId > 0) { ScheduleRecord record = _scheduleService.GetScheduleRecord(Int32.Parse(User.Identity.GetUserId()), model.ScheduleRecordId); if (record != null) { record.PatientId = newPatient.PatientId; _scheduleService.Save(record); } } _patientService.Save(newPatient); } else { Patient oldPatientInfo = _patientService.GetPatientInfo(model.PatientId, Int32.Parse(User.Identity.GetUserId())); if (oldPatientInfo == null) { throw new HttpException(404, "Patient not found"); // TODO: need not found patient page } else { Patient patient = model.ToEntity(model, oldPatientInfo); String newPhoto = SavePatientPhoto(model.UserPhoto, model.PatientId, model.Photo); if (!String.IsNullOrEmpty(newPhoto)) { patient.Photo = newPhoto; } _patientService.Save(patient); } //return RedirectToAction("List"); } return(RedirectToAction("Review", new { id = model.PatientId, })); } FillCountryAndCity(model); return(View(model)); }
public void SchedulerCanScheduleBeEnqueued() { var repository = new Mock<IRepository>(); repository.Setup(r => r.GetScheduleDateExistsForSchedule(It.IsAny<long>(), It.IsAny<DateTime>(), It.IsAny<IDbTransaction>())).Returns(false); var factory = new Mock<IRepositoryFactory>(); factory.Setup(f => f.Create()).Returns(repository.Object); var logger = new Mock<ILogger>(); DateTime? scheduleDate; DateTime now = DateTime.UtcNow.FloorWithSeconds(); ScheduleRecord schedule = new ScheduleRecord() { Id = 1, RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = now }; Scheduler scheduler = new Scheduler( 1, BlueCollarSection.Section.ApplicationName, QueueNameFilters.Any(), BlueCollarSection.Section.WorkerHeartbeat, factory.Object, logger.Object); DateTime begin = now.AddSeconds(-1); DateTime end = now; Assert.IsTrue(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNotNull(scheduleDate); begin = end; end = begin.AddSeconds(1); Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); begin = now.AddSeconds(-2); end = now.AddSeconds(-1); Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); begin = now.AddDays(1).AddSeconds(-1); end = now.AddDays(1); Assert.IsTrue(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNotNull(scheduleDate); schedule.RepeatType = ScheduleRepeatType.None; Assert.IsFalse(scheduler.CanScheduleBeEnqueued(schedule, begin, end, out scheduleDate)); Assert.IsNull(scheduleDate); }
public ScheduleEditingModel(EditorModel model) { this.model = model; int currentMaxWeek = 0; //Create and initialise our schedule collection schedule = new Dictionary <int, SortedList <int, ScheduleRecord> >(); for (int i = 1; i <= NUMBER_OF_WEEKS; i++) { SortedList <int, ScheduleRecord> list = new SortedList <int, ScheduleRecord>(); schedule.Add(i, list); } //Now add the records to these collections foreach (TableRecordModel rec in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords()) { ScheduleRecord scheduleRecord = (ScheduleRecord)rec; try { //Check to ensure we aren't adding records with higher than NUMBER_OF_WEEKS weeks if (scheduleRecord.WeekNumber >= schedule.Count) { //Don't add this week return; } //Store the maximum week for this file so we don't try edit past it if (scheduleRecord.WeekNumber >= currentMaxWeek) { currentMaxWeek = scheduleRecord.WeekNumber; } SortedList <int, ScheduleRecord> list = schedule[scheduleRecord.WeekNumber + 1]; try { list.Add(scheduleRecord.GameNumber, scheduleRecord); } catch (ArgumentException err2) { //Something is wrong with this schedule throw err2; } } catch (KeyNotFoundException err) { Trace.WriteLine(err.ToString()); } } //Make it based from 0 maxWeekNumber = currentMaxWeek + 1; }
public void Accept() { using (var repo = new Repository()) { ScheduleRecord record = repo.GetWhere <ScheduleRecord>((s) => s.ScheduleRecordId == ScheduleView.Id); foreach (var s in StudentRecords) { bool isToUpdate = true; Student stu = repo.Get <Student>(s.Student.StudentId); StudentStatusOnLesson status = repo.GetWhere <StudentStatusOnLesson>((st) => st.StudentId == s.Student.StudentId && st.ScheduleRecordId == record.ScheduleRecordId); if (status == null) { status = new StudentStatusOnLesson(); isToUpdate = false; } status.ScheduleRecord = record; status.Student = stu; status.Date = DateTime.Now; if (s.StatusIndex == 0) { status.StudentStatusId = null; } else { status.StudentStatusId = s.StatusIndex; } if (isToUpdate) { repo.Update(status); } else { repo.Add(status); } } repo.SaveChanges(); } Biscuit.ShowBiscuit("lessonBiscuit"); }
public void SchedulerRefreshSchedules() { ScheduleRecord schedule = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Enabled = true, Id = 1, Name = "Test", QueueName = "*", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; ScheduledJobRecord scheduledJob = new ScheduledJobRecord() { Data = @"{""SleepDuration"":1000}", Id = 1, JobType = JobSerializer.GetTypeName(typeof(TestJob)), Schedule = schedule, ScheduleId = 1 }; schedule.ScheduledJobs.Add(scheduledJob); var transaction = new Mock <IDbTransaction>(); var repository = new Mock <IRepository>(); repository.Setup(r => r.BeginTransaction()).Returns(transaction.Object); repository.Setup(r => r.GetSchedules(BlueCollarSection.Section.ApplicationName, It.IsAny <IDbTransaction>())).Returns(new ScheduleRecord[] { schedule }); var factory = new Mock <IRepositoryFactory>(); factory.Setup(f => f.Create()).Returns(repository.Object); var logger = new Mock <ILogger>(); Scheduler scheduler = new Scheduler(1, BlueCollarSection.Section.ApplicationName, QueueNameFilters.Any(), 1, factory.Object, logger.Object); Assert.AreEqual(0, scheduler.Schedules.Count()); scheduler.RefreshSchedules(); Assert.AreEqual(1, scheduler.Schedules.Count()); }
public void merges_extra_details_correctly() { var extraScheduleDetails = new BasicScheduleExtraDetailsRecord { AtsCode = "ATS", AtocCode = "ATOC", UicCode = "UIC", DataSource = "DATASOURCE", Rsid = "RSID" }; var basicScheduleRecord = new ScheduleRecord(); basicScheduleRecord.MergeExtraScheduleDetails(extraScheduleDetails); Assert.AreEqual(extraScheduleDetails.AtocCode, basicScheduleRecord.AtocCode); Assert.AreEqual(extraScheduleDetails.AtsCode, basicScheduleRecord.AtsCode); Assert.AreEqual(extraScheduleDetails.UicCode, basicScheduleRecord.UicCode); Assert.AreEqual(extraScheduleDetails.DataSource, basicScheduleRecord.DataSource); Assert.AreEqual(extraScheduleDetails.Rsid, basicScheduleRecord.Rsid); }
public void returns_expected_result_with_permanent_record() { var recordParser = BuildParser(); var recordToParse = "BSRY802011512141601011111100 PXX1A521780121702001 E 410 125EP B R CM P"; var expectedResult = new ScheduleRecord { RecordIdentity = ScheduleRecordType.BSR, BankHolidayRunning = BankHolidayRunning.R, TrainUid = "Y80201", DateRunsFrom = new DateTime(2015, 12, 14), DateRunsTo = new DateTime(2016, 1, 1), RunningDays = Days.Monday | Days.Tuesday | Days.Wednesday | Days.Thursday | Days.Friday, TrainStatus = "P", TrainCategory = "XX", TrainIdentity = "1A52", HeadCode = "1780", CourseIndicator = "1", TrainServiceCode = "21702001", PortionId = string.Empty, PowerType = PowerType.E, TimingLoad = "410", Speed = 125, OperatingCharacteristicsString = "EP ", OperatingCharacteristics = OperatingCharacteristics.E | OperatingCharacteristics.P, SeatingClass = SeatingClass.B, Sleepers = SleeperDetails.NotAvailable, Reservations = ReservationDetails.R, ConnectionIndicator = string.Empty, CateringCode = CateringCode.C | CateringCode.M, ServiceBranding = 0, StpIndicator = StpIndicator.P, UniqueId = "Y80201151214P", ServiceTypeFlags = ServiceTypeFlags.Passenger | ServiceTypeFlags.Train }; var result = recordParser.ParseRecord(recordToParse); Assert.AreEqual(expectedResult, result); }
public void InitTeamPlayGames() { PlayGamesList.Clear(); for (int t = 0; t < 32; t++) { PlayGamesList.Add(new List <bool>()); } foreach (TableRecordModel sch in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords()) { ScheduleRecord sr = (ScheduleRecord)sch; if (sr.WeekType != 25 && sr.WeekType != 0) // regular and pre season { continue; } else if (sr.HumanControlled) { PlayGamesList[sr.HomeTeam.TeamId].Add(true); PlayGamesList[sr.AwayTeam.TeamId].Add(true); } } }
public static int SaveScheduleRecord(ScheduleRecord item) { return(instance.db.SaveItem <ScheduleRecord>(item)); }
public static int SaveScheduleRecord(ScheduleRecord item) { return(DukappCore.DAL.DukappRepository.SaveScheduleRecord(item)); }
/// <summary> /// Update scheduled job tests. /// </summary> protected void UpdateScheduledJob() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord jobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.Test.TestJob, BlueCollar.Test", Data = "{}" }; this.Repository.CreateScheduledJob(jobRecord, null); jobRecord.JobType = "BlueCollar.Test.UpdatedJob, BlueCollar.Test"; jobRecord.Data = "{\"One\":null, \"Two\":\"Three\"}"; this.Repository.UpdateScheduledJob(jobRecord, null); ScheduledJobRecord updatedJob = this.Repository.GetScheduledJobList(BlueCollarSection.Section.ApplicationName, scheduleRecord.Id.Value, null, 100, 0, null).Records[0]; Assert.AreEqual(jobRecord.JobType, updatedJob.JobType); Assert.AreEqual(jobRecord.Data, updatedJob.Data); } }
public void SchedulerRefreshSchedules() { ScheduleRecord schedule = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Enabled = true, Id = 1, Name = "Test", QueueName = "*", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; ScheduledJobRecord scheduledJob = new ScheduledJobRecord() { Data = @"{""SleepDuration"":1000}", Id = 1, JobType = JobSerializer.GetTypeName(typeof(TestJob)), Schedule = schedule, ScheduleId = 1 }; schedule.ScheduledJobs.Add(scheduledJob); var transaction = new Mock<IDbTransaction>(); var repository = new Mock<IRepository>(); repository.Setup(r => r.BeginTransaction()).Returns(transaction.Object); repository.Setup(r => r.GetSchedules(BlueCollarSection.Section.ApplicationName, It.IsAny<IDbTransaction>())).Returns(new ScheduleRecord[] { schedule }); var factory = new Mock<IRepositoryFactory>(); factory.Setup(f => f.Create()).Returns(repository.Object); var logger = new Mock<ILogger>(); Scheduler scheduler = new Scheduler(1, BlueCollarSection.Section.ApplicationName, QueueNameFilters.Any(), 1, factory.Object, logger.Object); Assert.AreEqual(0, scheduler.Schedules.Count()); scheduler.RefreshSchedules(); Assert.AreEqual(1, scheduler.Schedules.Count()); }
/// <summary> /// Delete all tests. /// </summary> protected void DeleteAll() { if (this.Repository != null) { IJob job = new TestJob() { Id = Guid.NewGuid() }; WorkerRecord workerRecord = new WorkerRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, MachineAddress = Machine.Address, MachineName = Machine.Name, Name = "Test Worker", QueueNames = "*", Signal = WorkerSignal.Stop, Status = WorkerStatus.Working, Startup = WorkerStartupType.Automatic, UpdatedOn = DateTime.UtcNow }; this.Repository.CreateWorker(workerRecord, null); QueueRecord queueRecord = new QueueRecord() { ApplicationName = workerRecord.ApplicationName, Data = JsonConvert.SerializeObject(job), JobName = job.Name, JobType = job.GetType().FullName + ", " + job.GetType().Assembly.GetName().Name, QueuedOn = DateTime.UtcNow, QueueName = "*", TryNumber = 1 }; this.Repository.CreateQueued(queueRecord, null); ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = workerRecord.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { JobType = JobSerializer.GetTypeName(job.GetType()), ScheduleId = scheduleRecord.Id.Value }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); WorkingRecord workingRecord = new WorkingRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(job), JobName = job.Name, JobType = JobSerializer.GetTypeName(job.GetType()), QueuedOn = DateTime.UtcNow, QueueName = null, ScheduleId = scheduleRecord.Id, StartedOn = DateTime.UtcNow, TryNumber = 1, WorkerId = workerRecord.Id.Value }; this.Repository.CreateWorking(workingRecord, null); HistoryRecord historyRecord = new HistoryRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(job), FinishedOn = DateTime.UtcNow, JobName = job.Name, JobType = JobSerializer.GetTypeName(job.GetType()), QueuedOn = DateTime.UtcNow, ScheduleId = scheduleRecord.Id, StartedOn = DateTime.UtcNow, Status = HistoryStatus.Succeeded, TryNumber = 1, WorkerId = workerRecord.Id.Value }; this.Repository.CreateHistory(historyRecord, null); this.Repository.DeleteAll(BlueCollarSection.Section.ApplicationName, null); Assert.AreEqual(0, this.Repository.GetHistoryList(workerRecord.ApplicationName, null, 100, 0, null).TotalCount); Assert.AreEqual(0, this.Repository.GetWorkingList(workerRecord.ApplicationName, null, 100, 0, null).TotalCount); Assert.AreEqual(0, this.Repository.GetWorkerList(workerRecord.ApplicationName, null, 100, 0, null).TotalCount); Assert.AreEqual(0, this.Repository.GetQueuedList(workerRecord.ApplicationName, null, 100, 0, null).TotalCount); Assert.AreEqual(0, this.Repository.GetScheduledJobList(workerRecord.ApplicationName, scheduleRecord.Id.Value, null, 0, 100, null).TotalCount); Assert.AreEqual(0, this.Repository.GetScheduleList(workerRecord.ApplicationName, null, 100, 0, null).TotalCount); } }
/// <summary> /// Create schedule tests. /// </summary> protected void CreateSchedule() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Enabled = true, Name = "Test", QueueName = "*", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); Assert.IsNotNull(scheduleRecord.Id); } }
/// <summary> /// Get schedule tests. /// </summary> protected void GetSchedule() { if (this.Repository != null) { Assert.IsNull(this.Repository.GetSchedule(12, null)); ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow }; this.Repository.CreateSchedule(scheduleRecord, null); Assert.IsNotNull(this.Repository.GetSchedule(scheduleRecord.Id.Value, null)); } }
public IList <IScheduleRecord> MergeScheduleRecords(IList <IScheduleRecord> scheduleRecords) { if (scheduleRecords == null || !scheduleRecords.Any()) { throw new ArgumentNullException(nameof(scheduleRecords)); } var scheduleEntites = new List <IScheduleRecord>(); ScheduleRecord scheduleRecord = null; foreach (var record in scheduleRecords) { switch (record.RecordIdentity) { case ScheduleRecordType.HD: scheduleEntites.Add(record); break; case ScheduleRecordType.TI: case ScheduleRecordType.TA: case ScheduleRecordType.TD: scheduleEntites.Add(record); break; case ScheduleRecordType.AAN: case ScheduleRecordType.AAR: case ScheduleRecordType.AAD: scheduleEntites.Add(record); break; case ScheduleRecordType.BSN: case ScheduleRecordType.BSR: case ScheduleRecordType.BSD: if (scheduleRecord != null) { scheduleEntites.Add(scheduleRecord); scheduleRecord = null; } scheduleRecord = record as ScheduleRecord; break; case ScheduleRecordType.BX: scheduleRecord?.MergeExtraScheduleDetails(record as BasicScheduleExtraDetailsRecord); break; case ScheduleRecordType.LO: case ScheduleRecordType.LI: case ScheduleRecordType.LT: scheduleRecord?.ScheduleLocations.Add(record as ScheduleLocationRecord); break; case ScheduleRecordType.CR: case ScheduleRecordType.ZZ: break; default: throw new ArgumentOutOfRangeException(); } } return(scheduleEntites); }
/// <summary> /// Get history tests. /// </summary> protected void GetHistoryList() { if (this.Repository != null) { IJob job = new TestJob() { Id = Guid.NewGuid() }; DateTime now = DateTime.UtcNow.FloorWithSeconds(); WorkerRecord workerRecord = new WorkerRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, MachineAddress = Machine.Address, MachineName = Machine.Name, Name = "Test Worker", QueueNames = "*", Signal = WorkerSignal.Stop, Status = WorkerStatus.Working, Startup = WorkerStartupType.Automatic, UpdatedOn = now }; this.Repository.CreateWorker(workerRecord, null); HistoryRecord historyRecord = new HistoryRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(job), FinishedOn = now, JobName = job.Name, JobType = JobSerializer.GetTypeName(job.GetType()), QueuedOn = now, StartedOn = now, Status = HistoryStatus.Succeeded, TryNumber = 1, WorkerId = workerRecord.Id.Value }; this.Repository.CreateHistory(historyRecord, null); var list = this.Repository.GetHistoryList(workerRecord.ApplicationName, null, 100, 0, null); Assert.IsNotNull(list); Assert.AreEqual(1, list.TotalCount); Assert.AreEqual(1, list.Records.Count); list = this.Repository.GetHistoryList(workerRecord.ApplicationName, "boo", 100, 0, null); Assert.IsNotNull(list); Assert.AreEqual(0, list.TotalCount); Assert.AreEqual(0, list.Records.Count); ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = workerRecord.ApplicationName, Enabled = true, Name = "Test", QueueName = "scheduled", RepeatType = ScheduleRepeatType.None, StartOn = now }; this.Repository.CreateSchedule(scheduleRecord, null); historyRecord = new HistoryRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(job), FinishedOn = now, JobName = job.Name, JobType = JobSerializer.GetTypeName(job.GetType()), QueuedOn = now, ScheduleId = scheduleRecord.Id.Value, StartedOn = now, Status = HistoryStatus.Succeeded, TryNumber = 1, WorkerId = workerRecord.Id.Value }; this.Repository.CreateHistory(historyRecord, null); list = this.Repository.GetHistoryList(workerRecord.ApplicationName, null, 100, 0, null); Assert.IsNotNull(list); Assert.AreEqual(2, list.TotalCount); Assert.AreEqual(2, list.Records.Count); Assert.IsTrue(list.Records.Where(h => h.ScheduleName == "Test").Count() == 1); } }
public DataGridViewRow CreateDataGridRow(ScheduleRecord record) { //Bloody hell. I can't see how to put actual objects in the //datagridviewcomboboxcells so I'm just putting strings. //It sucks but I'll fix it later if I find out how //http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxeditingcontrol.aspx DataGridViewRow viewRow = new DataGridViewRow(); DataGridViewComboBoxCell stateCell = new DataGridViewComboBoxCell(); //stateCell.ValueType = typeof(GenericRecord); foreach (GenericRecord val in record.GameStates) { stateCell.Items.Add(val.ToString()); } stateCell.Value = record.State.ToString(); DataGridViewComboBoxCell homeCell = new DataGridViewComboBoxCell(); foreach (TableRecordModel rec in model.TableModels[EditorModel.TEAM_TABLE].GetRecords()) { homeCell.Items.Add(rec.ToString()); } //Only add Undecided teams if its the playoffs. May need to change this to PLAYOFF_WEEK + 1 because //I think the wildcard weekend is always calculated. if (record.WeekNumber >= ScheduleEditingModel.PLAYOFF_WEEK) { homeCell.Items.Add(ScheduleEditingModel.UNDECIDED_TEAM); } if (record.HomeTeam == null) { homeCell.Value = ScheduleEditingModel.UNDECIDED_TEAM; } else { homeCell.Value = record.HomeTeam.Name; } DataGridViewTextBoxCell homeScoreCell = new DataGridViewTextBoxCell(); homeScoreCell.Value = record.HomeTeamScore; DataGridViewComboBoxCell awayCell = new DataGridViewComboBoxCell(); foreach (TableRecordModel rec in model.TableModels[EditorModel.TEAM_TABLE].GetRecords()) { awayCell.Items.Add(rec.ToString()); } //Only add Undecided teams if its the playoffs. May need to change this to PLAYOFF_WEEK + 1 because //I think the wildcard weekend is always calculated. if (record.WeekNumber >= ScheduleEditingModel.PLAYOFF_WEEK) { awayCell.Items.Add(ScheduleEditingModel.UNDECIDED_TEAM); } if (record.AwayTeam == null) { awayCell.Value = ScheduleEditingModel.UNDECIDED_TEAM; } else { awayCell.Value = record.AwayTeam.Name; } DataGridViewTextBoxCell awayScoreCell = new DataGridViewTextBoxCell(); awayScoreCell.Value = record.AwayTeamScore; DataGridViewCheckBoxCell overtimeCell = new DataGridViewCheckBoxCell(); overtimeCell.Value = record.OverTime; DataGridViewComboBoxCell dayTypeCell = new DataGridViewComboBoxCell(); foreach (GenericRecord val in record.GameDayTypes) { dayTypeCell.Items.Add(val.ToString()); } // dayTypeCell.Value = record.DayType; dayTypeCell.Value = record.DayType.ToString(); DataGridViewComboBoxCell weightingCell = new DataGridViewComboBoxCell(); foreach (GenericRecord val in record.GameWeightings) { weightingCell.Items.Add(val.ToString()); } // weightingCell.Value = record.Weighting; weightingCell.Value = record.Weighting.ToString(); viewRow.Cells.Add(stateCell); viewRow.Cells.Add(homeCell); viewRow.Cells.Add(homeScoreCell); viewRow.Cells.Add(awayCell); viewRow.Cells.Add(awayScoreCell); viewRow.Cells.Add(overtimeCell); viewRow.Cells.Add(dayTypeCell); viewRow.Cells.Add(weightingCell); return(viewRow); }
/// <summary> /// Get counts tests. /// </summary> protected void GetCounts() { if (this.Repository != null) { IJob job = new TestJob() { Id = Guid.NewGuid() }; string jobData = JobSerializer.Serialize(job); string typeName = JobSerializer.GetTypeName(job.GetType()); WorkerRecord workerRecord = new WorkerRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, MachineAddress = Machine.Address, MachineName = Machine.Name, Name = "Test Worker", QueueNames = "*", Signal = WorkerSignal.Stop, Status = WorkerStatus.Working, Startup = WorkerStartupType.Automatic, UpdatedOn = DateTime.UtcNow }; this.Repository.CreateWorker(workerRecord, null); QueueRecord queueRecord = new QueueRecord() { ApplicationName = workerRecord.ApplicationName, Data = jobData, JobName = job.Name, JobType = typeName, QueuedOn = DateTime.UtcNow, QueueName = "*", TryNumber = 1 }; this.Repository.CreateQueued(queueRecord, null); for (int i = 0; i < 10; i++) { HistoryRecord historyRecord = new HistoryRecord() { ApplicationName = workerRecord.ApplicationName, Data = jobData, FinishedOn = DateTime.UtcNow, JobName = job.Name, JobType = typeName, QueuedOn = DateTime.UtcNow, QueueName = "*", StartedOn = DateTime.UtcNow, Status = HistoryStatus.Succeeded, TryNumber = 1, WorkerId = workerRecord.Id.Value }; this.Repository.CreateHistory(historyRecord, null); } ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = workerRecord.ApplicationName, Name = "Test Schedule 1", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow }; this.Repository.CreateSchedule(scheduleRecord, null); scheduleRecord.Id = null; scheduleRecord.Name = "Test Schedule 2"; this.Repository.CreateSchedule(scheduleRecord, null); CountsRecord counts = this.Repository.GetCounts(workerRecord.ApplicationName, null); Assert.IsNotNull(counts); Assert.AreEqual(10, counts.HistoryCount); Assert.AreEqual(1, counts.QueueCount); Assert.AreEqual(2, counts.ScheduleCount); Assert.AreEqual(1, counts.WorkerCount); Assert.AreEqual(0, counts.WorkingCount); } }
/// <summary> /// Delete scheduled job tests. /// </summary> protected void DeleteScheduledJob() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.Test.TestJob, BlueCollar.Test", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); this.Repository.DeleteScheduledJob(scheduledJobRecord.Id.Value, null); Assert.AreEqual(0, this.Repository.GetScheduledJobList(BlueCollarSection.Section.ApplicationName, scheduleRecord.Id.Value, null, 100, 0, null).TotalCount); } }
/// <summary> /// Delete schedule tests. /// </summary> protected void DeleteSchedule() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); this.Repository.DeleteSchedule(scheduleRecord.Id.Value, null); Assert.IsNull(this.Repository.GetScheduledJobList(BlueCollarSection.Section.ApplicationName, scheduleRecord.Id.Value, null, 1, 0, null).Id); } }
public void throws_when_argument_is_null() { var basicScheduleRecord = new ScheduleRecord(); Assert.Throws <ArgumentNullException>(() => basicScheduleRecord.MergeExtraScheduleDetails(null)); }
public void ApplyChanges() { // set owner table for user/cpu controlled teams for (int o = 0; o < teamview.RowCount; o++) { TableRecordModel t = model.TableModels[EditorModel.OWNER_TABLE].GetRecord(o); OwnerRecord owner = (OwnerRecord)t; if ((string)teamview.Rows[o].Cells[1].Value == "USER") { owner.UserControlled = true; } else { owner.UserControlled = false; } foreach (TableRecordModel trm in model.TableModels[EditorModel.COACH_TABLE].GetRecords()) { CoachRecord crec = (CoachRecord)trm; if (owner.TeamId == crec.TeamId && crec.Position == 0) // Position 0 is Head coach { if ((string)teamview.Rows[o].Cells[2].Value == "USER") { crec.UserControlled = true; crec.CPUControlled = false; // not sure what this does, but it needs to be set as user controlled } else { crec.UserControlled = false; crec.CPUControlled = true; // again this needs to be set } if ((string)teamview.Rows[o].Cells[3].Value == "CPU") { crec.CPUDraftPlayer = true; owner.DraftPlayers = true; } else { crec.CPUDraftPlayer = false; owner.DraftPlayers = false; } if ((string)teamview.Rows[o].Cells[4].Value == "CPU") { crec.CPUSignDraftPicks = true; owner.SignDraftPicks = true; } else { crec.CPUSignDraftPicks = false; owner.SignDraftPicks = false; } if ((string)teamview.Rows[o].Cells[5].Value == "CPU") { crec.CPUSignFreeAgents = true; owner.SignFreeAgents = true; } else { crec.CPUSignFreeAgents = false; owner.SignFreeAgents = false; } if ((string)teamview.Rows[o].Cells[6].Value == "CPU") { crec.CPUFillRosters = true; owner.FillRosters = true; } else { crec.CPUFillRosters = false; owner.FillRosters = false; } if ((string)teamview.Rows[o].Cells[7].Value == "CPU") { crec.CPUResignPlayers = true; owner.ResignPlayers = true; } else { crec.CPUResignPlayers = false; owner.ResignPlayers = false; } if ((string)teamview.Rows[o].Cells[8].Value == "CPU") { crec.CPUManageDepth = true; owner.ReorderDepthCharts = true; } else { crec.CPUManageDepth = false; owner.ReorderDepthCharts = false; } if ((string)teamview.Rows[o].Cells[9].Value == "YES" && (string)teamview.Rows[o].Cells[1].Value == "USER") { if (model.FranchiseStage.CurrentStage < 7) // No schedule exists while in training camp { return; } // Fix Scheduled Games foreach (TableRecordModel sch in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords()) { ScheduleRecord sr = (ScheduleRecord)sch; if (sr.WeekType != 25 && sr.WeekType != 0) // regular and pre season { continue; } if (owner.TeamId == sr.AwayTeam.TeamId || owner.TeamId == sr.HomeTeam.TeamId) { TeamRecord team = model.TeamModel.GetTeamRecord(owner.TeamId); if (PlayALLGames_Checkbox.Checked) { sr.HumanControlled = true; } else if (PlayAwayGames_Checkbox.Checked && sr.AwayTeam.TeamId == owner.TeamId) { sr.HumanControlled = true; } else if (PlayHomeGames_Checkbox.Checked && sr.HomeTeam.TeamId == owner.TeamId) { sr.HumanControlled = true; } else if (PlayDIVGames_Checkbox.Checked) { if (team.TeamId != sr.HomeTeam.TeamId && team.DivisionId == sr.HomeTeam.TeamId) { sr.HumanControlled = true; } else if (team.TeamId != sr.AwayTeam.TeamId && team.DivisionId == sr.AwayTeam.DivisionId) { sr.HumanControlled = true; } else { sr.HumanControlled = false; } } else { sr.HumanControlled = false; } } else { sr.HumanControlled = false; } } } break; } } } }
/// <summary> /// Update scheduled job order tests. /// </summary> protected void UpdateScheduledJobOrder() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord jobRecord1 = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, Number = 1, JobType = "BlueCollar.Test.TestJob, BlueCollar.Test", Data = "{}" }; this.Repository.CreateScheduledJob(jobRecord1, null); ScheduledJobRecord jobRecord2 = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, Number = 2, JobType = "BlueCollar.Test.TestJob, BlueCollar.Test", Data = "{}" }; this.Repository.CreateScheduledJob(jobRecord2, null); ScheduledJobRecord jobRecord3 = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, Number = 3, JobType = "BlueCollar.Test.TestJob, BlueCollar.Test", Data = "{}" }; this.Repository.CreateScheduledJob(jobRecord3, null); this.Repository.UpdateScheduledJobOrder(new ScheduledJobOrderRecord() { Id = jobRecord1.Id.Value, Number = 2, ScheduleId = scheduleRecord.Id.Value }, null); ScheduledJobRecordList jobList = this.Repository.GetScheduledJobList(scheduleRecord.ApplicationName, scheduleRecord.Id.Value, null, 100, 0, null); Assert.IsNotNull(jobList); Assert.AreEqual(3, jobList.Records.Count); Assert.AreEqual(2, jobList.Records.First(j => j.Id == jobRecord1.Id).Number); Assert.AreEqual(1, jobList.Records.First(j => j.Id == jobRecord2.Id).Number); Assert.AreEqual(3, jobList.Records.First(j => j.Id == jobRecord3.Id).Number); this.Repository.UpdateScheduledJobOrder(new ScheduledJobOrderRecord() { Id = jobRecord3.Id.Value, Number = 1, ScheduleId = scheduleRecord.Id.Value }, null); jobList = this.Repository.GetScheduledJobList(scheduleRecord.ApplicationName, scheduleRecord.Id.Value, null, 100, 0, null); Assert.IsNotNull(jobList); Assert.AreEqual(3, jobList.Records.Count); Assert.AreEqual(3, jobList.Records.First(j => j.Id == jobRecord1.Id).Number); Assert.AreEqual(2, jobList.Records.First(j => j.Id == jobRecord2.Id).Number); Assert.AreEqual(1, jobList.Records.First(j => j.Id == jobRecord3.Id).Number); } }
/// <summary> /// Get schedules tests. /// </summary> protected void GetSchedules() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); scheduleRecord.Id = null; scheduleRecord.Name = "Weekly"; scheduleRecord.RepeatType = ScheduleRepeatType.Weeks; this.Repository.CreateSchedule(scheduleRecord, null); scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob2, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob3, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); var schedules = this.Repository.GetSchedules(scheduleRecord.ApplicationName, null); Assert.AreEqual(2, schedules.Count()); Assert.AreEqual(1, schedules.ElementAt(0).ScheduledJobs.Count); Assert.AreEqual(2, schedules.ElementAt(1).ScheduledJobs.Count); } }
public void throws_when_argument_is_null() { var basicScheduleRecord = new ScheduleRecord(); Assert.Throws<ArgumentNullException>(() => basicScheduleRecord.MergeExtraScheduleDetails(null)); }
/// <summary> /// Create scheduled job tests. /// </summary> protected void CreateScheduledJob() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", QueueName = "*", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { JobType = "BlueCollar.TestScheduledJob, BlueCollar", Data = "{}", ScheduleId = scheduleRecord.Id.Value }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); Assert.IsNotNull(scheduledJobRecord.Id); } }
/// <summary> /// Updates the given schedule. /// </summary> /// <param name="record">The schedule record to update.</param> /// <param name="transaction">The transaction to use, if applicable.</param> /// <returns>The updated record.</returns> public ScheduleRecord UpdateSchedule(ScheduleRecord record, IDbTransaction transaction) { throw new NotImplementedException(); }
public void DashboardHandlerScheduleSave() { var record = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Id = 0, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = new DateTime(2011, 1, 1, 0, 0, 0, DateTimeKind.Utc) }; var transaction = new Mock <IDbTransaction>(); var repository = new Mock <IRepository>(); repository.Setup(r => r.BeginTransaction()).Returns(transaction.Object); repository.Setup(r => r.UpdateSchedule(It.IsAny <ScheduleRecord>(), It.IsAny <IDbTransaction>())).Returns(record); repository .Setup(r => r.CreateSchedule(It.IsAny <ScheduleRecord>(), It.IsAny <IDbTransaction>())) .Returns(record) .Callback(() => { record.Id = new Random().Next(1, 1000); }); var factory = new Mock <IRepositoryFactory>(); factory.Setup(f => f.Create()).Returns(repository.Object); using (SaveScheduleHandler handler = new SaveScheduleHandler(factory.Object)) { handler.ApplicationName = BlueCollarSection.Section.ApplicationName; handler.HandlerRelativeRequestUrl = "~/schedules"; handler.QueryString = new QueryString(); string output; using (MemoryStream inputStream = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(record)))) { using (MemoryStream outputStream = new MemoryStream()) { var context = MockHttpContext("POST", "/schedules", inputStream, outputStream); handler.ProcessRequest(context.Object); outputStream.Position = 0; output = Encoding.UTF8.GetString(outputStream.ToArray()); } } Assert.IsNotNull(output); Assert.IsTrue(output.Length > 0); var outputRecord = JsonConvert.DeserializeAnonymousType(output, new { Id = 0 }); Assert.IsNotNull(outputRecord); Assert.AreEqual(record.Id, outputRecord.Id); using (MemoryStream inputStream = new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(record)))) { using (MemoryStream outputStream = new MemoryStream()) { var context = MockHttpContext("PUT", "/schedules", inputStream, outputStream); handler.ProcessRequest(context.Object); outputStream.Position = 0; output = Encoding.UTF8.GetString(outputStream.ToArray()); } } Assert.IsNotNull(output); Assert.IsTrue(output.Length > 0); outputRecord = JsonConvert.DeserializeAnonymousType(output, new { Id = 0 }); Assert.IsNotNull(outputRecord); Assert.AreEqual(record.Id, outputRecord.Id); } }
/// <summary> /// Create queued and history for schedule tests. /// </summary> protected void CreateQueuedAndHistoryForSchedule() { if (this.Repository != null) { WorkerRecord workerRecord = new WorkerRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, MachineAddress = Machine.Address, MachineName = Machine.Name, Name = "Test Worker", QueueNames = "*", Signal = WorkerSignal.Stop, Status = WorkerStatus.Working, Startup = WorkerStartupType.Automatic, UpdatedOn = DateTime.UtcNow }; this.Repository.CreateWorker(workerRecord, null); ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = workerRecord.ApplicationName, Name = "Test", QueueName = "*", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); List<QueueRecord> queued = new List<QueueRecord>(); List<HistoryRecord> history = new List<HistoryRecord>(); queued.Add( new QueueRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(new TestJob() { Id = Guid.NewGuid() }), JobName = new TestJob().Name, JobType = JobSerializer.GetTypeName(typeof(TestJob)), QueuedOn = scheduleRecord.StartOn, QueueName = "*", TryNumber = 1 }); queued.Add( new QueueRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(new TestJob() { Id = Guid.NewGuid() }), JobName = new TestJob().Name, JobType = JobSerializer.GetTypeName(typeof(TestJob)), QueuedOn = scheduleRecord.StartOn, QueueName = "*", TryNumber = 1 }); history.Add( new HistoryRecord() { ApplicationName = workerRecord.ApplicationName, Data = JobSerializer.Serialize(new TestJob() { Id = Guid.NewGuid() }), Exception = new ExceptionXElement(new InvalidOperationException()).ToString(), FinishedOn = scheduleRecord.StartOn, JobName = new TestJob().Name, JobType = JobSerializer.GetTypeName(typeof(TestJob)), QueuedOn = scheduleRecord.StartOn, QueueName = "*", ScheduleId = scheduleRecord.Id, StartedOn = scheduleRecord.StartOn, Status = HistoryStatus.Failed, TryNumber = 1, WorkerId = workerRecord.Id.Value }); Assert.AreEqual(3, this.Repository.CreateQueuedAndHistoryForSchedule(scheduleRecord.Id.Value, scheduleRecord.StartOn, queued, history, null)); } }
/// <summary> /// Get schedule list tests. /// </summary> protected void GetScheduleList() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); scheduleRecord.Id = null; scheduleRecord.Name = "Weekly"; scheduleRecord.RepeatType = ScheduleRepeatType.Weeks; this.Repository.CreateSchedule(scheduleRecord, null); scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob2, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); scheduledJobRecord = new ScheduledJobRecord() { ScheduleId = scheduleRecord.Id.Value, JobType = "BlueCollar.TestScheduledJob3, BlueCollar", Data = "{}" }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); RecordList<ScheduleListRecord> schedules = this.Repository.GetScheduleList(BlueCollarSection.Section.ApplicationName, null, 100, 0, null); Assert.IsNotNull(schedules); Assert.AreEqual(2, schedules.TotalCount); Assert.AreEqual(2, schedules.Records.Count); Assert.AreEqual("Nightly", schedules.Records[0].Name); Assert.AreEqual(1, schedules.Records[0].JobCount); Assert.AreEqual("Weekly", schedules.Records[1].Name); Assert.AreEqual(2, schedules.Records[1].JobCount); } }
/// <summary> /// Get scheduled job list tests. /// </summary> protected void GetScheduledJobList() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecordList list = this.Repository.GetScheduledJobList(BlueCollarSection.Section.ApplicationName, scheduleRecord.Id.Value, null, 1, 0, null); Assert.IsNotNull(list.Id); Assert.AreEqual(0, list.Records.Count); list = this.Repository.GetScheduledJobList(BlueCollarSection.Section.ApplicationName, scheduleRecord.Id.Value, "boo", 50, 0, null); Assert.IsNotNull(list.Id); Assert.AreEqual(0, list.Records.Count); } }
protected void ReleaseScheduleEnqueueingLock() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Enabled = false, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); Assert.IsTrue(this.Repository.GetScheduleEnqueueingLock(scheduleRecord.Id.Value, DateTime.UtcNow.AddMinutes(-1), null)); Assert.IsFalse(this.Repository.GetScheduleEnqueueingLock(scheduleRecord.Id.Value, DateTime.UtcNow.AddMinutes(-1), null)); this.Repository.ReleaseScheduleEnqueueingLock(scheduleRecord.Id.Value, null); Assert.IsTrue(this.Repository.GetScheduleEnqueueingLock(scheduleRecord.Id.Value, DateTime.UtcNow.AddMinutes(-1), null)); } }
/// <summary> /// Update schedule tests. /// </summary> protected void UpdateSchedule() { if (this.Repository != null) { ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Enabled = false, Name = "Nightly", QueueName = "schedules", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = DateTime.UtcNow.FloorWithSeconds() }; this.Repository.CreateSchedule(scheduleRecord, null); scheduleRecord.Enabled = true; scheduleRecord.Name = "Bi-Weekly"; scheduleRecord.QueueName = null; scheduleRecord.RepeatType = ScheduleRepeatType.Weeks; scheduleRecord.RepeatValue = 2; scheduleRecord.StartOn = new DateTime(2011, 1, 1, 0, 0, 0, DateTimeKind.Utc); this.Repository.UpdateSchedule(scheduleRecord, null); ScheduleRecord updatedRecord = this.Repository.GetSchedules(BlueCollarSection.Section.ApplicationName, null).Where(s => s.Id == scheduleRecord.Id).First(); Assert.AreEqual(scheduleRecord.Enabled, updatedRecord.Enabled); Assert.AreEqual(scheduleRecord.Name, updatedRecord.Name); Assert.AreEqual(scheduleRecord.QueueName, updatedRecord.QueueName); Assert.AreEqual(scheduleRecord.RepeatType, updatedRecord.RepeatType); Assert.AreEqual(scheduleRecord.RepeatValue, updatedRecord.RepeatValue); Assert.AreEqual(scheduleRecord.StartOn, updatedRecord.StartOn); } }
public void InitCoaches() { Coaches.Clear(); List <ScheduleRecord> playoffs = new List <ScheduleRecord>(); if (model.FranchiseTime.Week >= 17 && model.FranchiseTime.Week <= 20) { foreach (TableRecordModel rec in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords()) { if (rec.Deleted) { continue; } ScheduleRecord sche = (ScheduleRecord)rec; if (sche.WeekNumber < model.FranchiseTime.Week) { continue; } playoffs.Add(sche); } } foreach (TableRecordModel rec in model.TableModels[EditorModel.COACH_TABLE].GetRecords()) { if (rec.Deleted) { continue; } Coach c = new Coach((CoachRecord)rec); foreach (ScheduleRecord sr in playoffs) { if (c.TEAM_ID != sr.AwayTeamID && c.TEAM_ID != sr.HomeTeamID) { continue; } if (sr.WeekNumber < model.FranchiseTime.Week) { continue; } // at this point the coach's team is still in playoffs, cannot hire c.InPlayoffs = true; c.CanBeHired = false; // currently playing, so cannot interview either if (sr.WeekNumber == model.FranchiseTime.Week) { c.CanBeInterviewed = false; } } // coach will get kicked back into c if currently employed. c = AddCoach(c); // add to team's coaching staff if (c != null && c.TEAM_ID != 1009) { bool del = Teams[c.TEAM_ID].AddCoach(c); } else if (c.LAST_TEAM != 1009) // Also add to team if coach has expiring contract { Teams[c.LAST_TEAM].AddCoach(c); } } if (stream_model != null) { foreach (TableRecordModel rec in stream_model.TableModels[EditorModel.COACH_COLLECTIONS_TABLE].GetRecords()) { if (rec.Deleted) { continue; } AddCoach(new Coach((CoachCollection)rec)); } } }
public IScheduleRecord ParseRecord(string recordString) { if (string.IsNullOrWhiteSpace(recordString)) { throw new ArgumentNullException(nameof(recordString)); } var record = new ScheduleRecord { RecordIdentity = (ScheduleRecordType)_enumPropertyParsers["ScheduleRecordType"].ParseProperty(recordString.Substring(0, 3)), TrainUid = recordString.Substring(3, 6), DateRunsTo = _dateTimeParser.ParseDateTime(new DateTimeParserRequest { DateTimeFormat = "yyMMdd", DateTimeString = recordString.Substring(15, 6) }), RunningDays = (Days)_enumPropertyParsers["RunningDays"].ParseProperty(recordString.Substring(21, 7)), BankHolidayRunning = (BankHolidayRunning)_enumPropertyParsers["BankHolidayRunning"].ParseProperty(recordString.Substring(28, 1)), TrainStatus = recordString.Substring(29, 1).Trim(), TrainCategory = recordString.Substring(30, 2).Trim(), TrainIdentity = recordString.Substring(32, 4).Trim(), HeadCode = recordString.Substring(36, 4).Trim(), CourseIndicator = recordString.Substring(40, 1).Trim(), TrainServiceCode = recordString.Substring(41, 8).Trim(), PortionId = recordString.Substring(49, 1).Trim(), PowerType = (PowerType)_enumPropertyParsers["PowerType"].ParseProperty(recordString.Substring(50, 3).Trim()), TimingLoad = recordString.Substring(53, 4).Trim(), OperatingCharacteristicsString = recordString.Substring(60, 6), SeatingClass = (SeatingClass)_enumPropertyParsers["SeatingClass"].ParseProperty(recordString.Substring(66, 1)), Sleepers = (SleeperDetails)_enumPropertyParsers["SleeperDetails"].ParseProperty(recordString.Substring(67, 1)), Reservations = (ReservationDetails)_enumPropertyParsers["ReservationDetails"].ParseProperty(recordString.Substring(68, 1)), ConnectionIndicator = recordString.Substring(69, 1).Trim(), CateringCode = (CateringCode)_enumPropertyParsers["CateringCode"].ParseProperty(recordString.Substring(70, 4).Trim()), ServiceBranding = (ServiceBranding)_enumPropertyParsers["ServiceBranding"].ParseProperty(recordString.Substring(74, 4).Trim()), StpIndicator = (StpIndicator)_enumPropertyParsers["StpIndicator"].ParseProperty(recordString.Substring(79, 1)) }; int speed; var speedParsed = int.TryParse(recordString.Substring(57, 3).Trim(), NumberStyles.Any, new CultureInfo("en-gb"), out speed); if (speedParsed) { record.Speed = speed; } var dateRunsFromResult = _dateTimeParser.ParseDateTime(new DateTimeParserRequest { DateTimeFormat = "yyMMdd", DateTimeString = recordString.Substring(9, 6) }); if (dateRunsFromResult.HasValue) { record.DateRunsFrom = dateRunsFromResult.Value; } else { throw new ArgumentException("Failed to parse Date Runs From in Basic Schedule Record"); } record.UniqueId = record.TrainUid + recordString.Substring(9, 6) + record.StpIndicator; if (record.TrainCategory == "BR" || record.TrainCategory == "BS") { record.ServiceTypeFlags = record.ServiceTypeFlags | ServiceTypeFlags.Bus; record.ServiceTypeFlags = record.ServiceTypeFlags &= ~ServiceTypeFlags.Train; } else if (record.TrainStatus == "S" || record.TrainStatus == "4") { record.ServiceTypeFlags = record.ServiceTypeFlags | ServiceTypeFlags.Ship; record.ServiceTypeFlags = record.ServiceTypeFlags &= ~ServiceTypeFlags.Train; } if (record.ServiceTypeFlags.HasFlag(ServiceTypeFlags.Bus) || record.ServiceTypeFlags.HasFlag(ServiceTypeFlags.Ship) || record.TrainCategory == "OL" || record.TrainCategory == "OO" || record.TrainCategory == "XC" || record.TrainCategory == "XX" || record.TrainCategory == "XZ") { record.ServiceTypeFlags = record.ServiceTypeFlags | ServiceTypeFlags.Passenger; } record.OperatingCharacteristics = (OperatingCharacteristics)_enumPropertyParsers["OperatingCharacteristics"].ParseProperty(record.OperatingCharacteristicsString); return(record); }
public TableRecordModel ConstructRecordModel(int recno) { TableRecordModel newRecord = null; string tablename = name; // Need to reverse the name if BE if (BigEndian) { string rev = ConvertBE(name); tablename = rev; } switch (tablename) { case EditorModel.CITY_TABLE: newRecord = new CityRecord(recno, this, parentModel); break; case EditorModel.COACH_TABLE: { // coch table in streameddata is different than ros/fra if (parentModel.FileType == MaddenFileType.Streameddata) { newRecord = new CoachCollection(recno, this, parentModel); } else { newRecord = new CoachRecord(recno, this, parentModel); } break; } case EditorModel.SALARY_CAP_TABLE: newRecord = new SalaryCapRecord(recno, this, parentModel); break; case EditorModel.COACH_SLIDER_TABLE: newRecord = new CoachPrioritySliderRecord(recno, this, parentModel); break; case EditorModel.TEAM_CAPTAIN_TABLE: newRecord = new TeamCaptainRecord(recno, this, parentModel); break; case EditorModel.OWNER_TABLE: newRecord = new OwnerRecord(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_TABLE: newRecord = new DepthChartRecord(recno, this, parentModel); break; case EditorModel.INJURY_TABLE: newRecord = new InjuryRecord(recno, this, parentModel); break; case EditorModel.PLAYER_TABLE: newRecord = new PlayerRecord(recno, this, parentModel); break; case EditorModel.TEAM_TABLE: newRecord = new TeamRecord(recno, this, parentModel); break; case EditorModel.SCHEDULE_TABLE: newRecord = new ScheduleRecord(recno, this, parentModel); break; case EditorModel.STADIUM_TABLE: newRecord = new StadiumRecord(recno, this, parentModel); break; case EditorModel.UNIFORM_TABLE: newRecord = new UniformRecord(recno, this, parentModel); break; // MADDEN DRAFT EDIT case EditorModel.DRAFT_PICK_TABLE: newRecord = new DraftPickRecord(recno, this, parentModel); break; case EditorModel.DRAFTED_PLAYERS_TABLE: newRecord = new RookieRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_DEFENSE_TABLE: newRecord = new BoxScoreDefenseRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSE_TABLE: newRecord = new BoxScoreOffenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_DEFENSE_TABLE: newRecord = new CareerStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSE_TABLE: newRecord = new CareerStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_DEFENSE_TABLE: newRecord = new SeasonStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSE_TABLE: newRecord = new SeasonStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.TEAM_SEASON_STATS: newRecord = new TeamSeasonStatsRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_TIME_TABLE: newRecord = new FranchiseTimeRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_TEAM_TABLE: newRecord = new BoxScoreTeamStats(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSIVE_LINE_TABLE: newRecord = new BoxScoreOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSIVE_LINE_TABLE: newRecord = new SeasonStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSIVE_LINE_TABLE: newRecord = new CareerStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_GAMES_PLAYED_TABLE: newRecord = new CareerGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.SEASON_GAMES_PLAYED_TABLE: newRecord = new SeasonGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_TABLE: newRecord = new CareerPuntKickRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_TABLE: newRecord = new SeasonPuntKickRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_RETURN_TABLE: newRecord = new CareerPKReturnRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_RETURN_TABLE: newRecord = new SeasonPKReturnRecord(recno, this, parentModel); break; case EditorModel.SCOUTING_STATE_TABLE: newRecord = new ScoutingStateRecord(recno, this, parentModel); break; case EditorModel.RFA_STATE_TABLE: newRecord = new RFAStateRecord(recno, this, parentModel); break; case EditorModel.RFA_PLAYERS: newRecord = new RestrictedFreeAgentPlayers(recno, this, parentModel); break; case EditorModel.RFA_SALARY_TENDERS: newRecord = new RestrictedFreeAgentSigningTenders(recno, this, parentModel); break; case EditorModel.RESIGN_PLAYERS_STATE_TABLE: newRecord = new ResignPlayersStateRecord(recno, this, parentModel); break; case EditorModel.FREE_AGENCY_STATE_TABLE: newRecord = new FreeAgencyStateRecord(recno, this, parentModel); break; case EditorModel.DRAFT_STATE_TABLE: newRecord = new DraftStateRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_STAGE_TABLE: newRecord = new FranchiseStageRecord(recno, this, parentModel); break; case EditorModel.GAME_OPTIONS_TABLE: newRecord = new GameOptionRecord(recno, this, parentModel); break; case EditorModel.PLAYER_AWARDS_TABLE: newRecord = new YearlyAwards(recno, this, parentModel); break; case EditorModel.FREE_AGENT_PLAYERS: newRecord = new FreeAgentPlayers(recno, this, parentModel); break; case EditorModel.COACHES_EXPECTED_SALARY: newRecord = new CoachExpectedSalary(recno, this, parentModel); break; case EditorModel.COACHING_HISTORY_TABLE: newRecord = new CoachHistory(recno, this, parentModel); break; case EditorModel.PROGRESSION_SCHEDULE: newRecord = new ProgressionSchedule(recno, this, parentModel); break; case EditorModel.USER_OPTIONS_TABLE: newRecord = new UserOptionRecord(recno, this, parentModel); break; case EditorModel.TEAM_RIVAL_HISTORY: newRecord = new TeamRivalHistory(recno, this, parentModel); break; case EditorModel.PRO_BOWL_PLAYERS: newRecord = new ProBowlPlayer(recno, this, parentModel); break; case EditorModel.USER_INFO_TABLE: newRecord = new UserInfoRecord(recno, this, parentModel); break; #region Streamed Data case EditorModel.COLLEGES_TABLE: newRecord = new CollegesRecord(recno, this, parentModel); break; case EditorModel.PLAYER_FIRST_NAMES: newRecord = new FirstNames(recno, this, parentModel); break; case EditorModel.PLAYER_LAST_NAMES: newRecord = new LastNames(recno, this, parentModel); break; case EditorModel.ROLES_DEFINE: newRecord = new PRDF(recno, this, parentModel); break; case EditorModel.ROLES_INFO: newRecord = new RoleInfo(recno, this, parentModel); break; case EditorModel.ROLES_PLAYER_EFFECTS: newRecord = new RolePlayerEffects(recno, this, parentModel); break; case EditorModel.ROLES_TEAM_EFFECTS: newRecord = new RoleTeamEffects(recno, this, parentModel); break; case EditorModel.STATS_REQUIRED: newRecord = new SuperStarStatsRequired(recno, this, parentModel); break; case EditorModel.PROGRESSION: newRecord = new PlayerProgression(recno, this, parentModel); break; case EditorModel.REGRESSION: newRecord = new PlayerRegression(recno, this, parentModel); break; case EditorModel.PTCB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTCE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDT: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTGA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTHB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKI: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKP: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTMB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTOB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTPU: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTQB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTSS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTWR: newRecord = new ProgressionTracking(recno, this, parentModel); break; #endregion case EditorModel.POSITION_SUBS: newRecord = new PlayerSubs(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_SUBS: newRecord = new DepthChartSubs(recno, this, parentModel); break; case EditorModel.SALARY_CAP_INCREASE: newRecord = new SalaryCapIncrease(recno, this, parentModel); break; case EditorModel.PLAYER_MINIMUM_SALARY_TABLE: newRecord = new SalaryYearsPro(recno, this, parentModel); break; case EditorModel.PLAYER_SALARY_DEMAND_TABLE: newRecord = new PlayerSalaryDemands(recno, this, parentModel); break; case EditorModel.INACTIVE_TABLE: newRecord = new InactiveRecord(recno, this, parentModel); break; case EditorModel.LEAGUE_REVENUE_TABLE: newRecord = new LeagueRevenue(recno, this, parentModel); break; case EditorModel.OWNER_REVENUE_TABLE: newRecord = new OwnerRevenue(recno, this, parentModel); break; case EditorModel.WEEKLY_INCOME_TABLE: newRecord = new Income(recno, this, parentModel); break; case EditorModel.TEAM_WIN_LOSS_RECORD: newRecord = new TeamWinLossRecord(recno, this, parentModel); break; // DB Templates case EditorModel.PLAYER_OVERALL_CALC: newRecord = new OverallRecord(recno, this, parentModel); break; case EditorModel.PLAYBOOK_TABLE: newRecord = new FRAPlayBooks(recno, this, parentModel); break; default: newRecord = new TableRecordModel(recno, this, parentModel); break; } //Add the new record to our list of records recordList.Add(newRecord); return(newRecord); }
/// <summary> /// Get schedule date exists for schedule tests. /// </summary> protected void GetScheduleDateExistsForSchedule() { if (this.Repository != null) { DateTime now = DateTime.UtcNow.FloorWithSeconds(); TestJob job = new TestJob(); ScheduleRecord scheduleRecord = new ScheduleRecord() { ApplicationName = BlueCollarSection.Section.ApplicationName, Name = "Test", RepeatType = ScheduleRepeatType.Days, RepeatValue = 1, StartOn = now.AddDays(-1) }; this.Repository.CreateSchedule(scheduleRecord, null); ScheduledJobRecord scheduledJobRecord = new ScheduledJobRecord() { JobType = JobSerializer.GetTypeName(job), ScheduleId = scheduleRecord.Id.Value }; this.Repository.CreateScheduledJob(scheduledJobRecord, null); Assert.IsFalse(this.Repository.GetScheduleDateExistsForSchedule(scheduleRecord.Id.Value, now, null)); QueueRecord queueRecord = new QueueRecord() { ApplicationName = scheduleRecord.ApplicationName, Data = JobSerializer.Serialize(job), JobName = job.Name, JobType = JobSerializer.GetTypeName(job), QueuedOn = now, ScheduleId = scheduleRecord.Id, TryNumber = 1 }; this.Repository.CreateQueued(queueRecord, null); Assert.IsTrue(this.Repository.GetScheduleDateExistsForSchedule(scheduleRecord.Id.Value, now, null)); } }