コード例 #1
0
        public static Mock <MoqDataReader> CreateDbDataReader(TestDataContainer dataContainer)
        {
            var dataReader = new Mock <MoqDataReader>(dataContainer.dataRow);

            dataReader.CallBase = true;
            dataReader.Setup(dr => dr.Close());
            MockDatabaseFactory.DbCommand = MockDatabaseFactory.CreateDbCommand(dataReader.Object);
            return(dataReader);
        }
コード例 #2
0
        public void Setup()
        {
            MockDatabaseFactory.DbParameter   = MockDatabaseFactory.CreateDbParameter();
            MockDatabaseFactory.Parameters    = MockDatabaseFactory.CreateParameterCollection();
            MockDatabaseFactory.DbConnection  = MockDatabaseFactory.CreateDbConnection();
            MockDatabaseFactory.DbCommand     = MockDatabaseFactory.CreateDbCommand();
            MockDatabaseFactory.DbTransaction = MockDatabaseFactory.CreateDbTransaction();
            MockDatabaseFactory.SetScalerReturnValue(scalerStringValue);

            queryRunner            = new QueryRunner(connectionString, provider, new MockDatabaseFactory());
            queryRunner.LogMessage = new Action <string, System.Diagnostics.TraceEventType>((message, level) =>
            {
                logMessage = message;
                logLevel   = level;
            });
            queryRunner.DebugLoggingEnabled = true;
            logMessage = string.Empty;
            logLevel   = System.Diagnostics.TraceEventType.Start;
        }