public async Task TeamMergeViewModel_Initialize_WhenCalled_InitializesTheSelectableProjectNames_Async() { var workspaceModel = new Workspace { Name = "Go test", OwnerName = "14525" }; var projectName1 = "Project1"; var projectName2 = "Project2"; _teamService.Expect(x => x.GetProjectNamesAsync()).Return(Task.FromResult <IEnumerable <string> >(new List <string> { projectName1, projectName2 })); _teamService.Expect(x => x.AllWorkspacesAsync()).Return(Task.FromResult <IEnumerable <Workspace> >(new List <Workspace> { workspaceModel })); _teamService.Expect(x => x.CurrentWorkspace()).Return(workspaceModel); _configManager.Expect(x => x.GetValue <bool>(ConfigKeys.SAVE_BRANCH_PERSOLUTION)).Return(false); _configManager.Expect(x => x.GetValue <string>(ConfigKeys.SELECTED_PROJECT_NAME)).Return(null); await _sut.InitializeAsync(null); Assert.AreEqual(2, _sut.ProjectNames.Count); Assert.IsTrue(_sut.ProjectNames.Contains(projectName1)); Assert.IsTrue(_sut.ProjectNames.Contains(projectName2)); }
public async Task MergeOperation_CheckIfWorkspaceHasIncludedPendingChangesAsync_WhenCalledWithPendingChangesInWorkspace_ThenThrowsException() { _configManager.Expect(x => x.GetValue <bool>(ConfigKeys.ENABLE_WARNING_WHEN_PENDING_CHANGES)) .Return(true); _mergeService.Expect(x => x.HasIncludedPendingChanges(_currentWorkspaceModel)) .Return(true); _sut.MyCurrentAction += InvokesMyCurrentActionWithCheckingPendingChanges; var obj = new PrivateObject(_sut); await(Task) obj.Invoke(CHECK_WORKSPACE_METHOD_NAME, _currentWorkspaceModel); }