示例#1
0
        public void ReturnsTheServerErrorTransitionWhenHttpFailsWithServerError(ServerErrorException exception)
        {
            var state  = (UpdateEntityState <ITestModel, IThreadSafeTestModel>)CreateState();
            var entity = new TestModel(1, SyncStatus.InSync);

            api.Update(Arg.Any <ITestModel>()).ReturnsThrowingTaskOf(exception);

            var transition = state.Start(entity).SingleAsync().Wait();
            var parameter  = ((Transition <ServerErrorException>)transition).Parameter;

            transition.Result.Should().Be(state.ServerError);
            parameter.Should().BeAssignableTo <ServerErrorException>();
        }
示例#2
0
 private IObservable <TModel> update(TModel entity)
 => entity == null
         ? Observable.Throw <TModel>(new ArgumentNullException(nameof(entity)))
         : limiter.WaitForFreeSlot()
 .ThenExecute(() => api.Update(entity).ToObservable());
 private IObservable <TModel> update(TModel entity)
 => entity == null
         ? Observable.Throw <TModel>(new ArgumentNullException(nameof(entity)))
         : api.Update(entity);