public Task TestLogOut() { IObjectState state = new MutableObjectState { ServerData = new Dictionary <string, object>() { { "sessionToken", "r:llaKcolnu" } } }; AVUser user = AVObjectExtensions.FromState <AVUser>(state, "_User"); var mockCurrentUserController = new Mock <IAVCurrentUserController>(); mockCurrentUserController.Setup(obj => obj.GetAsync(It.IsAny <CancellationToken>())) .Returns(Task.FromResult(user)); var mockSessionController = new Mock <IAVSessionController>(); mockSessionController.Setup(c => c.IsRevocableSessionToken(It.IsAny <string>())).Returns(true); AVPlugins.Instance = new AVPlugins { CurrentUserController = mockCurrentUserController.Object, SessionController = mockSessionController.Object }; AVObject.RegisterSubclass <AVUser>(); AVObject.RegisterSubclass <AVSession>(); return(AVUser.LogOutAsync().ContinueWith(t => { Assert.False(t.IsFaulted); Assert.False(t.IsCanceled); mockCurrentUserController.Verify(obj => obj.LogOutAsync(It.IsAny <CancellationToken>()), Times.Exactly(1)); mockSessionController.Verify(obj => obj.RevokeAsync("r:llaKcolnu", It.IsAny <CancellationToken>()), Times.Exactly(1)); })); }