Пример #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();

            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);
        }