AppSecInc.ProcessDomain.UnitTests.TestProcessDomain.TestConfigurationLocation C# (CSharp) Method

TestConfigurationLocation() private method

private TestConfigurationLocation ( ) : void
return void
        public void TestConfigurationLocation()
        {
            // by default uses our app config
            using (var domain1 = ProcessDomain.CreateDomain("Domain1"))
            {
                var obj = (RemoteTestObject)domain1.CreateInstanceAndUnwrap(TestObjectAssemblyName, TestObjectTypeName);
                Assert.That(obj.GetAppConfigValue("MyValue"), Is.EqualTo("MyValue"));
            }

            // now point it at a different app config
            var setupInfo = new ProcessDomainSetup
            {
                AppDomainSetupInformation =
                {
                    ConfigurationFile = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), "OtherApp.config")
                }
            };

            using (var domain2 = ProcessDomain.CreateDomain("Domain2", setupInfo))
            {
                var obj = (RemoteTestObject)domain2.CreateInstanceAndUnwrap(TestObjectAssemblyName, TestObjectTypeName);
                Assert.That(obj.GetAppConfigValue("MyValue"), Is.EqualTo("OtherValue"));
            }
        }