public async Task Should_Call_Insert_Async() { // Given var table = Substitute.For <IMobileServiceTable <TestObjects> >(); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithTable(table); // When await fixture.InsertOnlineAsync(new TestObjects()); // Then await table.Received().InsertAsync(Arg.Any <TestObjects>()); }
public async Task Should_Push_Sync_Context() { // Given var storageService = Substitute.For <IStoreService>(); BaseStore <TestObjects> fixture = new BaseStoreFixture <TestObjects>().WithStorageService(storageService); // When await fixture.InsertOnlineAsync(new TestObjects()); // Then await storageService.SyncContext.Received().PushAsync(CancellationToken.None); }
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.InsertOnlineAsync(new TestObjects()); // Then await storageService.Received().InitializeAsync(); }