示例#1
0
        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);
        }
示例#2
0
 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));
 }
示例#3
0
        /// <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);
        }
示例#4
0
        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);
        }
示例#5
0
        public ProgramTest(ITestOutputHelper helper)
        {
            this._testOutputHelper = helper;

            this._basePath = FrameworkAssemblyUtility.GetPathFromAssembly(this.GetType().Assembly, @"..\..\..\");
        }