protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" }); schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true }, new[] { "dbo", "Users", "Name" }, new[] { "dbo", "Users", "Password" }, new[] { "dbo", "Users", "Age" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 }); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "Customer", "BASE TABLE" }, new[] { "dbo", "Orders", "BASE TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "Customer", "CustomerId" }, new[] { "dbo", "Orders", "OrderId" }, new[] { "dbo", "Orders", "CustomerId" }, new[] { "dbo", "Orders", "OrderDate" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Customer", "CustomerId", 0 }); schemaProvider.SetForeignKeys(new object[] { "FK_Orders_Customer", "dbo", "Orders", "CustomerId", "dbo", "Customer", "CustomerId", 0 }); }
static Database CreateDatabase(MockDatabase mockDatabase) { var mockSchemaProvider = new MockSchemaProvider(); mockSchemaProvider.SetTables(new[] { "foo", "Users", "BASE TABLE" }); mockSchemaProvider.SetColumns(new[] { "foo", "Users", "Id" }, new[] { "foo", "Users", "Name" }, new[] { "foo", "Users", "Password" }, new[] { "foo", "Users", "Age" }); mockSchemaProvider.SetPrimaryKeys(new object[] { "foo", "Users", "Id", 0 }); return new Database(new AdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider))); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "CUSTOMER", "BASE TABLE" }, new[] { "dbo", "ORDER", "BASE TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "CUSTOMER", "CUSTOMER_ID" }, new[] { "dbo", "ORDER", "ORDER_ID" }, new[] { "dbo", "ORDER", "CUSTOMER_ID" }, new[] { "dbo", "ORDER", "ORDER_DATE" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "CUSTOMER", "CUSTOMER_ID", 0 }); schemaProvider.SetForeignKeys(new object[] { "FK_ORDER_CUSTOMER", "dbo", "ORDER", "CUSTOMER_ID", "dbo", "CUSTOMER", "CUSTOMER_ID", 0 }); }
static Database CreateDatabase(MockDatabase mockDatabase) { var mockSchemaProvider = new MockSchemaProvider(); mockSchemaProvider.SetTables(new[] {"dbo", "Customer", "BASE TABLE"}, new[] {"dbo", "Orders", "BASE TABLE"}); mockSchemaProvider.SetColumns(new[] {"dbo", "Customer", "CustomerId"}, new[] { "dbo", "Orders", "OrderId" }, new[] { "dbo", "Orders", "CustomerId" }, new[] {"dbo", "Orders", "OrderDate"}); mockSchemaProvider.SetPrimaryKeys(new object[] {"dbo", "Customer", "CustomerId", 0}); mockSchemaProvider.SetForeignKeys(new object[] {"FK_Orders_Customer", "dbo", "Orders", "CustomerId", "dbo", "Customer", "CustomerId", 0}); return new Database(new AdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider))); }
Database CreateDatabaseWithShoutyNames(MockDatabase mockDatabase) { var mockSchemaProvider = new MockSchemaProvider(); mockSchemaProvider.SetTables(new[] { "dbo", "CUSTOMER", "BASE TABLE" }, new[] { "dbo", "ORDER", "BASE TABLE" }); mockSchemaProvider.SetColumns(new[] { "dbo", "CUSTOMER", "CUSTOMER_ID" }, new[] { "dbo", "ORDER", "ORDER_ID" }, new[] { "dbo", "ORDER", "CUSTOMER_ID" }, new[] { "dbo", "ORDER", "ORDER_DATE" }); mockSchemaProvider.SetPrimaryKeys(new object[] { "dbo", "CUSTOMER", "CUSTOMER_ID", 0 }); mockSchemaProvider.SetForeignKeys(new object[] { "FK_ORDER_CUSTOMER", "dbo", "ORDER", "CUSTOMER_ID", "dbo", "CUSTOMER", "CUSTOMER_ID", 0 }); return new Database(new AdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider))); }
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))); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] {"dbo", "Users", "BASE TABLE"}, new[] {"dbo", "UserBio", "BASE TABLE"}, new[] {"dbo", "Employee", "BASE TABLE"}); schemaProvider.SetColumns(new object[] {"dbo", "Users", "Id", true}, new[] {"dbo", "Users", "Name"}, new[] {"dbo", "Users", "Password"}, new[] {"dbo", "Users", "Age"}, new[] {"dbo", "UserBio", "UserId"}, new[] {"dbo", "UserBio", "Text"}, new[] {"dbo", "Employee", "Id"}, new[] {"dbo", "Employee", "Name"}, new[] {"dbo", "Employee", "ManagerId"}); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 }); schemaProvider.SetForeignKeys(new object[] { "FK_Users_UserBio", "dbo", "UserBio", "UserId", "dbo", "Users", "Id", 0 }); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { // ReSharper disable CoVariantArrayConversion schemaProvider.SetTables(new object[] { "dbo", "Users", "BASE TABLE" }, new object[] { "dbo", "UserHistory", "BASE TABLE"}, new object[] { "dbo", "AnnoyingMaster", "BASE TABLE"}, new[] { "dbo", "AnnoyingDetail", "BASE TABLE"}, new[] {"dbo", "USER_TABLE", "BASE TABLE"}); schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true }, new[] { "dbo", "Users", "Name" }, new[] { "dbo", "Users", "Password" }, new[] { "dbo", "Users", "Age" }, new[] { "dbo", "UserHistory", "Id" }, new[] { "dbo", "UserHistory", "UserId" }, new[] { "dbo", "UserHistory", "LastSeen" }, new[] { "dbo", "AnnoyingMaster", "Id1" }, new[] { "dbo", "AnnoyingMaster", "Id2" }, new[] { "dbo", "AnnoyingMaster", "Text" }, new[] { "dbo", "AnnoyingDetail", "Id" }, new[] { "dbo", "AnnoyingDetail", "MasterId1" }, new[] { "dbo", "AnnoyingDetail", "MasterId2" }, new[] { "dbo", "AnnoyingDetail", "Value" }, new object[] { "dbo", "USER_TABLE", "ID", true }, new[] { "dbo", "USER_TABLE", "NAME" }, new[] { "dbo", "USER_TABLE", "PASSWORD" }, new[] { "dbo", "USER_TABLE", "AGE" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 }, new object[] { "dbo", "UserHistory", "Id", 0 }, new object[] { "dbo", "AnnoyingMaster", "Id1", 0 }, new object[] { "dbo", "AnnoyingMaster", "Id2", 1 }, new object[] { "dbo", "AnnoyingDetail", "Id", 0 }, new object[] { "dbo", "USER_TABLE", "ID", 0 }); schemaProvider.SetForeignKeys( new object[] { "FK_UserHistory_User", "dbo", "UserHistory", "UserId", "dbo", "Users", "Id", 0 }, new object[] { "FK_AnnoyingDetail_AnnoyingMaster", "dbo", "AnnoyingDetail", "MasterId1", "dbo", "AnnoyingMaster", "Id1", 0 }, new object[] { "FK_AnnoyingDetail_AnnoyingMaster", "dbo", "AnnoyingDetail", "MasterId2", "dbo", "AnnoyingMaster", "Id2", 1 } ); // ReSharper restore CoVariantArrayConversion }