public void WhenNoShortCutUsedThenCanBuildInstanceOfConfiguredObjectsFactory()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyObjectsFactory, typeof(MyObjectsFactory).AssemblyQualifiedName }
            };

            Assert.That(Environment.BuildObjectsFactory(properties), Is.InstanceOf <MyObjectsFactory>());
        }
        public void WhenInvalidThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyObjectsFactory, typeof(InvalidObjectsFactory).AssemblyQualifiedName }
            };

            Assert.That(() => Environment.BuildObjectsFactory(properties), Throws.TypeOf <HibernateObjectsFactoryException>());
        }
Exemple #3
0
        public void WhenInvalidThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(InvalidByteCodeProvider).AssemblyQualifiedName }
            };

            Assert.That(() => Environment.BuildBytecodeProvider(properties), Throws.TypeOf <HibernateByteCodeException>());
        }
        public void WhenNoShortCutUsedThenCanBuildObjectsFactory()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(MyObjectsFactory).AssemblyQualifiedName }
            };

            Assert.That(() => Environment.BuildObjectsFactory(properties), Throws.Nothing);
        }
Exemple #5
0
        public void WhenNoShortCutUsedThenCanBuildInstanceOfConfiguredBytecodeProvider()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(MyByteCodeProvider).AssemblyQualifiedName }
            };

            Assert.That(Environment.BuildBytecodeProvider(properties), Is.InstanceOf <MyByteCodeProvider>());
        }
        public void WhenInvalidThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(InvalidByteCodeProvider).AssemblyQualifiedName }
            };

            Executing.This(() => Environment.BuildBytecodeProvider(properties)).Should().Throw <HibernateByteCodeException>();
        }
        public void WhenNoShortCutUsedThenCanBuildBytecodeProvider()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(MyByteCodeProvider).AssemblyQualifiedName }
            };

            Executing.This(() => Environment.BuildBytecodeProvider(properties)).Should().NotThrow();
        }
        public void WhenNoDefaultCtorThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyObjectsFactory, typeof(InvalidNoCtorObjectsFactory).AssemblyQualifiedName }
            };

            Assert.That(() => Environment.BuildObjectsFactory(properties), Throws.TypeOf <HibernateObjectsFactoryException>()
                        .And.InnerException.Message.Contains("constructor was not found"));
        }
Exemple #9
0
        public void WhenNoDefaultCtorThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(InvalidNoCtorByteCodeProvider).AssemblyQualifiedName }
            };

            Assert.That(() => Environment.BuildBytecodeProvider(properties), Throws.TypeOf <HibernateByteCodeException>()
                        .And.InnerException.Message.ContainsSubstring("constructor was not found"));
        }
        public void WhenNoDefaultCtorThenThrow()
        {
            var properties = new Dictionary <string, string> {
                { Environment.PropertyBytecodeProvider, typeof(InvalidNoCtorByteCodeProvider).AssemblyQualifiedName }
            };

            Executing.This(() => Environment.BuildBytecodeProvider(properties)).Should().Throw <HibernateByteCodeException>()
            .And.Exception.InnerException.Message.Should().Contain("constructor was not found");
        }
Exemple #11
0
 /// <summary>
 ///  Get a named connection string, if configured.
 /// </summary>
 /// <exception cref="HibernateException">
 /// Thrown when a <see cref="Environment.ConnectionStringName"/> was found
 /// in the <c>settings</c> parameter but could not be found in the app.config.
 /// </exception>
 protected virtual string GetNamedConnectionString(IDictionary <string, string> settings)
 {
     return(Environment.GetNamedConnectionString(settings));
 }