public void ThrowsWhenDatabaseOperationFails()
        {
            var state = new UnsyncableEntityState <IThreadSafeTestModel>(dataSource, TestModel.Unsyncable);

            dataSource
            .OverwriteIfOriginalDidNotChange(null, null)
            .ReturnsForAnyArgs(_ => throw new TestException());

            Action callingStart = () => state.Start(
                (new ApiException(request, response, "Test."), new TestModel(1, SyncStatus.SyncNeeded))).SingleAsync().Wait();

            callingStart.Should().Throw <TestException>();
        }
示例#2
0
 private Func <TThreadsafeModel, IObservable <ITransition> > tryOverwrite(TThreadsafeModel originalEntity)
 => serverEntity
 => dataSource.OverwriteIfOriginalDidNotChange(originalEntity, serverEntity)
 .SelectMany(results => getCorrectTransitionFromResults(results, originalEntity));
 private Func <TModel, IObservable <IEnumerable <IConflictResolutionResult <TThreadsafeModel> > > > tryOverwrite(TModel entity)
 => updatedEntity => dataSource.OverwriteIfOriginalDidNotChange(
     convertToThreadsafeModel(entity), convertToThreadsafeModel(updatedEntity));