The class used to configure the MicroLite ORM framework using the fluent API.
Inheritance: IConfigureConnection, ICreateSessionFactory
コード例 #1
0
            public WhenCallingCreateSessionFactory_WithNamedConnection()
            {
                var fluentConfiguration = new FluentConfiguration((ISessionFactory s) =>
                {
                    this.sessionFactoryCreatedCalled = true;
                    return s;
                });

                this.sessionFactory = fluentConfiguration
                    .ForConnection("SqlConnection", this.mockSqlDialect.Object, this.mockDbDriver.Object)
                    .CreateSessionFactory();
            }
コード例 #2
0
            public WhenCallingCreateSessionFactory()
            {
                this.mockSqlDialect.Setup(x => x.SqlCharacters).Returns(this.sqlCharacters);

                var fluentConfiguration = new FluentConfiguration((ISessionFactory s) =>
                {
                    this.sessionFactoryCreatedCalled = true;
                    return s;
                });

                this.sessionFactory = fluentConfiguration
                    .ForConnection("SqlConnection", this.mockSqlDialect.Object, this.mockDbDriver.Object)
                    .CreateSessionFactory();
            }
コード例 #3
0
            public WhenCallingCreateSessionFactory_MultipleTimesForTheSameConnection()
            {
                var fluentConfiguration = new FluentConfiguration((ISessionFactory s) =>
                {
                    this.sessionFactoryCreatedCount++;
                    return s;
                });

                this.sessionFactory1 = fluentConfiguration
                    .ForConnection("SqlConnection", new Mock<ISqlDialect>().Object, new Mock<IDbDriver>().Object)
                    .CreateSessionFactory();

                this.sessionFactory2 = fluentConfiguration
                    .ForConnection("SqlConnection", new Mock<ISqlDialect>().Object, new Mock<IDbDriver>().Object)
                    .CreateSessionFactory();
            }
コード例 #4
0
            public void AnArgumentNullExceptionShouldBeThrown()
            {
                var fluentConfiguration = new FluentConfiguration(sessionFactoryCreated: null);

                var exception = Assert.Throws<ArgumentNullException>(
                    () => fluentConfiguration.ForConnection("SqlConnection", null, new Mock<IDbDriver>().Object));

                Assert.Equal(exception.ParamName, "sqlDialect");
            }
コード例 #5
0
            public void AMicroLiteConfigurationExceptionShouldBeThrown()
            {
                var fluentConfiguration = new FluentConfiguration(sessionFactoryCreated: null);

                var exception = Assert.Throws<ConfigurationException>(
                    () => fluentConfiguration.ForConnection("TestDB", new Mock<ISqlDialect>().Object, new Mock<IDbDriver>().Object));

                Assert.Equal(ExceptionMessages.FluentConfiguration_ConnectionNotFound.FormatWith("TestDB"), exception.Message);
            }
コード例 #6
0
            public void AnArgumentNullExceptionShouldBeThrown()
            {
                var fluentConfiguration = new FluentConfiguration(sessionFactoryCreated: null);

                var exception = Assert.Throws<ArgumentNullException>(
                    () => fluentConfiguration.ForConnection("SqlConnection", @"Data Source=.\;Initial Catalog=Northwind;", "System.Data.SqlClient", null, new Mock<IDbDriver>().Object));

                Assert.Equal(exception.ParamName, "sqlDialect");
            }