public ProjectTemplateTester(string projectFilePath, string tempDirectoryPath) { this.projectDirectoryPath = Path.GetDirectoryName(projectFilePath); if (string.IsNullOrEmpty(tempDirectoryPath)) { this.tempDirectoryPath = Path.Combine( Path.GetTempPath(), Path.GetFileNameWithoutExtension(projectFilePath) + "-" + Guid.NewGuid().ToString()); } else { this.tempDirectoryPath = Path.Combine( tempDirectoryPath, Path.GetFileNameWithoutExtension(projectFilePath) + "-" + Guid.NewGuid().ToString()); } DirectoryExtended.Copy(this.projectDirectoryPath, this.tempDirectoryPath); var container = new ContainerBuilder() .RegisterServices(Path.Combine(this.tempDirectoryPath, "Boilerplate.AspNetCore.Sample.xproj")) .RegisterFeatureSet(FeatureSet.Mvc6) .Build(); this.features = new FeatureCollection(container.Resolve <IEnumerable <IFeature> >()); this.fileSystemService = container.Resolve <IFileSystemService>(); }
public async Task AssertNpmInstallSucceeded() { await this.EnsureNpmCacheInitialized(); DirectoryExtended.Copy(this.npmModulesDirectoryPath, Path.Combine(this.tempDirectoryPath, "node_modules")); await ProcessAssert.AssertStart(this.tempDirectoryPath, GetNpmFilePath(), "install", TimeSpan.FromMinutes(5)); }
public MVC6SampleTest() { this.projectDirectoryPath = ConfigurationManager.AppSettings["ProjectDirectoryPath"]; this.tempDirectoryPath = ConfigurationManager.AppSettings["TempDirectoryPath"] + Guid.NewGuid().ToString(); DirectoryExtended.Copy(this.projectDirectoryPath, this.tempDirectoryPath); var container = new ContainerBuilder() .RegisterServices(Path.Combine(this.tempDirectoryPath, "Boilerplate.AspNetCore.Sample.xproj")) .RegisterFeatureSet(FeatureSet.Mvc6) .Build(); this.features = new FeatureCollection(container.Resolve <IEnumerable <IFeature> >()); this.fileSystemService = container.Resolve <IFileSystemService>(); }
public ProjectTemplateTester(string projectFilePath, string tempDirectoryPath) { this.projectDirectoryPath = Path.GetDirectoryName(projectFilePath); this.tempDirectoryPath = Path.Combine( tempDirectoryPath, Path.GetFileNameWithoutExtension(projectFilePath) + "-" + Guid.NewGuid().ToString()); var tempProjectFilePath = Path.Combine(this.tempDirectoryPath, Path.GetFileName(projectFilePath)); this.npmCacheDirectoryPath = Path.Combine(tempDirectoryPath, "npm"); this.npmModulesDirectoryPath = Path.Combine(this.npmCacheDirectoryPath, "node_modules"); DirectoryExtended.Copy(this.projectDirectoryPath, this.tempDirectoryPath); var container = new ContainerBuilder() .RegisterServices(tempProjectFilePath) .RegisterFeatureSet(FeatureSet.Mvc6) .Build(); this.features = new FeatureCollection(container.Resolve <IEnumerable <IFeature> >()); this.fileSystemService = container.Resolve <IFileSystemService>(); }
//private async Task AssertSiteStartsAndResponds(params string[] urls) //{ // var assembly = Assembly.LoadFile(Path.Combine(this.tempDirectoryPath, @"bin\Boilerplate.AspNerCore.Sample.dll")); // var startupType = assembly.ExportedTypes.FirstOrDefault(x => string.Equals(x.Name, "Startup")); // using (TestServer server = new TestServer(new WebHostBuilder().UseStartup(startupType))) // { // foreach (var url in urls) // { // var response = await server.CreateRequest(url).SendAsync("GET"); // response.EnsureSuccessStatusCode(); // } // } //} public void Dispose() { DirectoryExtended.Delete(this.tempDirectoryPath); }