コード例 #1
0
        public T GetView <T>(ViewTypes type) where T : Control
        {
            T result = default(T);

            switch (type)
            {
            case ViewTypes.Clone:
                result = new CloneView(_messenger, _shell, _storage, _web) as T;
                break;

            case ViewTypes.Create:
                result = new CreateView(_git, _messenger, _shell, _storage, _web) as T;
                break;

            case ViewTypes.Login:
                result = new LoginView(_messenger, _shell, _storage, _web) as T;
                break;

            case ViewTypes.CreateSnippet:
                result = new CreateSnippet(_messenger, _shell, _storage, _web) as T;
                break;

            default:
                break;
            }
            return(result);
        }
コード例 #2
0
        public void WhenRepositoryIsLocalNameIsNotAutomaticlyPutInDestinationFolder()
        {
            CloneView cloneView = SetUpClonePresenterTestWithRepositry(TestRepository, DestinationLocation);

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(DestinationLocation);

            Assert.That(cloneView.DestinationFolder, Is.EqualTo(DestinationLocation));
        }
コード例 #3
0
        private void VerifyGitRepositoryName(string gitUrl)
        {
            string expectedDestinationFolder = string.Format("{0}\\{1}", DestinationLocation, "FatCatGit");

            CloneView cloneView = SetUpClonePresenterTestWithRepositry(gitUrl, expectedDestinationFolder);

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(DestinationLocation);

            Assert.That(cloneView.DestinationFolder, Is.EqualTo(expectedDestinationFolder));
        }
コード例 #4
0
        public void SpecificyDestionationFolderWillUseRepositoryNameAsSubFolder()
        {
            string expectedDestinationFolder = string.Format("{0}\\{1}", DestinationLocation, "SomeTestRepository");

            CloneView cloneView = SetUpClonePresenterTestWithRepositry(@"[email protected]:DavidBasarab/SomeTestRepository.git", expectedDestinationFolder);

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(DestinationLocation);

            Assert.That(cloneView.DestinationFolder, Is.EqualTo(expectedDestinationFolder));
        }
コード例 #5
0
        public void IfDirectoryEndsInRepoNameDoNotAdd()
        {
            string expectedDestinationFolder = string.Format("{0}\\{1}\\", DestinationLocation, "SomeTestRepository");

            CloneView cloneView = SetUpClonePresenterTestWithRepositry(TestRepository, expectedDestinationFolder);

            var presenter = new ClonePresenter(cloneView);

            presenter.SetDestinationFolder(expectedDestinationFolder);

            Assert.That(cloneView.DestinationFolder, Is.EqualTo(expectedDestinationFolder));
        }
コード例 #6
0
        public void WhenRepositoryAndDestinaitonArePopulatedCloneButtonIsShown()
        {
            CloneView view = SetUpTestForDisplayCloneButton();

            view.RepositoryToClone = "some value";
            view.DestinationFolder = "some value, can be same of different";

            var presenter = new ClonePresenter(view);

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.True);
        }
コード例 #7
0
        public void WhenRepositoryIsNotPopulatedTheCloneButtonIsNotShown()
        {
            CloneView view = SetUpTestForHideCloneButton();

            var presenter = new ClonePresenter(view);

            view.RepositoryToClone = "value";
            view.DestinationFolder = "some value";

            presenter.DestionFolderTextChanged();

            view.RepositoryToClone = null;
            view.DestinationFolder = "some value";

            presenter.DestionFolderTextChanged();

            Assert.That(presenter.IsCloneButtonShown, Is.False);
        }
コード例 #8
0
 public ClonePresenter(CloneView view)
 {
     View = view;
 }
コード例 #9
0
ファイル: ClonePresenter.cs プロジェクト: liquidboy/FatCatGit
 public ClonePresenter(CloneView view)
 {
     View = view;
 }