public void TestVADiscoveryScanEvent() { string line = @"{ ""timestamp"":""2019-10-26T02:15:49Z"", ""event"":""FSSDiscoveryScan"", ""Progress"":0.439435, ""BodyCount"":7, ""NonBodyCount"":3, ""SystemName"":""Outotz WO-A d1"", ""SystemAddress"":44870715523 }"; List <Event> events = JournalMonitor.ParseJournalEntry(line); Assert.IsTrue(events.Count == 1); Assert.IsInstanceOfType(events[0], typeof(DiscoveryScanEvent)); DiscoveryScanEvent ev = events[0] as DiscoveryScanEvent; Assert.AreEqual(7, ev.totalbodies); Assert.AreEqual(3, ev.nonbodies); Assert.AreEqual(44, ev.progress); var vars = new MetaVariables(ev.GetType(), ev).Results; var vaVars = vars.AsVoiceAttackVariables("EDDI", ev.type); foreach (var @var in vaVars) { @var.Set(vaProxy); } Assert.AreEqual(2, vaVars.Count); Assert.AreEqual(7, vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan totalbodies").Value); Assert.AreEqual(3, vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan nonbodies").Value); Assert.IsNull(vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan progress").Value); foreach (VoiceAttackVariable variable in vaVars) { Assert.IsTrue(vaProxy.vaVars.ContainsKey(variable.key), "Unmatched key"); } }
private void AssertEvent(DiscoveryScanEvent @event) { Assert.NotNull(@event); Assert.Equal(DateTime.Parse("2019-09-11T11:37:07Z"), @event.Timestamp); Assert.Equal(EventName, @event.Event); // TODO: Add more tests }
internal DiscoveryScanEvent InvokeEvent(DiscoveryScanEvent arg) { if (_api.ValidateEvent(arg)) { DiscoveryScan?.Invoke(_api, arg); } return(arg); }
public void TestVADiscoveryScanEvent() { string line = @"{ ""timestamp"":""2019-10-26T02:15:49Z"", ""event"":""FSSDiscoveryScan"", ""Progress"":0.439435, ""BodyCount"":7, ""NonBodyCount"":3, ""SystemName"":""Outotz WO-A d1"", ""SystemAddress"":44870715523 }"; List <Event> events = JournalMonitor.ParseJournalEntry(line); Assert.IsTrue(events.Count == 1); Assert.IsInstanceOfType(events[0], typeof(DiscoveryScanEvent)); DiscoveryScanEvent ev = events[0] as DiscoveryScanEvent; Assert.AreEqual(7, ev.totalbodies); Assert.AreEqual(3, ev.nonbodies); Assert.AreEqual(44, ev.progress); List <string> setKeys = new List <string>(); EddiVoiceAttackResponder.VoiceAttackVariables.setEventValues(vaProxy, ev, setKeys); EddiVoiceAttackResponder.VoiceAttackVariables.setEventExtendedValues(vaProxy, "EDDI " + ev.type.ToLowerInvariant(), JsonConvert.DeserializeObject(JsonConvert.SerializeObject(ev)), setKeys); Assert.AreEqual(7, vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan totalbodies").Value); Assert.AreEqual(3, vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan nonbodies").Value); Assert.AreEqual(44M, vaProxy.vaVars.FirstOrDefault(k => k.Key == "EDDI discovery scan progress").Value); }
internal void InvokeDiscoveryScanEvent(DiscoveryScanEvent arg) { DiscoveryScanEvent?.Invoke(this, arg); }
internal void InvokeDiscoveryScanEvent(DiscoveryScanEvent arg) => DiscoveryScanEvent?.Invoke(null, arg);