Пример #1
0
        Database CreateDatabase(MockDatabase mockDatabase)
        {
            var mockSchemaProvider = new MockSchemaProvider();

            SetSchema(mockSchemaProvider);

            _MockConnectionProvider = new Mocking.Ado.MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider);
            var adapter = MockHelper.CreateMockAdoAdapter(_MockConnectionProvider);

            MockHelper.UseMockAdapter(adapter);
            return(Database.Open());
        }
Пример #2
0
        static Database CreateDatabase(MockDatabase mockDatabase)
        {
            var mockSchemaProvider = new MockSchemaProvider();

            mockSchemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" });
            mockSchemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true },
                                          new[] { "dbo", "Users", "Name" },
                                          new[] { "dbo", "Users", "Password" },
                                          new[] { "dbo", "Users", "Age" });
            mockSchemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 });
            var adapter =
                MockHelper.CreateMockAdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase),
                                                                           mockSchemaProvider));

            MockHelper.UseMockAdapter(adapter);
            return(Database.Open());
            //            return new Database(new AdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider)));
        }