public void TestFriends() { string line = "{ \"timestamp\":\"2017-08-24T17:22:03Z\", \"event\":\"Friends\", \"Status\":\"Online\", \"Name\":\"_Testy_McTest_\" }"; string line2 = "{ \"timestamp\":\"2017-08-24T17:22:03Z\", \"event\":\"Friends\", \"Status\":\"Offline\", \"Name\":\"_Testy_McTest_\" }"; List <Event> events = JournalMonitor.ParseJournalEntry(line); events = JournalMonitor.ParseJournalEntry(line2); /// Since this friend is unknown to us, the first time we see this friend no event should trigger. /// Only the second line, registering the status as offline, should be registered as an event. Assert.IsTrue(events.Count == 1); FriendsEvent @event = (FriendsEvent)events[0]; Friend testFriend = new Friend { name = @event.name, status = @event.status }; Assert.AreEqual("Offline", @event.status); // Clean up Eddi.EDDI.Instance.Cmdr.friends.Remove(testFriend); }
internal FriendsEvent InvokeEvent(FriendsEvent arg) { if (_api.ValidateEvent(arg)) { Friends?.Invoke(_api, arg); } return(arg); }
private void AssertEvent(FriendsEvent @event) { Assert.NotNull(@event); Assert.Equal(DateTime.Parse("2019-08-30T13:03:45Z"), @event.Timestamp); Assert.Equal(EventName, @event.Event); Assert.Equal(FriendStatus.Added, @event.Status); Assert.Equal("Viktor Gingerbeard", @event.Name); }
private async void PlayerOnFriendsAsync(object sender, FriendsEvent e) { switch (e.Status) { case FriendStatus.Added: await AddCommand(new AddCommanderFriend(e.Name, GamePlatform.PC)) .SendAsync() .ConfigureAwait(false); break; case FriendStatus.Lost: await AddCommand(new RemoveCommanderFriend(e.Name, GamePlatform.PC)) .SendAsync() .ConfigureAwait(false); break; } }
internal void InvokeFriendsEvent(FriendsEvent arg) { FriendsEvent?.Invoke(this, arg); }
internal void InvokeFriendsEvent(FriendsEvent arg) => FriendsEvent?.Invoke(null, arg);