public async Task Should_Push_Sync_Context() { // Given var storageService = Substitute.For <IStoreService>(); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithStorageService(storageService); // When await fixture.UpdateAsync(new TestObjects()); // Then await storageService.SyncContext.Received().PushAsync(CancellationToken.None); }
public async Task Should_Call_Update_Async() { // Given var table = Substitute.For <IMobileServiceSyncTable <TestObjects> >(); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithSyncTable(table); // When await fixture.UpdateAsync(new TestObjects()); // Then await table.Received().UpdateAsync(Arg.Any <TestObjects>()); }
public async Task Should_Call_Initialize() { // Given var storageService = Substitute.For <IStoreService>(); storageService.IsInitialized.Returns(false); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithStorageService(storageService); // When await fixture.UpdateAsync(new TestObjects()); // Then await storageService.Received().InitializeAsync(); }
public async Task Should_Call_Pull_Async() { // Given var table = Substitute.For <IMobileServiceSyncTable <TestObjects> >(); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithSyncTable(table); // When await fixture.UpdateAsync(new TestObjects()); // Then await table.Received().PullAsync(Arg.Any <string>(), Arg.Any <IMobileServiceTableQuery <TestObjects> >(), true, Arg.Any <CancellationToken>(), Arg.Any <PullOptions>()); }