Exemple #1
0
            public void IsSetToTheDefaultWorkspaceIfAllWorkspacesAreEligibleForProjectCreation()
            {
                var observer         = TestScheduler.CreateObserver <string>();
                var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                defaultWorkspace.Name.Returns(DefaultWorkspaceName);
                defaultWorkspace.Admin.Returns(true);
                var eligibleWorkspace = Substitute.For <IThreadSafeWorkspace>();

                eligibleWorkspace.Name.Returns("Eligible workspace for project creation");
                eligibleWorkspace.Admin.Returns(true);
                var eligibleWorkspace2 = Substitute.For <IThreadSafeWorkspace>();

                eligibleWorkspace.Name.Returns("Another Eligible Workspace");
                eligibleWorkspace.Admin.Returns(true);
                InteractorFactory.GetDefaultWorkspace().Execute()
                .Returns(Observable.Return(defaultWorkspace));
                InteractorFactory.GetAllWorkspaces().Execute()
                .Returns(Observable.Return(new[] { eligibleWorkspace2, defaultWorkspace, eligibleWorkspace }));

                var viewModel = CreateViewModel();

                TestScheduler.Start();
                viewModel.WorkspaceName.Subscribe(observer);
                TestScheduler.Start();

                observer.LastEmittedValue().Should().Be(defaultWorkspace.Name);
            }
Exemple #2
0
            protected CalendarViewModelTest()
            {
                CalendarInteractor = Substitute.For <IInteractor <IObservable <IEnumerable <CalendarItem> > > >();

                var workspace = new MockWorkspace {
                    Id = DefaultWorkspaceId
                };
                var timeEntry = new MockTimeEntry {
                    Id = TimeEntryId
                };

                TimeService.CurrentDateTime.Returns(Now);

                InteractorFactory
                .GetCalendarItemsForDate(Arg.Any <DateTime>())
                .Returns(CalendarInteractor);

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(workspace));

                InteractorFactory
                .CreateTimeEntry(Arg.Any <ITimeEntryPrototype>())
                .Execute()
                .Returns(Observable.Return(timeEntry));

                InteractorFactory
                .UpdateTimeEntry(Arg.Any <EditTimeEntryDto>())
                .Execute()
                .Returns(Observable.Return(timeEntry));
            }
Exemple #3
0
            public void ClearsTheCurrentClientIfZeroIsReturned()
            {
                var          clientObserver = TestScheduler.CreateObserver <string>();
                const string expectedName   = "Some client";
                long?        expectedId     = 10;
                var          client         = Substitute.For <IThreadSafeClient>();

                client.Id.Returns(expectedId.Value);
                client.Name.Returns(expectedName);
                NavigationService
                .Navigate <SelectClientViewModel, SelectClientParameters, long?>(Arg.Any <SelectClientParameters>(), ViewModel.View)
                .Returns(Task.FromResult(expectedId), Task.FromResult <long?>(0));
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(Workspace));
                InteractorFactory.GetClientById(expectedId.Value).Execute().Returns(Observable.Return(client));
                Workspace.Id.Returns(DefaultWorkspaceId);
                ViewModel.Initialize("Some name");
                ViewModel.PickClient.Execute();
                TestScheduler.Start();
                ViewModel.ClientName.Subscribe(clientObserver);

                ViewModel.PickClient.Execute();
                TestScheduler.Start();

                clientObserver.LastEmittedValue().Should().BeNullOrEmpty();
            }
            public async Task ShouldChangeCurrentWorkspaceName()
            {
                TimeService.CurrentDateTime.Returns(DateTimeOffset.Now);
                var observer = TestScheduler.CreateObserver <string>();

                ViewModel.WorkspaceNameObservable.Subscribe(observer);

                var mockWorkspace = new MockWorkspace {
                    Id = WorkspaceId + 1, Name = "Selected workspace"
                };

                DialogService.Select(Arg.Any <string>(), Arg.Any <IEnumerable <(string, IThreadSafeWorkspace)> >(), Arg.Any <int>())
                .Returns(Observable.Return(mockWorkspace));
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(mockWorkspace));

                await ViewModel.Initialize();

                ViewModel.SelectWorkspace.Execute();
                TestScheduler.Start();

                observer.Messages.AssertEqual(
                    ReactiveTest.OnNext(1, ""),
                    ReactiveTest.OnNext(2, mockWorkspace.Name)
                    );
            }
