예제 #1
0
        public void Copy()
        {
            HostSetup setup = new HostSetup
            {
                ApplicationBaseDirectory  = @"C:\AppBase",
                Configuration             = { ConfigurationXml = "<xml/>" },
                ConfigurationFileLocation = ConfigurationFileLocation.AppBase,
                ProcessorArchitecture     = ProcessorArchitecture.Amd64,
                ShadowCopy       = true,
                DebuggerSetup    = new DebuggerSetup(),
                RuntimeVersion   = "2.0.50727",
                Elevated         = true,
                WorkingDirectory = @"C:\WorkingDir",
            };

            setup.AddHintDirectory("Abc");
            setup.AddProperty("abc", "def");

            HostSetup copy = setup.Copy();

            Assert.AreEqual(setup.ApplicationBaseDirectory, copy.ApplicationBaseDirectory);
            Assert.AreEqual(setup.Configuration.ConfigurationXml, copy.Configuration.ConfigurationXml);
            Assert.AreEqual(setup.ConfigurationFileLocation, copy.ConfigurationFileLocation);
            Assert.AreEqual(setup.ProcessorArchitecture, copy.ProcessorArchitecture);
            Assert.AreEqual(setup.ShadowCopy, copy.ShadowCopy);
            Assert.AreEqual(setup.Elevated, copy.Elevated);
            Assert.IsNotNull(copy.DebuggerSetup);
            Assert.AreEqual(setup.RuntimeVersion, copy.RuntimeVersion);
            Assert.AreEqual(setup.WorkingDirectory, copy.WorkingDirectory);
            Assert.AreEqual(setup.HintDirectories, copy.HintDirectories);
            Assert.AreEqual(setup.Properties, copy.Properties);
        }
예제 #2
0
        /// <summary>
        /// Creates a host setup based on the package properties.
        /// </summary>
        /// <returns>The host setup.</returns>
        public HostSetup CreateHostSetup()
        {
            var hostSetup = new HostSetup
            {
                DebuggerSetup            = DebuggerSetup,
                ShadowCopy               = ShadowCopy,
                ApplicationBaseDirectory = ApplicationBaseDirectory != null ? ApplicationBaseDirectory.FullName : null,
                WorkingDirectory         = WorkingDirectory != null ? WorkingDirectory.FullName : null,
                RuntimeVersion           = RuntimeVersion
            };

            GenericCollectionUtils.ForEach(Properties, x => hostSetup.AddProperty(x.Key, x.Value));
            GenericCollectionUtils.ForEach(HintDirectories, x => hostSetup.AddHintDirectory(x.FullName));
            return(hostSetup);
        }