Exemple #1
0
            public void TryGetDefaultConnectionFactory_throws_if_factory_name_in_config_is_whitespace()
            {
                var config = new AppConfig(CreateEmptyConfig().AddDefaultConnectionFactory(" "));

                Assert.Equal(
                    Strings.SetConnectionFactoryFromConfigFailed(" "),
                    Assert.Throws <InvalidOperationException>(() => { var temp = config.TryGetDefaultConnectionFactory(); }).Message);
            }
Exemple #2
0
            public void TryGetDefaultConnectionFactory_throws_if_factory_type_cannot_be_found()
            {
                var config = new AppConfig(CreateEmptyConfig().AddDefaultConnectionFactory("BogusFactory"));

                Assert.Equal(
                    Strings.SetConnectionFactoryFromConfigFailed("BogusFactory"),
                    Assert.Throws <InvalidOperationException>(() => { var temp = config.TryGetDefaultConnectionFactory(); }).Message);
            }
Exemple #3
0
            public void TryGetDefaultConnectionFactory_throws_if_factory_type_is_Abstract()
            {
                var config =
                    new AppConfig(CreateEmptyConfig().AddDefaultConnectionFactory(typeof(FakeBaseConnectionFactory).AssemblyQualifiedName));

                Assert.Equal(
                    Strings.SetConnectionFactoryFromConfigFailed(typeof(FakeBaseConnectionFactory).AssemblyQualifiedName),
                    Assert.Throws <InvalidOperationException>(() => { var temp = config.TryGetDefaultConnectionFactory(); }).Message);
            }
Exemple #4
0
            public void TryGetDefaultConnectionFactory_throws_if_constructor_with_parameters_is_required_but_not_available()
            {
                var config =
                    new AppConfig(
                        CreateEmptyConfig().AddDefaultConnectionFactory(typeof(FakeConnectionFactoryNoParams).AssemblyQualifiedName, ""));

                Assert.Equal(
                    Strings.SetConnectionFactoryFromConfigFailed(typeof(FakeConnectionFactoryNoParams).AssemblyQualifiedName),
                    Assert.Throws <InvalidOperationException>(() => { var temp = config.TryGetDefaultConnectionFactory(); }).Message);
            }