зеркало из https://github.com/github/VisualStudio.git
Check owner is included in default repository path
Expect test to fail until functionality implemented.
This commit is contained in:
Родитель
e57ef12ac2
Коммит
7d3e80e983
|
@ -113,12 +113,10 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
public async Task Repository_Name_Is_Appended_To_Base_Path()
|
public async Task Repository_Name_Is_Appended_To_Base_Path()
|
||||||
{
|
{
|
||||||
var target = CreateTarget();
|
var target = CreateTarget();
|
||||||
var repository = Substitute.For<IRepositoryModel>();
|
|
||||||
|
|
||||||
repository.Name.Returns("repo");
|
SetRepository(target.GitHubTab, CreateRepositoryModel("owner", "repo"));
|
||||||
SetRepository(target.GitHubTab, repository);
|
|
||||||
|
|
||||||
Assert.That(target.Path, Is.EqualTo("d:\\efault\\path\\repo"));
|
Assert.That(target.Path, Is.EqualTo("d:\\efault\\path\\owner\\repo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -135,10 +133,7 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
public async Task PathError_Is_Set_For_Existing_Destination()
|
public async Task PathError_Is_Set_For_Existing_Destination()
|
||||||
{
|
{
|
||||||
var target = CreateTarget();
|
var target = CreateTarget();
|
||||||
var repository = Substitute.For<IRepositoryModel>();
|
SetRepository(target.GitHubTab, CreateRepositoryModel("owner", "repo"));
|
||||||
|
|
||||||
repository.Name.Returns("repo");
|
|
||||||
SetRepository(target.GitHubTab, repository);
|
|
||||||
target.Path = "d:\\exists";
|
target.Path = "d:\\exists";
|
||||||
|
|
||||||
Assert.That(target.PathError, Is.EqualTo(Resources.DestinationAlreadyExists));
|
Assert.That(target.PathError, Is.EqualTo(Resources.DestinationAlreadyExists));
|
||||||
|
@ -148,13 +143,14 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
public async Task Repository_Name_Replaces_Last_Part_Of_Non_Base_Path()
|
public async Task Repository_Name_Replaces_Last_Part_Of_Non_Base_Path()
|
||||||
{
|
{
|
||||||
var target = CreateTarget();
|
var target = CreateTarget();
|
||||||
var repository = Substitute.For<IRepositoryModel>();
|
|
||||||
|
|
||||||
target.Path = "d:\\efault\\foo";
|
var owner = "owner";
|
||||||
repository.Name.Returns("repo");
|
target.Path = "d:\\efault";
|
||||||
SetRepository(target.GitHubTab, repository);
|
SetRepository(target.GitHubTab, CreateRepositoryModel(owner, "name"));
|
||||||
|
target.Path = $"d:\\efault\\{owner}\\foo";
|
||||||
|
SetRepository(target.GitHubTab, CreateRepositoryModel(owner, "repo"));
|
||||||
|
|
||||||
Assert.That(target.Path, Is.EqualTo("d:\\efault\\repo"));
|
Assert.That(target.Path, Is.EqualTo($"d:\\efault\\{owner}\\repo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -174,7 +170,7 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
|
|
||||||
await target.InitializeAsync(null);
|
await target.InitializeAsync(null);
|
||||||
|
|
||||||
SetRepository(target.GitHubTab, Substitute.For<IRepositoryModel>());
|
SetRepository(target.GitHubTab, CreateRepositoryModel());
|
||||||
|
|
||||||
Assert.That(target.Clone.CanExecute(null), Is.True);
|
Assert.That(target.Clone.CanExecute(null), Is.True);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +182,7 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
|
|
||||||
await target.InitializeAsync(null);
|
await target.InitializeAsync(null);
|
||||||
|
|
||||||
SetRepository(target.GitHubTab, Substitute.For<IRepositoryModel>());
|
SetRepository(target.GitHubTab, CreateRepositoryModel());
|
||||||
Assert.That(target.Clone.CanExecute(null), Is.True);
|
Assert.That(target.Clone.CanExecute(null), Is.True);
|
||||||
|
|
||||||
target.Path = "d:\\exists";
|
target.Path = "d:\\exists";
|
||||||
|
@ -260,5 +256,13 @@ namespace GitHub.App.UnitTests.ViewModels.Dialog.Clone
|
||||||
enterpriseTab,
|
enterpriseTab,
|
||||||
urlTab);
|
urlTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IRepositoryModel CreateRepositoryModel(string owner = "owner", string name = "repo")
|
||||||
|
{
|
||||||
|
var repository = Substitute.For<IRepositoryModel>();
|
||||||
|
repository.Owner.Returns(owner);
|
||||||
|
repository.Name.Returns(name);
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче