public void Initialize() { XmlConfigurator.Configure(); this.dbProviderFactoryMock = new Mock<DbProviderFactory>(); this.formatterMock = new Mock<IValueFormatter>(); this.primitives = new WritePrimitives(DbProviderWritePrimitivesTests.ConnectionString, this.dbProviderFactoryMock.Object, this.formatterMock.Object, mustBeInATransaction: false, configuration: new NameValueCollection {{"TestDataFramework_DumpSqlInput", "true"}}); this.connectionMock = new Mock<DbConnection>(); this.insertCommandMock = new Mock<DbCommand>(); this.readerMock = new Mock<DbDataReader>(); var mockInsertCommand = new MockDbCommand(this.insertCommandMock.Object, this.readerMock.Object); this.dbProviderFactoryMock.Setup(m => m.CreateCommand()).Returns(mockInsertCommand); this.dbProviderFactoryMock.Setup(m => m.CreateConnection()).Returns(this.connectionMock.Object); }
public void Initialize() { XmlConfigurator.Configure(); this.dbProviderFactoryMock = new Mock<DbProviderFactory>(); this.formatterMock = new Mock<IValueFormatter>(); this.symbolGeneratorMock = new Mock<IRandomSymbolStringGenerator>(); this.primitives = new SqlClientWritePrimitives(SqlClientWritePrimitivesTests.ConnectionString, this.dbProviderFactoryMock.Object, this.formatterMock.Object, this.symbolGeneratorMock.Object, mustBeInATransaction: false, configuration: new NameValueCollection {{"TestDataFramework_DumpSqlInput", "true"}}); var connectionMock = new Mock<DbConnection>(); var readerMock = new Mock<DbDataReader>(); this.insertCommandMock = new Mock<DbCommand>(); var mockInsertCommand = new MockDbCommand(this.insertCommandMock.Object, readerMock.Object); this.dbProviderFactoryMock.Setup(m => m.CreateCommand()).Returns(mockInsertCommand); this.dbProviderFactoryMock.Setup(m => m.CreateConnection()).Returns(connectionMock.Object); this.symbolGeneratorMock.Setup(m => m.GetRandomString(It.IsAny<int?>())).Returns(SqlClientWritePrimitivesTests.VariableSymbol); }