public void Initialize() { this.store = new Mock<IMobileServiceLocalStore>(MockBehavior.Strict); this.opQueue = new Mock<OperationQueue>(MockBehavior.Strict, this.store.Object); this.opQueue.Setup(q => q.UpdateAsync(It.IsAny<MobileServiceTableOperation>())).Returns(Task.FromResult(0)); this.handler = new Mock<IMobileServiceSyncHandler>(MockBehavior.Strict); this.client = new Mock<MobileServiceClient>(); this.client.Object.Serializer = new MobileServiceSerializer(); this.context = new Mock<MobileServiceSyncContext>(this.client.Object); this.context.Setup(c => c.GetTable(It.IsAny<string>())).Returns(Task.FromResult(new MobileServiceTable("test", this.client.Object))); this.action = new PushAction(this.opQueue.Object, this.store.Object, MobileServiceTableKind.Table, null, this.handler.Object, this.client.Object, this.context.Object, CancellationToken.None); }
public async Task PushAsync(CancellationToken cancellationToken, MobileServiceTableKind tableKind, params string[] tableNames) { await this.EnsureInitializedAsync(); // use empty handler if its not a standard table push var handler = tableKind == MobileServiceTableKind.Table ? this.Handler : new MobileServiceSyncHandler(); var action = new PushAction(this.opQueue, this.Store, tableKind, tableNames, handler, this.client, this, cancellationToken); await this.ExecuteSyncAction(action); }
public async Task PushAsync(CancellationToken cancellationToken, MobileServiceTableKind tableKind, params string[] tableNames) { await this.EnsureInitializedAsync(); // use empty handler if its not a standard table push var handler = tableKind == MobileServiceTableKind.Table ? this.Handler : new MobileServiceSyncHandler(); using (var trackedStore = StoreChangeTrackerFactory.CreateTrackedStore(this.Store, StoreOperationSource.ServerPush, this.storeTrackingOptions, this.client.EventManager, this.settings)) { var action = new PushAction(this.opQueue, trackedStore, tableKind, tableNames, handler, this.client, this, cancellationToken); await this.ExecuteSyncAction(action); } }
public async Task ExecuteAsync_DoesNotSaveTheResult_IfPresentButResultDoesNotHaveId() { this.action = new PushAction(this.opQueue.Object, this.store.Object, MobileServiceTableKind.Table, null, this.handler.Object, this.client.Object, this.context.Object, CancellationToken.None); var op = new InsertOperation("table", MobileServiceTableKind.Table, "id") { Item = new JObject() }; await TestResultSave(op, status: null, resultId: null, saved: false); }