public void MakesApiCallWithCorrectParameter() { var state = createDeleteState(api, repository); var entity = CreateDirtyEntityWithNegativeId(); GetDeleteFunction(api)(entity) .Returns(Observable.Return(Unit.Default)); state.Start(entity).SingleAsync().Wait(); GetDeleteFunction(api).Received().Invoke(entity); }
public void CallsDatabaseDeleteOperationWithCorrectParameter() { var state = createDeleteState(api, repository); var entity = CreateDirtyEntityWithNegativeId(); GetDeleteFunction(api)(entity) .Returns(Observable.Return(Unit.Default)); state.Start(entity).SingleAsync().Wait(); repository.Received().Delete(entity.Id); }
public void ReturnsSuccessfulTransitionWhenEverythingWorks() { var state = createDeleteState(api, repository); var entity = CreateDirtyEntityWithNegativeId(); var clean = CreateCleanEntityFrom(entity); var withPositiveId = CreateCleanWithPositiveIdFrom(entity); GetDeleteFunction(api)(Arg.Any <TModel>()) .Returns(Observable.Return(Unit.Default)); repository.Delete(Arg.Any <long>()) .Returns(Observable.Return(Unit.Default)); var transition = state.Start(entity).SingleAsync().Wait(); transition.Result.Should().Be(state.DeletingFinished); }
protected override void PrepareApiCallFunctionToThrow(Exception e) => GetDeleteFunction(api)(Arg.Any <TModel>()) .Returns(_ => Observable.Throw <Unit>(e));