コード例 #1
0
        public async Task MergeOperation_CheckIfWorkspaceHasIncludedPendingChangesAsync_WhenCalledWithPendingChangesInWorkspace_ThenThrowsException()
        {
            _configHelper.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);
        }
コード例 #2
0
        public void TeamMergeViewModel_Initialize_WhenCalled_InitializesTheSelectableProjectNames()
        {
            var workspaceModel = new WorkspaceModel {
                Name = "Go test", OwnerName = "14525"
            };
            var projectName1 = "Project1";
            var projectName2 = "Project2";

            _teamService.Expect(x => x.GetProjectNames()).Return(Task.FromResult <IEnumerable <string> >(new List <string> {
                projectName1, projectName2
            }));

            _teamService.Expect(x => x.AllWorkspaces()).Return(Task.FromResult <IEnumerable <WorkspaceModel> >(new List <WorkspaceModel> {
                workspaceModel
            }));
            _teamService.Expect(x => x.CurrentWorkspace()).Return(workspaceModel);

            _configHelper.Expect(x => x.GetValue <bool>(ConfigKeys.SAVE_BRANCH_PERSOLUTION)).Return(false);
            _configHelper.Expect(x => x.GetValue <string>(ConfigKeys.SELECTED_PROJECT_NAME)).Return(null);

            _sut.Initialize(this, new SectionInitializeEventArgs(_serviceProvider, null));

            Assert.AreEqual(2, _sut.ProjectNames.Count);
            Assert.IsTrue(_sut.ProjectNames.Contains(projectName1));
            Assert.IsTrue(_sut.ProjectNames.Contains(projectName2));
        }