public async Task ReturnsTransitionFromInternalStateWhenEverythingWorks()
        {
            var internalTransition = Substitute.For <ITransition>();

            internalState.Start(Arg.Any <IFetchObservables>()).Returns(Observable.Return(internalTransition));

            var transition = await state.Start(fetchObservables);

            transition.Should().Be(internalTransition);
        }
Пример #2
0
        public async Task DoesNotReturnTheSuccessResultFromTheInternalStateWhenEverythingWorks()
        {
            var fetchObservables   = createObservables(new List <ITestModel>());
            var internalTransition = Substitute.For <ITransition>();
            var internalResult     = Substitute.For <IStateResult>();

            internalTransition.Result.Returns(internalResult);
            internalState.Start(Arg.Any <IFetchObservables>()).Returns(Observable.Return(internalTransition));

            var transition = await state.Start(fetchObservables);

            transition.Result.Should().NotBe(internalResult);
        }
 public IObservable <ITransition> Start(IFetchObservables fetch)
 => internalState.Start(fetch)
 .SelectMany(_ => fetch.GetList <TInterface>()
             .Do(maybeUpdateSinceDates)
             .Select(__ => FinishedPersisting.Transition(fetch)));
 private IObservable <ITransition> handlePresenceOfWorkspaces(IFetchObservables fetch)
 => internalState.Start(fetch)
 .Select(FinishedPersisting.Transition(fetch));