Exemple #5
0
            public async Task ClearsTheCurrentClientIfZeroIsReturned()
            {
                const string expectedName = "Some client";
                long?        expectedId   = 10;
                var          client       = Substitute.For <IThreadSafeClient>();

                client.Id.Returns(expectedId.Value);
                client.Name.Returns(expectedName);
                NavigationService
                .Navigate <SelectClientViewModel, SelectClientParameters, long?>(Arg.Any <SelectClientParameters>())
                .Returns(Task.FromResult(expectedId));
                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));
                DataSource.Clients.GetById(expectedId.Value).Returns(Observable.Return(client));
                Workspace.Id.Returns(WorkspaceId);
                ViewModel.Prepare("Some name");
                await ViewModel.PickClientCommand.ExecuteAsync();

                NavigationService
                .Navigate <SelectClientViewModel, SelectClientParameters, long?>(Arg.Any <SelectClientParameters>())
                .Returns(Task.FromResult <long?>(0));

                await ViewModel.PickClientCommand.ExecuteAsync();

                ViewModel.ClientName.Should().BeNullOrEmpty();
            }
            public async Task ReturnsTheWorkspaceWithSmallestIdWhenUsersDefaultWorkspaceIsNotInTheDatabase()
            {
                const long workspaceId = 11;
                var        workspaces  = new[] { new MockWorkspace {
                                                     Id = workspaceId + 2
                                                 }, new MockWorkspace {
                                                     Id = workspaceId
                                                 }, new MockWorkspace {
                                                     Id = workspaceId + 1
                                                 } };
                var user = new MockUser {
                    DefaultWorkspaceId = workspaceId + 3
                };

                DataSource.User.Get().Returns(Observable.Return(user));
                InteractorFactory.GetWorkspaceById(workspaceId + 3)
                .Execute()
                .Returns(Observable.Throw <IThreadSafeWorkspace>(new InvalidOperationException()));
                DataSource.Workspaces.GetAll(Arg.Any <Func <IDatabaseWorkspace, bool> >())
                .Returns(Observable.Return(workspaces));

                var defaultWorkspace = await InteractorFactory.GetDefaultWorkspace().Execute();

                defaultWorkspace.Id.Should().Be(workspaceId);
            }
Exemple #7
0
            public async Task SetToDefaultWorkspaceIfAllWorkspacesAreEligible()
            {
                var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                defaultWorkspace.Name.Returns(DefaultWorkspaceName);
                defaultWorkspace.Admin.Returns(true);

                var eligibleWorkspace = Substitute.For <IThreadSafeWorkspace>();

                eligibleWorkspace.Name.Returns("Eligible workspace for project creation");
                eligibleWorkspace.Admin.Returns(true);

                var eligibleWorkspace2 = Substitute.For <IThreadSafeWorkspace>();

                eligibleWorkspace.Name.Returns("Another Eligible Workspace");
                eligibleWorkspace.Admin.Returns(true);

                InteractorFactory.GetDefaultWorkspace().Execute()
                .Returns(Observable.Return(defaultWorkspace));
                InteractorFactory.GetAllWorkspaces().Execute()
                .Returns(Observable.Return(new[] { eligibleWorkspace2, defaultWorkspace, eligibleWorkspace }));

                await ViewModel.Initialize();

                ViewModel.WorkspaceName.Should().Be(defaultWorkspace.Name);
            }
