public async Task TheUpdatedEntityHasTheSameIdAsTheOriginalEntity()
        {
            var entity = new TestModel(1, SyncStatus.SyncNeeded);
            var state  = new UnsyncableEntityState <IThreadSafeTestModel>(dataSource, TestModel.Unsyncable);

            prepareBatchUpdate(entity);

            await state.Start((new BadRequestException(request, response), entity)).SingleAsync();

            await dataSource
            .Received()
            .OverwriteIfOriginalDidNotChange(
                Arg.Is(entity),
                Arg.Is <IThreadSafeTestModel>(updatedEntity => updatedEntity.Id == entity.Id));
        }
        public void UpdateIsCalledWithCorrectParameters()
        {
            var state          = (CreateEntityState <ITestModel, IThreadSafeTestModel>)CreateState();
            var entity         = new TestModel(-1, SyncStatus.SyncFailed);
            var withPositiveId = new TestModel(Math.Abs(entity.Id), SyncStatus.InSync);

            api.Create(entity)
            .Returns(Observable.Return(withPositiveId));

            state.Start(entity).SingleAsync().Wait();

            dataSource
            .Received()
            .Overwrite(Arg.Is <IThreadSafeTestModel>(model => model.Id == entity.Id), Arg.Is <IThreadSafeTestModel>(model => model.Id == withPositiveId.Id));
        }