public void SendWitsSentence() { var baseSent = WitsHelpers.CreateDefaultWitsSentence(); WitsSentence sentenceResult = null; using (var host = new WitsHost(6666, WitsLevel.Level0, new WitsPostProcessorSimple[] { new WitsPostProcessorSimple((sentences) => { sentenceResult = sentences.First(); }) })) { host.Start(); using (var client = new WitsClient("127.0.0.1", 6666)) { client.Connect(); client.SendWitsSentence(baseSent); Thread.Sleep(2000); } } Assert.AreEqual(baseSent.ToString(), sentenceResult.ToString()); }
public void DeserializeWitsSentenceMethod() { var sentBase = wh.CreateDefaultWitsSentence(); var sent = WitsSentence.Parse(wh.WitsString); Assert.AreEqual(sentBase.Records, sent.Records); }
/// <summary> /// Send WITS message /// </summary> /// <param name="sentence">WITS sentence <see cref="WitsSentence"/></param> public void SendWitsSentence(WitsSentence sentence) { SendWitsSentenceCollection(new List <WitsSentence>() { sentence }); }
public static WitsSentence CreateDefaultWitsSentence() { var sent = new WitsSentence(); sent.Records.Add(WitsRecord.Parse("01021000")); sent.Records.Add(WitsRecord.Parse("01031000")); return(sent); }
/// <summary> /// Send Wits sentence /// </summary> /// <param name="sentence">Wits sentence</param> public void SendWitsSentence(WitsSentence sentence) { try { _witsStrategy.SendWitsSentence(sentence); } catch (Exception ex) { _logger.Log(LogLevel.Error, ex, "Ошибка ассинхронного подключения"); } }