public void CreateFixtureNow() { SqlDbUnitTest dbUnit = new SqlDbUnitTest(connectionString); dbUnit.ReadXmlSchema(@"DBFixtures/JewelryItems.xsd"); DataSet ds = dbUnit.GetDataSetFromDb(); ds.WriteXml(@"DBFixtures/JewelryItemsAllCategories.xml"); }
public void GetMyTestDataXmlFile() { var connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["IntegrationTests.Properties.Settings.TDDWithMVCConnectionString"].ConnectionString; var mySqlDatabase = new SqlDbUnitTest(connectionString); mySqlDatabase.ReadXmlSchema(DatabaseXsd02); System.Data.DataSet ds = mySqlDatabase.GetDataSetFromDb(); ds.WriteXml(TestdataXml02); }
protected void ExportTestDataFromDatabase( string projectPath = null, string outputFolderName = null, string outputFilename = null, string connectionString = null, string xmlSchemaFilename = null, Type classUnderTest = null) { using (var context = new TContext()) { context.Provider = TestContextBase.DatabaseProvider.SqlClient; context.ConnectionString = connectionString ?? TestContextBase.DefaultConnectionString; context.ProjectPath = projectPath ?? TestContextBase.DefaultProjectPath; if (outputFolderName != null) { context.FolderName = outputFolderName; } if (classUnderTest != null) { context.ClassUnderTest = classUnderTest; } var database = new SqlDbUnitTest(context.ConnectionString); database.ReadXmlSchema( !string.IsNullOrEmpty(xmlSchemaFilename) ? xmlSchemaFilename : Path.Combine(@"..\..\Bases\Data", TestContextBase.DefaultXmlSchemaFilename)); var dataSet = database.GetDataSetFromDb(); var fileName = string.Format( @"..\..\{0}\Data\{1}", context.FolderName, outputFilename ?? string.Format( "{0}Tests_ExportedData.xml", context.ClassUnderTest.Name)); dataSet.WriteXml(fileName); } }