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); }
public void WhenRepositoryIsLocalNameIsNotAutomaticlyPutInDestinationFolder() { CloneView cloneView = SetUpClonePresenterTestWithRepositry(TestRepository, DestinationLocation); var presenter = new ClonePresenter(cloneView); presenter.SetDestinationFolder(DestinationLocation); Assert.That(cloneView.DestinationFolder, Is.EqualTo(DestinationLocation)); }
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)); }
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)); }
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)); }
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); }
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); }
public ClonePresenter(CloneView view) { View = view; }
public ClonePresenter(CloneView view) { View = view; }