public void TestToxTyping() { bool isTyping = true; bool testFinished = false; _tox2.OnFriendTypingChanged += (sender, args) => { if (args.IsTyping != isTyping) { Assert.Fail("IsTyping value received does not equal the one we set"); } var error = ToxErrorFriendQuery.Ok; bool result = _tox2.GetFriendTypingStatus(0, out error); if (!result || error != ToxErrorFriendQuery.Ok) { Assert.Fail("Failed to get typing status, error: {0}, result: {1}", error, result); } testFinished = true; }; { var error = ToxErrorSetTyping.Ok; bool result = _tox1.SetTypingStatus(0, isTyping, out error); if (!result || error != ToxErrorSetTyping.Ok) { Assert.Fail("Failed to set typing status, error: {0}, result: {1}", error, result); } while (!testFinished) { DoIterate(); } } }