Fix paths issues
This commit is contained in:
Родитель
2d0a6e4e06
Коммит
d69f486f15
|
@ -16,6 +16,7 @@ namespace Camelotia.Presentation.Tests
|
|||
{
|
||||
public sealed class ProviderViewModelTests
|
||||
{
|
||||
private static readonly string Separator = Path.DirectorySeparatorChar.ToString();
|
||||
private readonly IAuthViewModel _authViewModel = Substitute.For<IAuthViewModel>();
|
||||
private readonly IFileManager _fileManager = Substitute.For<IFileManager>();
|
||||
private readonly IProvider _provider = Substitute.For<IProvider>();
|
||||
|
@ -41,11 +42,11 @@ namespace Camelotia.Presentation.Tests
|
|||
[Fact]
|
||||
public void ShouldDisplayCurrentPathProperly() => new TestScheduler().With(scheduler =>
|
||||
{
|
||||
_provider.InitialPath.Returns("/");
|
||||
_provider.InitialPath.Returns(Separator);
|
||||
|
||||
var model = BuildProviderViewModel(scheduler);
|
||||
model.IsCurrentPathEmpty.Should().BeFalse();
|
||||
model.CurrentPath.Should().Be("/");
|
||||
model.CurrentPath.Should().Be(Separator);
|
||||
scheduler.AdvanceBy(2);
|
||||
|
||||
model.IsCurrentPathEmpty.Should().BeFalse();
|
||||
|
@ -54,7 +55,7 @@ namespace Camelotia.Presentation.Tests
|
|||
scheduler.AdvanceBy(4);
|
||||
|
||||
model.IsCurrentPathEmpty.Should().BeTrue();
|
||||
model.CurrentPath.Should().Be("/");
|
||||
model.CurrentPath.Should().Be(Separator);
|
||||
model.Files.Should().BeEmpty();
|
||||
});
|
||||
|
||||
|
@ -95,30 +96,30 @@ namespace Camelotia.Presentation.Tests
|
|||
public void ShouldBeAbleToOpenSelectedPath() => new TestScheduler().With(scheduler =>
|
||||
{
|
||||
|
||||
var file = new FileModel("foo", "/foo", true, string.Empty);
|
||||
_provider.Get("/").Returns(Enumerable.Repeat(file, 1));
|
||||
var file = new FileModel("foo", Separator + "foo", true, string.Empty);
|
||||
_provider.Get(Separator).Returns(Enumerable.Repeat(file, 1));
|
||||
_authViewModel.IsAuthenticated.Returns(true);
|
||||
_provider.InitialPath.Returns("/");
|
||||
_provider.InitialPath.Returns(Separator);
|
||||
|
||||
var model = BuildProviderViewModel(scheduler);
|
||||
using (model.Activator.Activate())
|
||||
{
|
||||
scheduler.AdvanceBy(3);
|
||||
model.Files.Should().NotBeEmpty();
|
||||
model.CurrentPath.Should().Be("/");
|
||||
model.CurrentPath.Should().Be(Separator);
|
||||
|
||||
model.SelectedFile = model.Files.First();
|
||||
model.Open.CanExecute(null).Should().BeTrue();
|
||||
model.Open.Execute(null);
|
||||
|
||||
scheduler.AdvanceBy(3);
|
||||
model.CurrentPath.Should().Be("/foo");
|
||||
model.CurrentPath.Should().Be(Separator + "foo");
|
||||
|
||||
model.Back.CanExecute(null).Should().BeTrue();
|
||||
model.Back.Execute(null);
|
||||
|
||||
scheduler.AdvanceBy(3);
|
||||
model.CurrentPath.Should().Be("/");
|
||||
model.CurrentPath.Should().Be(Separator);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Camelotia.Services.Providers
|
|||
|
||||
public string Description => "Yandex Disk file provider";
|
||||
|
||||
public string InitialPath { get; } = "/";
|
||||
public string InitialPath { get; } = Path.DirectorySeparatorChar.ToString();
|
||||
|
||||
public IObservable<bool> IsAuthorized => _isAuthorized;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче