public IssueControllerTests(ITestOutputHelper helper) { this._testOutputHelper = helper; var projectRoot = FrameworkAssemblyUtility.GetPathFromAssembly(this.GetType().Assembly, "../../../"); var projectInfo = new DirectoryInfo(projectRoot); Assert.True(projectInfo.Exists); var basePath = projectInfo.Parent.FindDirectory("Edu.Ucsb.IssueManager.Web").FullName; var builder = Program.CreateWebHostBuilder(args: null, builderAction: (builderContext, configBuilder) => { Assert.NotNull(builderContext); this._testOutputHelper.WriteLine($"configuring {nameof(TestServer)} with {nameof(basePath)}: {basePath}..."); var env = builderContext.HostingEnvironment; Assert.NotNull(env); env.ContentRootPath = basePath; env.EnvironmentName = AppScalars.EnvironmentNameForAutomatedTesting; env.WebRootPath = $"{basePath}{Path.DirectorySeparatorChar}wwwroot"; configBuilder.SetBasePath(env.ContentRootPath); }); Assert.NotNull(builder); this._server = new TestServer(builder); }
static void DisplayAssemblyInfo() { Console.Write(FrameworkAssemblyUtility.GetAssemblyInfo(Assembly.GetExecutingAssembly(), true)); Console.WriteLine(string.Empty); Console.WriteLine("Activities Assembly:"); Console.Write(FrameworkAssemblyUtility.GetAssemblyInfo(typeof(DashboardActivitiesGetter).Assembly, true)); }
/// <summary> /// Test context extensions: should get assembly directory. /// </summary> /// <param name="context">The context.</param> /// <param name="typeInAssembly">The type in assembly.</param> /// <returns></returns> public static string ShouldGetAssemblyDirectory(this TestContext context, Type typeInAssembly) { Assert.IsNotNull(typeInAssembly, "The expected type instance is not here."); var assembly = typeInAssembly.Assembly; var path = FrameworkAssemblyUtility.GetPathFromAssembly(assembly); context.ShouldFindDirectory(path); return(path); }
public IssueManagerRepositoryTest(ITestOutputHelper helper) { this._testOutputHelper = helper; var projectRoot = FrameworkAssemblyUtility .GetPathFromAssembly(this.GetType().Assembly, "../../../"); var projectInfo = new DirectoryInfo(projectRoot); var basePath = projectInfo.Parent.FindDirectory("Edu.Ucsb.IssueManager.Web").FullName; this._configuration = ProgramUtility.LoadConfiguration(basePath); }
public ProgramTest(ITestOutputHelper helper) { this._testOutputHelper = helper; this._basePath = FrameworkAssemblyUtility.GetPathFromAssembly(this.GetType().Assembly, @"..\..\..\"); }