public void GameLocation( Utility.Return r, ProfileDataFolderVm sut) { sut.FileSystem.Directory.Exists(Arg.Any <string>()).Returns(true); sut.GameLocator.TryGet(Arg.Any <GameRelease>(), out Arg.Any <DirectoryPath>()) .Returns(x => { switch (r) { case Utility.Return.False: return(false); case Utility.Return.True: x[1] = new DirectoryPath("Something"); return(true); default: throw new Exception(); } }); sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True); if (r == Utility.Return.True) { sut.Path.Path.Should().NotBeNullOrWhiteSpace(); } else { sut.Path.Path.Should().BeNullOrWhiteSpace(); } }
public void WatchesForFileExistence( Utility.Return r, DirectoryPath folder, [Frozen] IFileSystem fs, [Frozen] IProfileIdentifier ident, [Frozen] IGameDirectoryLookup lookup, Func <ProfileDataFolderVm> sutF) { lookup.TryGet(ident.Release, out Arg.Any <DirectoryPath>()) .Returns(x => { x[1] = folder; return(true); }); var dataFolder = Path.Combine(folder.Path, "Data"); fs.Directory.Exists(dataFolder).Returns(r); var sut = sutF(); sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True); if (r == Utility.Return.True) { sut.DataFolderResult.Value.Path.Should().Be(dataFolder); sut.Path.Path.Should().NotBeNullOrWhiteSpace(); } else { sut.Path.Path.Should().BeNullOrWhiteSpace(); } }
public async Task HasDataPathOverride( Utility.Return r, DirectoryPath folder, ProfileDataFolderVm sut) { sut.FileSystem.Directory.Exists(folder.Path).Returns(r); sut.DataPathOverride = folder; sut.DataFolderResult.Succeeded.Should().Be(r == Utility.Return.True); if (r == Utility.Return.True) { sut.DataFolderResult.Value.Should().Be(folder); sut.Path.Path.Should().NotBeNullOrWhiteSpace(); } else { sut.Path.Path.Should().BeNullOrWhiteSpace(); } }