Exemple #8
0
            public TheDoneAction()
            {
                InteractorFactory
                .AreCustomColorsEnabledForWorkspace(DefaultWorkspaceId)
                .Execute()
                .Returns(Observable.Return(false));

                InteractorFactory
                .AreCustomColorsEnabledForWorkspace(proWorkspaceId)
                .Execute()
                .Returns(Observable.Return(true));

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));

                InteractorFactory
                .GetWorkspaceById(Arg.Any <long>())
                .Execute()
                .Returns(Observable.Return(Workspace));

                InteractorFactory
                .CreateProject(Arg.Any <CreateProjectDTO>())
                .Execute()
                .Returns(Observable.Return(project));

                project.Id.Returns(projectId);
                Workspace.Id.Returns(proWorkspaceId);
            }
Exemple #9
0
            protected void SetupDataSourceToReturnExistingProjectsAndDefaultWorkspace(bool dataSourceProjectIsInSameWorkspace)
            {
                var project = Substitute.For <IThreadSafeProject>();

                project.Id.Returns(projectId);
                project.Name.Returns(ProjectName);
                project.WorkspaceId.Returns(dataSourceProjectIsInSameWorkspace ? DefaultWorkspaceId : otherWorkspaceId);

                var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                defaultWorkspace.Id.Returns(DefaultWorkspaceId);
                defaultWorkspace.Name.Returns(Guid.NewGuid().ToString());

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory
                .AreCustomColorsEnabledForWorkspace(DefaultWorkspaceId)
                .Execute()
                .Returns(Observable.Return(false));

                DataSource.Projects
                .GetAll(Arg.Any <ProjectPredicate>())
                .Returns(callInfo => Observable.Return(new[] { project })
                         .Select(projects => projects.Where <IThreadSafeProject>(callInfo.Arg <ProjectPredicate>())));
            }
Exemple #10
0
            protected void SetupDataSourceToReturnMultipleWorkspaces()
            {
                List <IThreadSafeWorkspace> workspaces = new List <IThreadSafeWorkspace>();
                List <IThreadSafeProject>   projects   = new List <IThreadSafeProject>();

                for (long workspaceId = 0; workspaceId < 2; workspaceId++)
                {
                    var workspace = Substitute.For <IThreadSafeWorkspace>();
                    workspace.Id.Returns(workspaceId);
                    workspace.Name.Returns(Guid.NewGuid().ToString());
                    workspaces.Add(workspace);

                    InteractorFactory
                    .GetWorkspaceById(workspaceId)
                    .Execute()
                    .Returns(Observable.Return(workspace));

                    for (long projectId = 0; projectId < 3; projectId++)
                    {
                        var project = Substitute.For <IThreadSafeProject>();
                        project.Id.Returns(10 * workspaceId + projectId);
                        project.Name.Returns($"Project-{workspaceId}-{projectId}");
                        project.WorkspaceId.Returns(workspaceId);
                        projects.Add(project);
                    }

                    var sameNameProject = Substitute.For <IThreadSafeProject>();
                    sameNameProject.Id.Returns(10 + workspaceId);
                    sameNameProject.Name.Returns("Project");
                    sameNameProject.WorkspaceId.Returns(workspaceId);
                    projects.Add(sameNameProject);
                }

                var defaultWorkspace = workspaces[0];

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory
                .AreCustomColorsEnabledForWorkspace(Arg.Any <long>())
                .Execute()
                .Returns(Observable.Return(false));

                DataSource.Projects
                .GetAll(Arg.Any <ProjectPredicate>())
                .Returns(callInfo =>
                         Observable.Return(projects)
                         .Select(p => p.Where <IThreadSafeProject>(callInfo.Arg <ProjectPredicate>())));

                View.Select(
                    Arg.Any <string>(),
                    Arg.Any <IEnumerable <SelectOption <IThreadSafeWorkspace> > >(),
                    Arg.Any <int>())
                .Returns(Observable.Return(new MockWorkspace {
                    Id = 1L
                }));
            }
Exemple #11
0
            public ReportsViewModelTest()
            {
                var workspaceObservable = Observable.Return(new MockWorkspace {
                    Id = WorkspaceId
                });

                InteractorFactory.GetDefaultWorkspace().Execute().Returns(workspaceObservable);
            }
Exemple #12
0
            private void setupDefaultWorkspace()
            {
                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));

                Workspace.Id.Returns(DefaultWorkspaceId);
                Workspace.Name.Returns(DefaultWorkspaceName);

                ViewModel.Prepare("Some name");
            }
Exemple #13
0
            public TheInitializeMethod()
            {
                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));

                Workspace.Id.Returns(WorkspaceId);
                Workspace.Name.Returns(WorkspaceName);

                ViewModel.Prepare("Some name");
            }
            public async ThreadingTask NavigatesToTheReportsViewModel()
            {
                const long workspaceId = 10;
                var        workspace   = Substitute.For <IThreadSafeWorkspace>();

                workspace.Id.Returns(workspaceId);
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(workspace));

                await ViewModel.OpenReportsCommand.ExecuteAsync();

                await NavigationService.Received().Navigate <ReportsViewModel, long>(workspaceId);
            }
            public void ReturnsNoSuggestionsInCaseOfError()
            {
                var now = new DateTimeOffset(2020, 1, 5, 3, 55, 0, TimeSpan.Zero);

                TimeService.CurrentDateTime.Returns(now);
                var exception = new Exception();

                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Throw <IThreadSafeWorkspace>(exception));
                var provider = new CalendarSuggestionProvider(TimeService, CalendarService, InteractorFactory);

                provider.GetSuggestions().Count().Wait().Should().Be(0);
            }
            public void NeverThrows()
            {
                var now = new DateTimeOffset(2020, 1, 5, 3, 55, 0, TimeSpan.Zero);

                TimeService.CurrentDateTime.Returns(now);
                var exception = new Exception();

                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Throw <IThreadSafeWorkspace>(exception));
                var provider = new CalendarSuggestionProvider(TimeService, CalendarService, InteractorFactory);

                Action getSuggestions = () => provider.GetSuggestions().Subscribe();

                getSuggestions.Should().NotThrow();
            }
            public ThePickWorkspaceCommand()
            {
                workspace.Id.Returns(workspaceId);
                workspace.Name.Returns(workspaceName);
                defaultWorkspace.Id.Returns(defaultWorkspaceId);

                InteractorFactory.GetDefaultWorkspace().Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory.GetWorkspaceById(workspaceId).Execute()
                .Returns(Observable.Return(workspace));

                ViewModel.Prepare();
            }
            public async ThreadingTask MarksTheActionAfterStopButtonForOnboardingPurposes()
            {
                const long workspaceId = 10;
                var        workspace   = Substitute.For <IThreadSafeWorkspace>();

                workspace.Id.Returns(workspaceId);
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(workspace));
                OnboardingStorage.StopButtonWasTappedBefore.Returns(Observable.Return(true));
                ViewModel.Initialize().Wait();

                await ViewModel.OpenReportsCommand.ExecuteAsync();

                OnboardingStorage.Received().SetNavigatedAwayFromMainViewAfterStopButton();
            }
Exemple #19
0
            private void setupChangingWorkspaceScenario()
            {
                List <IThreadSafeWorkspace> workspaces = new List <IThreadSafeWorkspace>();
                List <IThreadSafeProject>   projects   = new List <IThreadSafeProject>();

                for (long workspaceId = 0; workspaceId < 2; workspaceId++)
                {
                    var workspace = Substitute.For <IThreadSafeWorkspace>();
                    workspace.Id.Returns(workspaceId);
                    workspace.Name.Returns(Guid.NewGuid().ToString());
                    workspaces.Add(workspace);

                    InteractorFactory
                    .GetWorkspaceById(workspaceId)
                    .Execute()
                    .Returns(Observable.Return(workspace));

                    for (long projectId = 0; projectId < 3; projectId++)
                    {
                        var project = Substitute.For <IThreadSafeProject>();
                        project.Id.Returns(10 * workspaceId + projectId);
                        project.Name.Returns($"Project-{workspaceId}-{projectId}");
                        project.WorkspaceId.Returns(workspaceId);
                        projects.Add(project);
                    }

                    var sameNameProject = Substitute.For <IThreadSafeProject>();
                    sameNameProject.Id.Returns(10 + workspaceId);
                    sameNameProject.Name.Returns("Project");
                    sameNameProject.WorkspaceId.Returns(workspaceId);
                    projects.Add(sameNameProject);
                }

                var defaultWorkspace = workspaces[0];

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory
                .AreCustomColorsEnabledForWorkspace(Arg.Any <long>())
                .Execute()
                .Returns(Observable.Return(false));

                DataSource.Projects
                .GetAll(Arg.Any <ProjectPredicate>())
                .Returns(callInfo => Observable.Return(projects)
                         .Select(p => p.Where <IThreadSafeProject>(callInfo.Arg <ProjectPredicate>())));
            }
            public async ThreadingTask NavigatesToTheReportsViewModel()
            {
                const long workspaceId = 10;
                var        workspace   = Substitute.For <IThreadSafeWorkspace>();

                workspace.Id.Returns(workspaceId);
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(workspace));
                OnboardingStorage.StopButtonWasTappedBefore.Returns(Observable.Return(false));
                ViewModel.Initialize().Wait();

                ViewModel.OpenReports.Execute();

                TestScheduler.Start();
                await NavigationService.Received().Navigate <ReportsViewModel>();
            }
            public void MarksTheActionBeforeStopButtonForOnboardingPurposes()
            {
                const long workspaceId = 10;
                var        workspace   = Substitute.For <IThreadSafeWorkspace>();

                workspace.Id.Returns(workspaceId);
                InteractorFactory.GetDefaultWorkspace().Execute().Returns(Observable.Return(workspace));
                OnboardingStorage.StopButtonWasTappedBefore.Returns(Observable.Return(false));
                ViewModel.Initialize().Wait();

                ViewModel.OpenReports.Execute();

                TestScheduler.Start();
                OnboardingStorage.DidNotReceive().SetNavigatedAwayFromMainViewAfterStopButton();
            }
Exemple #22
0
                protected override void AdditionalSetup()
                {
                    var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    defaultWorkspace.Id.Returns(defaultWorkspaceId);
                    var selectedWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    selectedWorkspace.Id.Returns(selectedWorkspaceId);
                    InteractorFactory
                    .GetDefaultWorkspace()
                    .Execute()
                    .Returns(Observable.Return(defaultWorkspace));
                    NavigationService
                    .Navigate <SelectWorkspaceViewModel, long, long>(Arg.Any <long>())
                    .Returns(Task.FromResult(selectedWorkspaceId));
                }
Exemple #23
0
            public async Task PassesTheCurrentCliendIdToTheViewModel()
            {
                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));
                Workspace.Id.Returns(WorkspaceId);
                ViewModel.Prepare("Some name");
                await ViewModel.Initialize();

                await ViewModel.PickClientCommand.ExecuteAsync();

                await NavigationService.Received()
                .Navigate <SelectClientViewModel, SelectClientParameters, long?>(
                    Arg.Is <SelectClientParameters>(parameter => parameter.SelectedClientId == 0)
                    );
            }
Exemple #24
0
            public async Task ReturnsUsersDefaultWorkspace()
            {
                const long workspaceId = 11;
                var        workspace   = new MockWorkspace {
                    Id = workspaceId
                };
                var user = new MockUser {
                    DefaultWorkspaceId = workspaceId
                };

                DataSource.User.Get().Returns(Observable.Return(user));
                DataSource.Workspaces.GetById(workspaceId).Returns(Observable.Return(workspace));

                var defaultWorkspace = await InteractorFactory.GetDefaultWorkspace().Execute();

                defaultWorkspace.Should().BeEquivalentTo(workspace, options => options.IncludingProperties());
            }
