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(); }
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(); }
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(); }
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"); }
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); }
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"); }