public Task TestUserSave() { IObjectState state = new MutableObjectState { ObjectId = "some0neTol4v4", ServerData = new Dictionary <string, object>() { { "sessionToken", "llaKcolnu" }, { "username", "ihave" }, { "password", "adream" } } }; IObjectState newState = new MutableObjectState { ServerData = new Dictionary <string, object>() { { "Alliance", "rekt" } } }; AVUser user = AVObjectExtensions.FromState <AVUser>(state, "_User"); var mockObjectController = new Mock <IAVObjectController>(); mockObjectController.Setup(obj => obj.SaveAsync(It.IsAny <IObjectState>(), It.IsAny <IDictionary <string, IAVFieldOperation> >(), It.IsAny <string>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(newState)); AVPlugins.Instance = new AVPlugins { ObjectController = mockObjectController.Object, CurrentUserController = new Mock <IAVCurrentUserController>().Object }; AVObject.RegisterSubclass <AVUser>(); AVObject.RegisterSubclass <AVSession>(); user["Alliance"] = "rekt"; return(user.SaveAsync().ContinueWith(t => { Assert.False(t.IsFaulted); Assert.False(t.IsCanceled); mockObjectController.Verify(obj => obj.SaveAsync(It.IsAny <IObjectState>(), It.IsAny <IDictionary <string, IAVFieldOperation> >(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Exactly(1)); Assert.False(user.IsDirty); Assert.AreEqual("ihave", user.Username); Assert.False(user.GetState().ContainsKey("password")); Assert.AreEqual("some0neTol4v4", user.ObjectId); Assert.AreEqual("rekt", user["Alliance"]); })); }