Builds and packages the test site using MSBuild.
예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
        /// </summary>
        /// <param name="projectName">Name of the web project. This is assumed to be
        /// both the project folder name, and also the <c>.csproj</c> name (without the .csproj extension).
        /// If the project folder name and .csproj name are different, 
        /// set the .csproj name in <paramref name="options"/>.</param>
        /// <param name="options">Optional configuration settings.</param>
        public TestSiteManager(string projectName, TestSiteOptions options = null)
        {
            options = options ?? new TestSiteOptions();
            options.ApplyDefaultsWhereNecessary (projectName);
            options.Validate();

            _deployer = new TestSiteDeployer(options.Deployer);
            _server = new TestSiteServer (_deployer.TestSitePath, options.Server);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
        /// </summary>
        /// <param name="projectName">Name of the web project. This is assumed to be
        /// both the project folder name, and also the <c>.csproj</c> name (without the .csproj extension).
        /// If the project folder name and .csproj name are different,
        /// set the .csproj name in <paramref name="options"/>.</param>
        /// <param name="options">Optional configuration settings.</param>
        public TestSiteManager(string projectName, TestSiteOptions options = null)
        {
            options = options ?? new TestSiteOptions();
            options.ApplyDefaultsWhereNecessary(projectName);
            options.Validate();

            _deployer = new TestSiteDeployer(options.Deployer);
            _server   = new TestSiteServer(_deployer.TestSitePath, options.Server);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
        /// </summary>
        /// <param name="deployerOptions">Options for the deployment (MsBuild deploy/publish).</param>
        /// <param name="serverOptions">Options for the server (IIS Express).</param>
        public TestSiteManager(TestSiteDeployerOptions deployerOptions, TestSiteServerOptions serverOptions = null)
        {
            serverOptions = serverOptions ?? new TestSiteServerOptions();

            deployerOptions.FinalizeAndValidate();
            serverOptions.FinalizeAndValidate();

            _deployer = new TestSiteDeployer(deployerOptions);
            _server   = new TestSiteServer(_deployer, serverOptions);
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
        /// </summary>
        /// <param name="projectName">Name of the web project. This is assumed to be
        /// both the project folder name, and also the <c>.csproj</c> name (without the .csproj extension).
        /// If the project folder name and .csproj name are different, 
        /// set the .csproj name in <paramref name="options"/>.</param>
        /// <param name="options">Optional configuration settings.</param>
        public TestSiteManager(string projectName, TestSiteOptions options = null)
        {
            options = options ?? new TestSiteOptions();

            if (options.ApplicationPath == null || !options.ApplicationPath.StartsWith("/"))
                throw new ArgumentException("Application path must start with '/'.", "options");

            string siteRoot = (!string.IsNullOrWhiteSpace(options.ProjectDir)) ? options.ProjectDir : GetPathRelativeToCurrentAssemblyPath(@"..\..\..\" + projectName);
            if (!Directory.Exists(siteRoot))
                throw new Exception("A project with name '" + projectName + "' could not be found.");

            _deployer = new TestSiteDeployer(siteRoot, options.ProjectFileName ?? projectName + ".csproj", options.SolutionDir, options.ProjectDir, options.Targets);
            _server = new TestSiteServer(_deployer.TestSitePath,
                options.Port, options.ApplicationPath,
                options.ShowIisExpressWindow, options.EnableWindowsAuthentication);
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
        /// </summary>
        /// <param name="projectName">Name of the project, that is, the name of the <c>.csproj</c> for the web project without the file extension.</param>
        /// <param name="port">The port to use for the ISS Express instance.</param>
        /// <param name="applicationPath">The application path, defaults to the server root <c>"/"</c>.</param>
        public TestSiteManager(string projectName, int port = 8888, string applicationPath = "/")
        {
            if (applicationPath == null || !applicationPath.StartsWith("/"))
            {
                throw new ArgumentException("Application path must start with '/'.", "applicationPath");
            }

            string siteRoot = GetPathRelativeToCurrentAssemblyPath(@"..\..\..\" + projectName);

            if (!Directory.Exists(siteRoot))
            {
                throw new Exception("A project with name '" + projectName + "' could not be found.");
            }

            _deployer = new TestSiteDeployer(siteRoot, projectName);
            _server   = new TestSiteServer(_deployer.TestSitePath, port, applicationPath);
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestSiteManager" /> class.
 /// </summary>
 /// <param name="deployerOptions">Options for the deployment (MsBuild deploy/publish).</param>
 /// <param name="serverOptions">Options for the server (IIS Express).</param>
 public TestSiteManager(TestSiteDeployerOptions deployerOptions, TestSiteServerOptions serverOptions = null)
 {
     _deployer = new TestSiteDeployer(deployerOptions);
     _server   = new TestSiteServer(_deployer, serverOptions ?? new TestSiteServerOptions());
 }
예제 #7
0
 /// <summary>
 /// Creates a new test site server that hosts the application deployed by the given <paramref name="deployer"/> using
 /// options defined in <paramref name="options"/>.
 /// </summary>
 public TestSiteServer(TestSiteDeployer deployer, TestSiteServerOptions options) : this(deployer.TestSitePath, options)
 {
 }