private static ResponseAttribute getResponseType(string rawMessage) { Match match = cpdlcDataRegex.Match(rawMessage); ResponseAttribute responseType = responseAttributeStrings.FirstOrDefault(x => x.Value == match.Groups[3].Value).Key; return(responseType); }
private static string GetDataString( int messageCount, int responseMessageId, ResponseAttribute responseType, CPDLCUplinkMessageType messageType) { return(GetDataString(messageCount, responseMessageId, responseType, getAtcMessage(messageType))); }
private ResponseObjectOrReference BuildResponseObject(ResponseAttribute ra) { var ro = new ResponseObject(); ro.Description = ra.Description; ro.Content = new Dictionary <string, MediaTypeObject>(); ro.Content["application/json"] = BuildMediaTypeObject(ra.ResponseType); return(ro); }
private static string GetDataString( int messageCount, int responseMessageId, ResponseAttribute responseType, string message) { // Example: "/data2/17//WU/CROSS @SPL@ AT @5000" string dataString = String.Format("/data2/{0}/{1}/{2}/{3}", (messageCount > 0 ? messageCount.ToString() : ""), (responseMessageId > 0 ? responseMessageId.ToString() : ""), responseAttributeStrings[responseType], message); return(dataString); }
/// <summary> /// Use to create a new CPDLC Message object /// </summary> /// <param name="recievedAt">When the message was recieved by the client (not when it was created or sent from the sender station)</param> /// <param name="from">Callsign from which the message was recieved</param> /// <param name="to">Callsign to which the message was addressed</param> /// <param name="responseType">Expected response type</param> /// <param name="messageCount">Message counter, increases for every new message sent</param> /// <param name="message">The ATC instruction</param> public CpdlcAcarsMessage( string from, string to, ResponseAttribute responseType, int messageCount, CPDLCUplinkMessageType messageType) : base( DateTime.Now, from, to, MessageType.CPDLC, GetDataString(messageCount, 0, responseType, messageType)) { ResponseType = responseType; MessageCount = messageCount; UplinkMessageType = messageType; Message = getAtcMessage(messageType); }
/// <summary> /// Use to create a new CPDLC Message object /// </summary> /// <param name="recievedAt">When the message was recieved by the client (not when it was created or sent from the sender station)</param> /// <param name="from">Callsign from which the message was recieved</param> /// <param name="to">Callsign to which the message was addressed</param> /// <param name="responseType">Expected response type</param> /// <param name="messageCount">Message counter, increases for every new message sent</param> /// <param name="message">The ATC instruction</param> public CpdlcAcarsMessage( DateTime recievedAt, string from, string to, ResponseAttribute responseType, int messageCount, string message) : base( recievedAt, from, to, MessageType.CPDLC, GetDataString(messageCount, 0, responseType, message)) { ResponseType = responseType; UplinkMessageType = CPDLCUplinkMessageType.NONE; MessageCount = messageCount; Message = message; }
public ResponseAttribute IsEmailExist(string emailAddress) { ResponseAttribute response = new ResponseAttribute(); using (IChatRepository repo = new Repository(new ChatDbContext())) { response.Response = true; try { tbl_User user = repo.GetEntity(emailAddress); if (user != null) response.Response = true; else response.Response = false; } catch (Exception ex) { response.Response = false; response.Message = ex.Message; } } return response; }
public void WithMaxEventsPerSessionSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.MAX_EVENTS_PER_SESSION; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithMaxEventsPerSession(37).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithTimestampSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.TIMESTAMP; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithTimestampInMilliseconds(37L).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithStatusSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.STATUS; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithStatus("status").Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithApplicationIdSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.APPLICATION_ID; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithApplicationId(Guid.NewGuid().ToString()).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithCaptureErrorsSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.IS_CAPTURE_ERRORS; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithCaptureErrors(!ResponseAttributesDefaults.JsonResponse.IsCaptureErrors).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithVisitStoreVersionSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.VISIT_STORE_VERSION; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithVisitStoreVersion(37).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithSessionTimeoutSetsAttributeOnInstance() { // given ResponseAttribute attribute = ResponseAttribute.SESSION_IDLE_TIMEOUT; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithSessionTimeoutInMilliseconds(37).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
public void WithMaxBeaconSizeSetsAttributeOnInstance() { // given const ResponseAttribute attribute = ResponseAttribute.MAX_BEACON_SIZE; var target = ResponseAttributes.WithJsonDefaults(); // when var obtained = target.WithMaxBeaconSizeInBytes(37).Build(); // then Assert.That(obtained.IsAttributeSet(attribute), Is.True); foreach (var unsetAttribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { if (attribute == unsetAttribute) { continue; } Assert.That(obtained.IsAttributeSet(unsetAttribute), Is.False); } }
private void SetAttribute(ResponseAttribute attribute) { SetAttributes.Add(attribute); }
public bool IsAttributeSet(ResponseAttribute attribute) { return(false); }
public bool IsAttributeSet(ResponseAttribute attribute) { return(setAttributes.Contains(attribute)); }
public ResponseAttribute KeepAlive() { ResponseAttribute response = new ResponseAttribute { Response = true }; return response; }