Exemple #25
0
            public ThePickWorkspaceAction()
            {
                workspace.Id.Returns(workspaceId);
                workspace.Name.Returns(workspaceName);
                defaultWorkspace.Id.Returns(defaultWorkspaceId);

                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory
                .GetWorkspaceById(workspaceId)
                .Execute()
                .Returns(Observable.Return(workspace));

                ViewModel.Initialize("");
            }
            public ThePickDefaultWorkspaceMethod()
            {
                defaultWorkspace = new MockWorkspace {
                    Id = defaultWorkspaceId
                };
                workspace = new MockWorkspace {
                    Id = workspaceId, Name = workspaceName
                };

                UserSubject.OnNext(new MockUser());

                InteractorFactory.GetDefaultWorkspace().Execute()
                .Returns(Observable.Return(defaultWorkspace));

                InteractorFactory.GetWorkspaceById(workspaceId).Execute()
                .Returns(Observable.Return(workspace));

                ViewModel.Prepare();
            }
Exemple #27
0
                private void prepare()
                {
                    var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    defaultWorkspace.Id.Returns(defaultWorkspaceId);
                    var selectedWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    selectedWorkspace.Id.Returns(selectedWorkspaceId);
                    InteractorFactory
                    .GetDefaultWorkspace()
                    .Execute()
                    .Returns(Observable.Return(defaultWorkspace));
                    NavigationService
                    .Navigate <SelectWorkspaceViewModel, WorkspaceParameters, long>(Arg.Any <WorkspaceParameters>())
                    .Returns(Task.FromResult(selectedWorkspaceId));
                    ViewModel.Prepare("Some project");
                    ViewModel.Initialize().Wait();
                    ViewModel.PickWorkspaceCommand.ExecuteAsync().Wait();
                }
                public async ThreadingTask CreatesANewTimeEntryWithThePassedDescriptionInTheDefaultWorkspace()
                {
                    const string description      = "working on something";
                    var          defaultWorkspace = new MockWorkspace {
                        Id = 1
                    };

                    InteractorFactory
                    .GetDefaultWorkspace()
                    .Execute()
                    .Returns(Observable.Return(defaultWorkspace));
                    ViewModel.Init(null, description);

                    await InteractorFactory
                    .Received()
                    .CreateTimeEntry(Arg.Is <ITimeEntryPrototype>(
                                         te => te.Description == description &&
                                         te.WorkspaceId == defaultWorkspace.Id))
                    .Execute();
                }
Exemple #29
0
            public void PassesTheCurrentWorkspaceToTheViewModel()
            {
                InteractorFactory
                .GetDefaultWorkspace()
                .Execute()
                .Returns(Observable.Return(Workspace));
                Workspace.Id.Returns(DefaultWorkspaceId);
                var viewModel = CreateViewModel();

                viewModel.Prepare("Some name");
                TestScheduler.Start();

                viewModel.PickClient.Execute();
                TestScheduler.Start();

                NavigationService.Received()
                .Navigate <SelectClientViewModel, SelectClientParameters, long?>(
                    Arg.Is <SelectClientParameters>(parameter => parameter.WorkspaceId == DefaultWorkspaceId)
                    );
            }
Exemple #30
0
                protected override void AdditionalSetup()
                {
                    var defaultWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    defaultWorkspace.Id.Returns(defaultWorkspaceId);
                    var selectedWorkspace = Substitute.For <IThreadSafeWorkspace>();

                    selectedWorkspace.Id.Returns(selectedWorkspaceId);
                    InteractorFactory
                    .GetDefaultWorkspace()
                    .Execute()
                    .Returns(Observable.Return(defaultWorkspace));

                    View.Select(
                        Arg.Any <string>(),
                        Arg.Any <IEnumerable <SelectOption <IThreadSafeWorkspace> > >(),
                        Arg.Any <int>())
                    .Returns(Observable.Return(new MockWorkspace {
                        Id = selectedWorkspaceId
                    }));
                }