public void GivenARootWithNonAsciiCharactorInstallSucceeds() { var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed(); var surrogate = char.ConvertFromUtf32(int.Parse("2A601", NumberStyles.HexNumber)); string nonAscii = "ab Ṱ̺̺̕o 田中さん åä," + surrogate; var root = new DirectoryPath(Path.Combine(TempRoot.Root, nonAscii, Path.GetRandomFileName())); var reporter = new BufferedReporter(); var fileSystem = new FileSystemWrapper(); var store = new ToolPackageStore(root); var installer = new ToolPackageInstaller( store: store, projectRestorer: new ProjectRestorer(reporter), tempProject: GetUniqueTempProjectPathEachTest(), offlineFeed: new DirectoryPath("does not exist")); var package = installer.InstallPackage(new PackageLocation(nugetConfig: nugetConfigPath), packageId: TestPackageId, versionRange: VersionRange.Parse(TestPackageVersion), targetFramework: _testTargetframework); AssertPackageInstall(reporter, fileSystem, package, store); package.Uninstall(); }
private static (IToolPackageStore, IToolPackageInstaller, BufferedReporter, IFileSystem) Setup( bool useMock, IEnumerable <MockFeed> feeds = null, FilePath?tempProject = null, DirectoryPath?offlineFeed = null) { var root = new DirectoryPath(Path.Combine(TempRoot.Root, Path.GetRandomFileName())); var reporter = new BufferedReporter(); IFileSystem fileSystem; IToolPackageStore store; IToolPackageInstaller installer; if (useMock) { var packagedShimsMap = new Dictionary <PackageId, IReadOnlyList <FilePath> > { [TestPackageId] = new FilePath[] { new FilePath("path/demo.exe") } }; fileSystem = new FileSystemMockBuilder().Build(); store = new ToolPackageStoreMock(root, fileSystem); installer = new ToolPackageInstallerMock( fileSystem: fileSystem, store: store, projectRestorer: new ProjectRestorerMock( fileSystem: fileSystem, reporter: reporter, feeds: feeds), packagedShimsMap: packagedShimsMap); } else { fileSystem = new FileSystemWrapper(); store = new ToolPackageStore(root); installer = new ToolPackageInstaller( store: store, projectRestorer: new ProjectRestorer(reporter), tempProject: tempProject ?? GetUniqueTempProjectPathEachTest(), offlineFeed: offlineFeed ?? new DirectoryPath("does not exist")); } store.Root.Value.Should().Be(Path.GetFullPath(root.Value)); return(store, installer, reporter, fileSystem); }
private static (IToolPackageStore, IToolPackageInstaller, BufferedReporter, IFileSystem) Setup( bool useMock, IEnumerable <MockFeed> feeds = null, FilePath?tempProject = null, DirectoryPath?offlineFeed = null) { var root = new DirectoryPath(Path.Combine(Path.GetFullPath(TempRoot.Root), Path.GetRandomFileName())); var reporter = new BufferedReporter(); IFileSystem fileSystem; IToolPackageStore store; IToolPackageInstaller installer; if (useMock) { fileSystem = new FileSystemMockBuilder().Build(); store = new ToolPackageStoreMock(root, fileSystem); installer = new ToolPackageInstallerMock( fileSystem: fileSystem, store: store, projectRestorer: new ProjectRestorerMock( fileSystem: fileSystem, reporter: reporter, feeds: feeds)); } else { fileSystem = new FileSystemWrapper(); store = new ToolPackageStore(root); installer = new ToolPackageInstaller( store: store, projectRestorer: new ProjectRestorer(reporter), tempProject: tempProject ?? GetUniqueTempProjectPathEachTest(), offlineFeed: offlineFeed ?? new DirectoryPath("does not exist")); } return(store, installer, reporter, fileSystem); }