public void WhenSerchInMultiplePathsThenNotThrows()
        {
            // NUnit 3 sets PrivateBinPath when using an NUnit project, so we need to reset back to the correct setting when done.
            var privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

            string binPath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
            var    expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);

            // Test uses an obsolete .Net feature, changing the private path of an ongoing AppDomain.
            // If that feature is dropped, the tests will likely need to be dropped too. (Or heavily changed
            // for running in a newly created AppDomain.)
#pragma warning disable CS0618 // Type or member is obsolete
            try
            {
                AppDomain.CurrentDomain.ClearPrivatePath();
                AppDomain.CurrentDomain.AppendPrivatePath("bin");
                AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
                var configuration = new MyNhConfiguration();
                Assert.That(configuration.DefaultConfigurationFilePath(), Is.EqualTo(expected));
            }
            finally
            {
                AppDomain.CurrentDomain.ClearPrivatePath();
                if (privatePath != null)
                {
                    AppDomain.CurrentDomain.AppendPrivatePath(privatePath);
                }
            }
#pragma warning restore CS0618 // Type or member is obsolete
        }
Пример #2
0
        public void WhenSerchInMultiplePathsThenNotThrows()
        {
            // NUnit 3 sets PrivateBinPath when using an NUnit project, so we need to reset back to the correct setting when done.
            var privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

            string binPath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
            var    expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);

            try
            {
                AppDomain.CurrentDomain.ClearPrivatePath();
                AppDomain.CurrentDomain.AppendPrivatePath("bin");
                AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
                var configuration = new MyNhConfiguration();
                Assert.That(configuration.DefaultConfigurationFilePath(), Is.EqualTo(expected));
            }
            finally
            {
                AppDomain.CurrentDomain.ClearPrivatePath();
                if (privatePath != null)
                {
                    AppDomain.CurrentDomain.AppendPrivatePath(privatePath);
                }
            }
        }
		public void WhenSerchInMultiplePathsThenNotThrows()
		{
			string binPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
			var expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);

			try
			{
				AppDomain.CurrentDomain.AppendPrivatePath("bin");
				AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
				var configuration = new MyNhConfiguration();
				Assert.That(configuration.DefaultConfigurationFilePath(), Is.EqualTo(expected));
			}
			finally
			{
				AppDomain.CurrentDomain.ClearPrivatePath();
			}
		}
Пример #4
0
        public void WhenSerchInMultiplePathsThenNotThrows()
        {
            string binPath  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
            var    expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);

            try
            {
                AppDomain.CurrentDomain.AppendPrivatePath("bin");
                AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
                var configuration = new MyNhConfiguration();
                configuration.DefaultConfigurationFilePath().Should().Be(expected);
            }
            finally
            {
                AppDomain.CurrentDomain.ClearPrivatePath();
            }
        }
		public void WhenSerchInMultiplePathsThenNotThrows()
		{
			// NUnit 3 sets PrivateBinPath when using an NUnit project, so we need to reset back to the correct setting when done.
			var privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;

			string binPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin");
			var expected = Path.Combine(binPath, Configuration.DefaultHibernateCfgFileName);

			try
			{
				AppDomain.CurrentDomain.ClearPrivatePath();
				AppDomain.CurrentDomain.AppendPrivatePath("bin");
				AppDomain.CurrentDomain.AppendPrivatePath("DbScripts");
				var configuration = new MyNhConfiguration();
				Assert.That(configuration.DefaultConfigurationFilePath(), Is.EqualTo(expected));
			}
			finally
			{
				AppDomain.CurrentDomain.ClearPrivatePath();
				if (privatePath != null) AppDomain.CurrentDomain.AppendPrivatePath(privatePath);
			}
		}