예제 #1
0
            public void ReturnsADataSourceIfTheUserExistsInTheDatabase()
            {
                var observable = Observable.Return <IDatabaseUser>(FoundationUser.Clean(User));

                Database.User.Single().Returns(observable);

                var result = LoginManager.GetDataSourceIfLoggedIn();

                result.Should().NotBeNull();
            }
            public void ReturnsADataSourceIfTheUserExistsInTheDatabase()
            {
                var observable = Observable.Return <IDatabaseUser>(FoundationUser.Clean(User));

                Database.User.Single().Returns(observable);

                var result = UserAccessManager.CheckIfLoggedIn();

                result.Should().BeTrue();
            }
            public void EmitsTheDataSourceWhenUserIsLoggedIn()
            {
                var observer   = Substitute.For <IObserver <ITogglDataSource> >();
                var observable = Observable.Return <IDatabaseUser>(FoundationUser.Clean(User));

                Database.User.Single().Returns(observable);
                UserAccessManager.UserLoggedIn.Subscribe(observer);

                UserAccessManager.GetDataSourceIfLoggedIn();

                observer.Received().OnNext(Arg.Any <ITogglDataSource>());
            }
            public void EmitsWhenUserIsLoggedIn()
            {
                var observer   = Substitute.For <IObserver <Unit> >();
                var observable = Observable.Return <IDatabaseUser>(FoundationUser.Clean(User));

                Database.User.Single().Returns(observable);
                UserAccessManager.UserLoggedIn.Subscribe(observer);

                UserAccessManager.TryInitializingAccessToUserData(out _, out _);

                observer.Received().OnNext(Arg.Any <Unit>());
            }
            public void ReturnsADataSourceIfTheUserExistsInTheDatabase()
            {
                var observable = Observable.Return <IDatabaseUser>(FoundationUser.Clean(User));

                Database.User.Single().Returns(observable);

                var result = UserAccessManager.TryInitializingAccessToUserData(out var syncManager, out var interactorFactory);

                result.Should().BeTrue();
                syncManager.Should().NotBeNull();
                interactorFactory.Should().NotBeNull();
            }