protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "Employee", "BASE TABLE" }, new[] { "dbo", "Department", "BASE TABLE" }, new[] { "dbo", "Activity", "BASE TABLE" }, new[] { "dbo", "Activity_Join", "BASE TABLE" }, new[] { "dbo", "Location", "BASE_TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "Employee", "Id" }, new[] { "dbo", "Employee", "Name" }, new[] { "dbo", "Employee", "ManagerId" }, new[] { "dbo", "Employee", "DepartmentId" }, new[] { "dbo", "Department", "Id" }, new[] { "dbo", "Department", "Name" }, new[] { "dbo", "Activity", "ID" }, new[] { "dbo", "Activity", "Description" }, new[] { "dbo", "Activity_Join", "ID_Activity" }, new[] { "dbo", "Activity_Join", "ID_Location" }, new[] { "dbo", "Location", "ID" }, new[] { "dbo", "Location", "Address" } ); schemaProvider.SetPrimaryKeys(new object[] {"dbo", "Employee", "Id", 0}, new object[] {"dbo", "Department", "Id", 0}); schemaProvider.SetForeignKeys( new object[] { "FK_Employee_Department", "dbo", "Employee", "DepartmentId", "dbo", "Department", "Id", 0 }, new object[] { "FK_Activity_Join_Activity", "dbo", "Activity_Join", "ID_Activity", "dbo", "Activity", "ID", 0 }, new object[] { "FK_Activity_Join_Location", "dbo", "Activity_Join", "ID_Location", "dbo", "Location", "ID", 0 } ); }
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) { // ReSharper disable CoVariantArrayConversion schemaProvider.SetTables(new[] { "dbo", "Employee", "BASE TABLE" }, new[] { "dbo", "Department", "BASE TABLE" }, new[] { "dbo", "Activity", "BASE TABLE" }, new[] { "dbo", "Customer", "BASE TABLE" }, new[] { "dbo", "Order", "BASE TABLE" }, new[] { "dbo", "Item", "BASE TABLE" }, new[] { "dbo", "Note", "BASE TABLE" }, new[] { "dbo", "Activity_Join", "BASE TABLE" }, new[] { "dbo", "Location", "BASE_TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "Employee", "Id" }, new[] { "dbo", "Employee", "Name" }, new[] { "dbo", "Employee", "ManagerId" }, new[] { "dbo", "Employee", "DepartmentId" }, new[] { "dbo", "Department", "Id" }, new[] { "dbo", "Department", "Name" }, new[] { "dbo", "Customer", "Id" }, new[] { "dbo", "Customer", "Name" }, new[] { "dbo", "Order", "Id" }, new[] { "dbo", "Order", "CustomerId" }, new[] { "dbo", "Order", "Description" }, new[] { "dbo", "Item", "Id" }, new[] { "dbo", "Item", "OrderId" }, new[] { "dbo", "Item", "Description" }, new[] { "dbo", "Note", "Id" }, new[] { "dbo", "Note", "CustomerId" }, new[] { "dbo", "Note", "Text" }, new[] { "dbo", "Activity", "ID" }, new[] { "dbo", "Activity", "Description" }, new[] { "dbo", "Activity_Join", "ID_Activity" }, new[] { "dbo", "Activity_Join", "ID_Location" }, new[] { "dbo", "Location", "ID" }, new[] { "dbo", "Location", "Address" } ); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Employee", "Id", 0 }, new object[] { "dbo", "Department", "Id", 0 }, new object[] { "dbo", "Customer", "Id", 0 }, new object[] { "dbo", "Order", "Id", 0 }, new object[] { "dbo", "Item", "Id", 0 }, new object[] { "dbo", "Note", "Id", 0 } ); schemaProvider.SetForeignKeys( new object[] { "FK_Employee_Department", "dbo", "Employee", "DepartmentId", "dbo", "Department", "Id", 0 }, new object[] { "FK_Activity_Join_Activity", "dbo", "Activity_Join", "ID_Activity", "dbo", "Activity", "ID", 0 }, new object[] { "FK_Activity_Join_Location", "dbo", "Activity_Join", "ID_Location", "dbo", "Location", "ID", 0 }, new object[] { "FK_Order_Customer", "dbo", "Order", "CustomerId", "dbo", "Customer", "Id", 0 }, new object[] { "FK_Item_Order", "dbo", "Item", "OrderId", "dbo", "Order", "Id", 0 }, new object[] { "FK_Note_Customer", "dbo", "Note", "CustomerId", "dbo", "Customer", "Id", 0 } ); // ReSharper restore CoVariantArrayConversion }
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 }); }
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[] { "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) { // ReSharper disable CoVariantArrayConversion schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" }, new[] { "dbo", "MyTable", "BASE TABLE" }); schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true }, new[] { "dbo", "Users", "Name" }, new[] { "dbo", "Users", "Password" }, new[] { "dbo", "Users", "Age" }, new[] { "dbo", "MyTable", "Column1"}); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 }); // ReSharper restore CoVariantArrayConversion }
protected override void SetSchema(MockSchemaProvider schemaProvider) { // ReSharper disable CoVariantArrayConversion schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" }, new[] { "dbo", "MyTable", "BASE TABLE" }); schemaProvider.SetColumns(new object[] { "dbo", "Users", "Id", true }, new[] { "dbo", "Users", "Name" }, new[] { "dbo", "Users", "Password" }, new[] { "dbo", "Users", "Age" }, new[] { "dbo", "MyTable", "Column1" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Users", "Id", 0 }); // ReSharper restore CoVariantArrayConversion }
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)))); }
Database CreateDatabaseWithPluralNames(MockDatabase mockDatabase) { var mockSchemaProvider = new MockSchemaProvider(); mockSchemaProvider.SetTables(new[] { "dbo", "Customers", "BASE TABLE" }, new[] { "dbo", "Orders", "BASE TABLE" }); mockSchemaProvider.SetColumns(new[] { "dbo", "Customers", "CustomerId" }, new[] { "dbo", "Orders", "OrderId" }, new[] { "dbo", "Orders", "CustomerId" }, new[] { "dbo", "Orders", "OrderDate" }); mockSchemaProvider.SetPrimaryKeys(new object[] { "dbo", "Customers", "CustomerId", 0 }); mockSchemaProvider.SetForeignKeys(new object[] { "FK_Orders_Customers", "dbo", "Orders", "CustomerId", "dbo", "Customers", "CustomerId", 0 }); return(new Database(new AdoAdapter(new MockConnectionProvider(new MockDbConnection(mockDatabase), mockSchemaProvider)))); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "Fixture", "BASE TABLE" }, new[] { "dbo", "Team", "BASE TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "Team", "Id" }, new[] { "dbo", "Fixture", "Id" }, new[] { "dbo", "Fixture", "HomeTeamId" }, new[] { "dbo", "Fixture", "AwayTeamId" }, new[] { "dbo", "Team", "Name" }); schemaProvider.SetPrimaryKeys(new object[] { "dbo", "Team", "Id", 0 }, new object[] { "dbo", "Team", "Id", 0 }); schemaProvider.SetForeignKeys(new object[] { "FK_Fixture_HomeTeam", "dbo", "Fixture", "HomeTeamId", "dbo", "Team", "Id", 0 }, new object[] { "FK_Fixture_AwayTeam", "dbo", "Fixture", "AwayTeamId", "dbo", "Team", "Id", 0 }); }
protected override void SetSchema(MockSchemaProvider schemaProvider) { // ReSharper disable CoVariantArrayConversion schemaProvider.SetTables(new[] { "dbo", "Employee", "BASE TABLE" }, new[] { "dbo", "Department", "BASE TABLE" }, new[] { "dbo", "Activity", "BASE TABLE" }, new[] { "dbo", "Customer", "BASE TABLE" }, new[] { "dbo", "Order", "BASE TABLE" }, new[] { "dbo", "Note", "BASE TABLE" }, new[] { "dbo", "Activity_Join", "BASE TABLE" }, new[] { "dbo", "Location", "BASE_TABLE" }); schemaProvider.SetColumns(new[] { "dbo", "Employee", "Id" }, new[] { "dbo", "Employee", "Name" }, new[] { "dbo", "Employee", "ManagerId" }, new[] { "dbo", "Employee", "DepartmentId" }, new[] { "dbo", "Department", "Id" }, new[] { "dbo", "Department", "Name" }, new[] { "dbo", "Customer", "Id" }, new[] { "dbo", "Customer", "Name" }, new[] { "dbo", "Order", "Id" }, new[] { "dbo", "Order", "CustomerId" }, new[] { "dbo", "Order", "Description" }, new[] { "dbo", "Note", "Id" }, new[] { "dbo", "Note", "CustomerId" }, new[] { "dbo", "Note", "Text" }, new[] { "dbo", "Activity", "ID" }, new[] { "dbo", "Activity", "Description" }, new[] { "dbo", "Activity_Join", "ID_Activity" }, new[] { "dbo", "Activity_Join", "ID_Location" }, new[] { "dbo", "Location", "ID" }, new[] { "dbo", "Location", "Address" } ); schemaProvider.SetPrimaryKeys(new object[] {"dbo", "Employee", "Id", 0}, new object[] {"dbo", "Department", "Id", 0}, new object[] {"dbo", "Customer", "Id", 0}, new object[] {"dbo", "Order", "Id", 0}, new object[] {"dbo", "Note", "Id", 0} ); schemaProvider.SetForeignKeys( new object[] { "FK_Employee_Department", "dbo", "Employee", "DepartmentId", "dbo", "Department", "Id", 0 }, new object[] { "FK_Activity_Join_Activity", "dbo", "Activity_Join", "ID_Activity", "dbo", "Activity", "ID", 0 }, new object[] { "FK_Activity_Join_Location", "dbo", "Activity_Join", "ID_Location", "dbo", "Location", "ID", 0 }, new object[] { "FK_Order_Customer", "dbo", "Order", "CustomerId", "dbo", "Customer", "Id", 0 }, new object[] { "FK_Note_Customer", "dbo", "Note", "CustomerId", "dbo", "Customer", "Id", 0 } ); // ReSharper restore CoVariantArrayConversion }
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) { // 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 }
protected override void SetSchema(MockSchemaProvider schemaProvider) { schemaProvider.SetTables(new[] { "dbo", "Users", "BASE TABLE" }, new[] { "dbo", "UserBio", "BASE TABLE" }, new[] { "dbo", "UserPayment", "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", "UserPayment", "UserId" }, new[] { "dbo", "UserPayment", "Amount" }, 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 }, new object[] { "FK_Users_UserPayment", "dbo", "UserPayment", "UserId", "dbo", "Users", "Id", 0 }); }