public void BuildUp() { // Initialize appointment entity appointment_1 = new Appointment(); greaterThan = new Appointment(); // Initialize data for fields controlRoomUser = new User("control", "room", "*****@*****.**", NotificationTypeEnum.SMS); startTime_1 = DateTime.UtcNow; endTime_1 = DateTime.UtcNow.AddHours(1); celestial_body = new CelestialBody(CelestialBodyConstants.SUN); orientation = new Orientation(20, 20); coordinate = new Coordinate(20, 20); spectraCyber = new SpectraCyber(); telescope = new RadioTelescope(new SpectraCyberController(spectraCyber), new TestPLCDriver(PLCConstants.LOCAL_HOST_IP, PLCConstants.LOCAL_HOST_IP, 8089, 8089, false), new Location(), new Orientation()); rf_data = new RFData(); rf_data.Intensity = 100; status = AppointmentStatusEnum.REQUESTED; type = AppointmentTypeEnum.POINT; spectracyber_config = new SpectraCyberConfig(SpectraCyberModeTypeEnum.CONTINUUM); startTime_2 = DateTime.UtcNow.AddDays(1); endTime_2 = DateTime.UtcNow.AddDays(1).AddHours(1); // Initialize fields we are testing against appointment_1.User = controlRoomUser; appointment_1.start_time = startTime_1; appointment_1.end_time = endTime_1; appointment_1.CelestialBody = celestial_body; appointment_1.Orientation = orientation; appointment_1.Coordinates.Add(coordinate); appointment_1.RFDatas.Add(rf_data); appointment_1._Status = status; appointment_1._Type = type; appointment_1.SpectraCyberConfig = spectracyber_config; appointment_1.Telescope = telescope; greaterThan.start_time = startTime_2; greaterThan.end_time = endTime_2; equalTo = appointment_1; }
public void BuildUp() { // Initialize appointment entity appointment_1 = new Appointment(); appointment_2 = new Appointment(); // Initialize data for fields user_id = 1; startTime_1 = DateTime.UtcNow; endTime_1 = DateTime.UtcNow.AddHours(1); celestial_body = new CelestialBody(CelestialBodyConstants.SUN); orientation = new Orientation(20, 20); coordinate = new Coordinate(20, 20); rf_data = new RFData(); rf_data.Intensity = 100; telescope_id = 1; status = AppointmentStatusEnum.REQUESTED; type = AppointmentTypeEnum.POINT; spectracyber_config = new SpectraCyberConfig(SpectraCyberModeTypeEnum.CONTINUUM); startTime_2 = DateTime.UtcNow.AddDays(1); endTime_2 = DateTime.UtcNow.AddDays(1).AddHours(1); // Initialize fields we are testing against appointment_1.UserId = user_id; appointment_1.StartTime = startTime_1; appointment_1.EndTime = endTime_1; appointment_1.CelestialBody = celestial_body; appointment_1.Orientation = orientation; appointment_1.Coordinates.Add(coordinate); appointment_1.RFDatas.Add(rf_data); appointment_1.TelescopeId = telescope_id; appointment_1.Status = status; appointment_1.Type = type; appointment_1.SpectraCyberConfig = spectracyber_config; appointment_2.StartTime = startTime_2; appointment_2.EndTime = endTime_2; }
/// <summary> /// Sends SignalR change notifications to all participants of the appointment /// </summary> private async Task NotifyParticipantsAsync(string[] nickNames, AppointmentStatusEnum status) { var hubContext = HubContextTask.Result; // This actor's ID is the appointmentId as well var appointmentId = this.Id.GetGuidId(); foreach (string nickName in nickNames) { await hubContext.Clients.User(nickName).SendCoreAsync(AppointmentStateChangedClientHandlerName, new[] { new { id = appointmentId, participants = nickNames, status } } ); } }
// Informs participants of the appointment state changes via SignalR private async Task NotifyParticipants(string[] nickNames, AppointmentStatusEnum status) { string appointmentId = Entity.Current.EntityKey; foreach (string nickName in nickNames) { var signalRMessage = new SignalRMessage { UserId = nickName, Target = Functions.SignalRClientHandlerName, Arguments = new[] { new { id = appointmentId, participants = nickNames, status } } }; await signalRCollector.AddAsync(signalRMessage); } }
/// <summary> /// Sends SignalR change notifications to all participants of the appointment /// </summary> private async Task NotifyParticipantsAsync(string appointmentId, string[] nickNames, AppointmentStatusEnum status) { foreach (string nickName in nickNames) { await this.hubContext.Clients.User(nickName).SendCoreAsync(AppointmentStateChangedClientHandlerName, new[] { new { id = appointmentId, participants = nickNames, status } } ); } }