TestFu Static helper class for creating data binders Summary description for DataGeneratorCollection. A collection of . Adds a to the collection. to add to the collection. is a null reference (Nothing in Visual Basic) Removes a from the collection. to remove from the collection. is a null reference (Nothing in Visual Basic) Removes a associated to from the collection. whose generator is to be removed from the collection. is a null reference (Nothing in Visual Basic) Removes a associated to from the collection. Column named whose generator is to be removed from the collection. is a null reference (Nothing in Visual Basic) Gets the associated to the . is a null reference (Nothing in Visual Basic) Gets the associated to the column named . is a null reference (Nothing in Visual Basic) A collection of . Summary description for TablePopulatorCollection. A collection of . A collection of . Abstract class to perform administrative tasks on a database Initializes an instance of with the connection string. Connection string to the SQL server without initial catalog Catalog name is a null reference (Nothing in Visual Basic) Creates a backup of the specified database using the specified and . A defining the type of output device. Device path. is a null reference (Nothing in Visual Basic) Restores a backup of the specified database using the specified and . A defining the type of output device. Device path. is a null reference (Nothing in Visual Basic) If you plan to override an existing database, you must first drop this database. This method takes a conservative behavior and will not override an existing database. Creates a new database on the server Drops an existing new database on the server is a null reference (Nothing in Visual Basic) Gets a value indicating if the current database exists. true if it exists; otherwise, false. Drops the table. Name of the table to drop This method takes care of removing the constraints associated to the table before removing the table. Gets a value indicating if the database contains the table. Name of the table to search true if a table named is contained in the databse;oterwise false. Executes a non-query in a safe, transactional environement. Query to execute. Gets or sets the connection string with Initial Catalog information Connection string. Gets or sets the database name The database name. Gets or sets the database owner. Database owner name. Gets the connection string with Initial Catalog information. Connection string with Initial catalog information. Enumeration of available SQL backup devices DISK device TAPE device Output to named dump A factory for and instances. Creates a instance. Connection string to server A instance. An abstract base class for test fixtures involving database testing. The DbFixture (SqlFixture for MsSQL server) can be used as a base class for the fixtures involving database testing. [TestFixture] public class DatabaseTest : SqlFixture { public DatabaseTest() :base("Data Source=testserver;...","MyTestDatabase") {} [SetUp] public void SetUp() { this.Open(); this.BeginTransaction(); } [Test] public void Selec() { IDbCollection cmd = this.Connection.CreateCommand("select * from anytable",this.Transaction); ... } [TearDown] public void TearDown() { this.Close(); } } Initializes a with a connection string. Connection string for accessing the test database. is a null reference (Nothing in Visual Basic) Opens a instance with the . This method must be implemented in inherited classes for different factorys. Executes a non-query command with the given parameters Query format string Query arguments for the format string Number of affected rows The connection is automatically opened if necessary. Executes a scalar query with the given parameters Query format string Query arguments for the format string Query result The connection is automatically opened if necessary. Executes query and returns the instance Query format string Query arguments for the format string A resulting from the query. The connection is automatically opened if necessary and the reader is created with option. Begins a new transaction. If a previous transaction was opened, by default, it is rolled back. The current connection is not created or not opened. Commits the current transaction if any. Rollsback the current transaction if any. Closes the current connection. If a transaction was opened, it is first rolled back. Gets the database instance A instance. Gets the current connection instance. instance. Gets the current transaction. A instance if was called and the connection not closed; otherwise, a null reference (Nothing in Visual Basic) Gets the connection string to access the db server (without database information. Gets the test database name. Gets the connection string to connecto the test database. A random data generator for values. This method generates Byte arrays with length in the range [, ]. Abstract base class from instance. An random data generator. Resets the generator Generates a new value and fills it in the corresponding . It is the user job to ensure that the instance provided is compatible with the generator definition and more specifically the it is associated with. Gets the generated type Generated . Gets or sets the probability to produce a NULL This value determines the probability to produce a null value. The probability ranges from 0 - never, to 1 - always. The probability to produce a null object. Gets the target column Target instance. Resets the generator Generates a new value New random data. Updates the internal data and verifies column information. Gets the generated type Generated type. Gets the target column Target instance. Gets or sets the probability to produce a NULL This value determines the probability to produce a null value. The probability ranges from 0, never to 1 always. The probability to produce a null object. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum length of the generated value Minimum generated length. Default is 16. Gets or sets the maximum generated value Maximum generated length. Default is 16. A random generator of values. Creates an instance with equal to 0.5. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the probability to return true. Probability to return true. is not in [0,1]. A random data generator for values. This method generates byte values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random data generator for values. This method generates DateTime values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random data generator for values. This method generates decimal values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random data generator for values. This method generates double values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random generator of values. Generates a new value New random data. Gets the generated type Generated type. A random data generator for binary values. This method generates a bitmap of size [ by ]. Gets the generated type Generated type. Gets or sets the pixel format A random data generator for values. This method generates int values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random data generator for values. This method generates int values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random data generator for values. This method generates int values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is A random generator of instances. Initializes a new instance of . Gets the generated type Generated type. Gets or sets the minimum length of the string Minimum length of the string. set proprety, the value is negative. Gets or sets the maximum length of the string Maximum length of the string. set proprety, the value is less than 1. A random data generator for values. This method generates float values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is Gets or sets the maximum generated value Maximum generated value. Default is Generates a new value New random data. Generates a new value New random data. This method generates float values in a range [, ]. Generates a new value New random data. Gets the generated type Generated type. Gets or sets the minimum generated value Minimum generated value. Default is 0 Gets or sets the maximum generated value Maximum generated value. Default is 0 A random generator of instances. Initializes a new instance of . Generates a new value New random data. Gets or sets the string containing the generated characters A graph of (vertices) and (edges). Builds a new empty directed graph with default vertex and edge provider. Remove all of the edges and vertices from the graph. Add a new DataTableVertex to the graph and returns it. Created vertex Removes the vertex from the graph. vertex to remove v is null Add a new vertex from source to target Complexity: 2 search + 1 insertion Source vertex Target vertex Created Edge source or target is a null reference source or target are not part of the graph Remove all edges to and from vertex u from the graph. Removes an edge from the graph. Complexity: 2 edges removed from the vertex edge list + 1 edge removed from the edge list. edge to remove e is a null reference (Nothing in Visual Basic) is not part of the graph Remove the edge (u,v) from the graph. If the graph allows parallel edges this remove all occurrences of (u,v). source vertex target vertex Add a new vertex to the graph and returns it. Create vertex Used for serialization. Not for private use. edge to add. Gets a value indicating if the set of out-edges is empty Usually faster that calling . true if the out-edge set is empty, false otherwise. v is a null reference (Nothing in Visual Basic) v is not part of the graph. Returns the number of out-degree edges of v vertex number of out-edges of the v v is a null reference (Nothing in Visual Basic) v is not part of the graph. Returns an iterable collection over the edge connected to v out-edges of v v is a null reference. v is not part of the graph. Test is an edge (u,v) is part of the graph source vertex target vertex true if part of the graph Returns the first out-edge that matches the predicate Edge predicate null if not found, otherwize the first Edge that matches the predicate. v or ep is null Returns the collection of out-edges that matches the predicate Edge predicate enumerable colleciton of vertices that matches the criteron v or ep is null Remove all the edges from graph g for which the predicate pred returns true. edge predicate Remove all the out-edges of vertex u for which the predicate pred returns true. vertex edge predicate Tests if a is part of the graph Vertex to test true if is part of the graph, false otherwize Returns the first that matches the predicate vertex predicate null if not found, otherwize the first vertex that matches the predicate. vp is null Returns the collection of vertices that matches the predicate vertex predicate enumerable colleciton of vertices that matches the criteron vp is null Tests if a () is part of the graph Edge to test true if is part of the graph, false otherwize Returns the first Edge that matches the predicate Edge predicate null if not found, otherwize the first Edge that matches the predicate. ep is null Returns the collection of edges that matches the predicate Edge predicate enumerable colleciton of vertices that matches the criteron ep is null Gets an enumerable collection of adjacent vertices Enumerable collection of adjacent vertices Gets a value indicating if the set of in-edges is empty Usually faster that calling . true if the in-edge set is empty, false otherwise. v is a null reference (Nothing in Visual Basic) is not part of the graph. Returns the number of in-degree edges of v number of in-edges of the vertex v v is a null reference (Nothing in Visual Basic) is not part of the graph. Returns an iterable collection over the in-edge connected to v in-edges of v v is a null reference (Nothing in Visual Basic) is not part of the graph. Incidence graph implementation Gets a value indicating if the set of edges connected to v is empty Usually faster that calling . true if the adjacent edge set is empty, false otherwise. v is a null reference Returns the number of in-edges plus out-edges. Returns the first in-edge that matches the predicate Edge predicate null if not found, otherwize the first Edge that matches the predicate. v or ep is null Returns the collection of in-edges that matches the predicate Edge predicate enumerable colleciton of vertices that matches the criteron v or ep is null Remove all the out-edges of vertex u for which the predicate pred returns true. vertex edge predicate Gets a value indicating if the is directed. true if the graph is directed, false if undirected. Gets a value indicating if the allows parallel edges. true if the is a multi-graph, false otherwise Gets the provider provider Gets the provider provider Gets a value indicating if the vertex set is empty Usually faster (O(1)) that calling VertexCount. true if the vertex set is empty, false otherwise. Gets the number of vertices Number of vertices in the graph Enumerable collection of vertices. Gets a value indicating if the vertex set is empty Usually faster that calling . true if the vertex set is empty, false otherwise. Gets the edge count Edges count Enumerable collection of edges. Initializes a new empty instance of the class. Adds an instance of type to the end of this . The Edge to be added to the end of this EdgeCollection. Removes the first occurrence of a specific Edge from this EdgeCollection. The Edge value to remove from this EdgeCollection. Determines whether a specfic value is in this EdgeCollection. edge value to locate in this . true if value is found in this collection; false otherwise. Returns an enumerator that can iterate through the elements of this EdgeCollection. An object that implements System.Collections.IEnumerator. Gets or sets the Edge at the given index in this EdgeCollection. Create a new enumerator on the collection collection to enumerate Moves cursor to next element. true if current is valid, false otherwize Resets the cursor to the position before the first element. The current element. A populator of instance. A with a instance. A validator check checks constraints Preprocesses the row modifies it to fullfill the constraint A database populator instance. Sets up the generators for the given instance. A representing the structure of the database to populate. is a null reference (Nothing in Visual Basic) Gets the instance associated to this populator. A schema used to set-up the generators. Gets a collection associated to each table. A containing populator associated to each . Gets the associated to the database. An instance that can fill a with data that are compatible with a given . Fill the row with data that is compatible with the foreign key. instance to fill. is a null reference (Nothing in Visual Basic). Gets the table populator associated to the foreign table. The instance associated to the foreign table. Gets the foreign constraint that needs to be satisfied. The associated to this provider. Gets a value indicating that the foreign table is empty and cannot provide keys. true if the foreign table is empty; otherwise false. An random generator compatible with the schema of a given . This example shows how the data generator can be used to create unit tests on database. In this example, we setup the dummy UserOrderProductDatabase and the populator in the SetUp method. using System; using System.Data; using MbUnit.Core.Framework; using MbUnit.Framework; using TestFu.Data; using TestFu.Data.Populators; namespace TestFu.Tests.Data { [TestFixture] public class DatabasePopulatorTest { private UserOrderProductDatabase db; private DatabasePopulator pop; private ITablePopulator users; private ITablePopulator orders; private ITablePopulator products; private ITablePopulator orderProducts; [SetUp] public void SetUp() { this.db=new UserOrderProductDatabase(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db.DataSet); this.users=this.pop.Tables[this.db.Users]; this.orders=this.pop.Tables[this.db.Orders]; this.products=this.pop.Tables[this.db.Products]; this.orderProducts=this.pop.Tables[this.db.OrderProducts]; } [Test] public void AddOneUser() { DataRow row = users.Generate(); this.db.Users.Rows.Add(row); } [Test] public void AddOneUserOneOrder() { this.AddOneUser(); DataRow row = orders.Generate(); this.db.Orders.Rows.Add(row); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrder() { DataRow row = orders.Generate(); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrderProduct() { DataRow row = orderProducts.Generate(); } [Test] public void AddOneUserOneOrderOneProduct() { this.AddOneUserOneOrder(); DataRow row = products.Generate(); this.db.Products.Rows.Add(row); } [Test] public void AddOneUserOneOrderOneProductOneProductOrder() { this.AddOneUserOneOrderOneProduct(); DataRow row=orderProducts.Generate(); this.db.OrderProducts.Rows.Add(row); } [Test] public void AddTwoUsers() { AddOneUser(); AddOneUser(); } [TearDown] public void Check() { this.db.AcceptChanges(); Console.WriteLine(db.ToString()); } } } Generates a new . Generated instance. Updates randomly a number of rows Updates randomly a number of rows Gets an instance of the $ that contains this populator. Parent instance. Gets the instance that is the model to be populated. A instance whos schema is used to create new . Gets a collection of associated to each . A instance containing the validators associated to each unique constraint. Gets a collection of associated to each . A instance containing the providers associated to each foreign key. Gets a collection of associated to each column of the table. A instance containing the generators associated to each column. Gets the that ensures CHECK constraints. A instance if any check constraint to verify; otherwize a null reference. Gets the latest generated . Latest generated . A validator for constraints. The TestFu.Data namespace contains a Random generator to help developer test databases, data layers, business layers, etc... This example shows some usage of the class. This class can be used to easily backup, restore, create or drop databases on a server. is the implementation for the MSSQL server: [C#] using System; using TestFu.Data; public class Demo { public static void Main(string[] args) { DbAdministrator admin = new SqlAdministrator("..."); // backup Northwind admin.Backup("Northwind",SqlBackupDevice.Disk,@"c:\Backups\Northwind.bkp"); // drop Northwind admin.Drop("Northwind"); // restore Northwind admin.Restore("Northwind",SqlBackupDevice.Disk,@"c:\Backups\Northwind.bkp"); } } The DbFixture (SqlFixture for MsSQL server) can be used as a base class for the fixtures involving database testing. [TestFixture] public class DatabaseTest : SqlFixture { public DatabaseTest() :base("Data Source=testserver;...","MyTestDatabase") {} [SetUp] public void SetUp() { this.Open(); this.BeginTransaction(); } [Test] public void Selec() { IDbCollection cmd = this.Connection.CreateCommand("select * from anytable",this.Transaction); ... } [TearDown] public void TearDown() { this.Close(); } } This example shows how the data generator can be used to create unit tests on database. In this example, we setup the dummy UserOrderProductDatabase and the populator in the SetUp method. using System; using System.Data; using MbUnit.Core.Framework; using MbUnit.Framework; using TestFu.Data; using TestFu.Data.Populators; namespace TestFu.Tests.Data { [TestFixture] public class DatabasePopulatorTest { private UserOrderProductDatabase db; private DatabasePopulator pop; private ITablePopulator users; private ITablePopulator orders; private ITablePopulator products; private ITablePopulator orderProducts; [SetUp] public void SetUp() { this.db=new UserOrderProductDatabase(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db.DataSet); this.users=this.pop.Tables[this.db.Users]; this.orders=this.pop.Tables[this.db.Orders]; this.products=this.pop.Tables[this.db.Products]; this.orderProducts=this.pop.Tables[this.db.OrderProducts]; } [Test] public void AddOneUser() { DataRow row = users.Generate(); this.db.Users.Rows.Add(row); } [Test] public void AddOneUserOneOrder() { this.AddOneUser(); DataRow row = orders.Generate(); this.db.Orders.Rows.Add(row); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrder() { DataRow row = orders.Generate(); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrderProduct() { DataRow row = orderProducts.Generate(); } [Test] public void AddOneUserOneOrderOneProduct() { this.AddOneUserOneOrder(); DataRow row = products.Generate(); this.db.Products.Rows.Add(row); } [Test] public void AddOneUserOneOrderOneProductOneProductOrder() { this.AddOneUserOneOrderOneProduct(); DataRow row=orderProducts.Generate(); this.db.OrderProducts.Rows.Add(row); } [Test] public void AddTwoUsers() { AddOneUser(); AddOneUser(); } [TearDown] public void Check() { this.db.AcceptChanges(); Console.WriteLine(db.ToString()); } } } The following codes decribes a simple User - Order - Product database contains 4 tables: Users, Orders, Products and OrderProducts. using System; using System.Data; using System.IO; using System.Xml; namespace TestFu.Tests.Data { public class UserOrderProductDatabase { private DataSet dataSet; private DataTable users; private DataColumn userID; private DataColumn userName; private DataTable orders; private DataColumn orderID; private DataColumn orderDate; private DataColumn oUserID; private DataTable products; private DataColumn productID; private DataColumn productName; private DataColumn productPrice; private DataTable orderProducts; private DataColumn opOrderID; private DataColumn opProductID; private DataColumn quantity; public UserOrderProductDatabase() { this.dataSet=new DataSet(); this.users=this.dataSet.Tables.Add("Users"); this.userID = this.users.Columns.Add("UserID",typeof(int)); this.userName=this.Users.Columns.Add("UserName",typeof(string)); this.userName.AllowDBNull=false; this.orders=this.dataSet.Tables.Add("Orders"); this.orderID=this.orders.Columns.Add("OrderID",typeof(int)); this.orderDate = this.orders.Columns.Add("OrderDate",typeof(DateTime)); this.oUserID = this.orders.Columns.Add("UserID",typeof(int)); this.products=this.dataSet.Tables.Add("Products"); this.productID=this.products.Columns.Add("ProductID",typeof(int)); this.productName = this.products.Columns.Add("ProductName",typeof(string)); this.productPrice = this.products.Columns.Add("ProductPrice",typeof(decimal)); this.orderProducts=this.dataSet.Tables.Add("OrderProducts"); this.opOrderID=this.orderProducts.Columns.Add("OrderID",typeof(int)); this.opProductID=this.orderProducts.Columns.Add("ProductID",typeof(int)); this.quantity=this.orderProducts.Columns.Add("Quantity",typeof(int)); // pks users.Constraints.Add("PK_Users",userID,true); orders.Constraints.Add("PK_Orders",orderID,true); products.Constraints.Add("PK_Products",productID,true); orderProducts.Constraints.Add("PK_OrderProducts", new DataColumn[]{ opOrderID, opProductID} ,true); // fks orders.Constraints.Add("FK_Orders_Users",userID,oUserID); orderProducts.Constraints.Add("FK_OrderProducts_Orders",orderID,opOrderID); orderProducts.Constraints.Add("FK_OrderProducts_Products",productID,opProductID); } } } Default implementation. This example shows how the data generator can be used to create unit tests on database. In this example, we setup the dummy UserOrderProductDatabase and the populator in the SetUp method. using System; using System.Data; using MbUnit.Core.Framework; using MbUnit.Framework; using TestFu.Data; using TestFu.Data.Populators; namespace TestFu.Tests.Data { [TestFixture] public class DatabasePopulatorTest { private UserOrderProductDatabase db; private DatabasePopulator pop; private ITablePopulator users; private ITablePopulator orders; private ITablePopulator products; private ITablePopulator orderProducts; [SetUp] public void SetUp() { this.db=new UserOrderProductDatabase(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db.DataSet); this.users=this.pop.Tables[this.db.Users]; this.orders=this.pop.Tables[this.db.Orders]; this.products=this.pop.Tables[this.db.Products]; this.orderProducts=this.pop.Tables[this.db.OrderProducts]; } [Test] public void AddOneUser() { DataRow row = users.Generate(); this.db.Users.Rows.Add(row); } [Test] public void AddOneUserOneOrder() { this.AddOneUser(); DataRow row = orders.Generate(); this.db.Orders.Rows.Add(row); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrder() { DataRow row = orders.Generate(); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrderProduct() { DataRow row = orderProducts.Generate(); } [Test] public void AddOneUserOneOrderOneProduct() { this.AddOneUserOneOrder(); DataRow row = products.Generate(); this.db.Products.Rows.Add(row); } [Test] public void AddOneUserOneOrderOneProductOneProductOrder() { this.AddOneUserOneOrderOneProduct(); DataRow row=orderProducts.Generate(); this.db.OrderProducts.Rows.Add(row); } [Test] public void AddTwoUsers() { AddOneUser(); AddOneUser(); } [TearDown] public void Check() { this.db.AcceptChanges(); Console.WriteLine(db.ToString()); } } } Initiliazes a instance. A querying the databse. Base class for implementation. A based on a . Default implementation of Default implementation of An smart random generator. This example shows how the data generator can be used to create unit tests on database. In this example, we setup the dummy UserOrderProductDatabase and the populator in the SetUp method. using System; using System.Data; using MbUnit.Core.Framework; using MbUnit.Framework; using TestFu.Data; using TestFu.Data.Populators; namespace TestFu.Tests.Data { [TestFixture] public class DatabasePopulatorTest { private UserOrderProductDatabase db; private DatabasePopulator pop; private ITablePopulator users; private ITablePopulator orders; private ITablePopulator products; private ITablePopulator orderProducts; [SetUp] public void SetUp() { this.db=new UserOrderProductDatabase(); this.pop = new DatabasePopulator(); this.pop.Populate(this.db.DataSet); this.users=this.pop.Tables[this.db.Users]; this.orders=this.pop.Tables[this.db.Orders]; this.products=this.pop.Tables[this.db.Products]; this.orderProducts=this.pop.Tables[this.db.OrderProducts]; } [Test] public void AddOneUser() { DataRow row = users.Generate(); this.db.Users.Rows.Add(row); } [Test] public void AddOneUserOneOrder() { this.AddOneUser(); DataRow row = orders.Generate(); this.db.Orders.Rows.Add(row); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrder() { DataRow row = orders.Generate(); } [Test] [ExpectedException(typeof(InvalidOperationException))] public void AddOneOrderProduct() { DataRow row = orderProducts.Generate(); } [Test] public void AddOneUserOneOrderOneProduct() { this.AddOneUserOneOrder(); DataRow row = products.Generate(); this.db.Products.Rows.Add(row); } [Test] public void AddOneUserOneOrderOneProductOneProductOrder() { this.AddOneUserOneOrderOneProduct(); DataRow row=orderProducts.Generate(); this.db.OrderProducts.Rows.Add(row); } [Test] public void AddTwoUsers() { AddOneUser(); AddOneUser(); } [TearDown] public void Check() { this.db.AcceptChanges(); Console.WriteLine(db.ToString()); } } } Helper class to performe task on a SQL server. This example shows some usage of the class. This class can be used to easily backup, restore, create or drop databases on a server. is the implementation for the MSSQL server: [C#] using System; using TestFu.Data; public class Demo { public static void Main(string[] args) { DbAdministrator admin = new SqlAdministrator("..."); // backup Northwind admin.Backup("Northwind",SqlBackupDevice.Disk,@"c:\Backups\Northwind.bkp"); // drop Northwind admin.Drop("Northwind"); // restore Northwind admin.Restore("Northwind",SqlBackupDevice.Disk,@"c:\Backups\Northwind.bkp"); } } Initializes an instance of with the connection string. Connection string to the SQL server without initial catalog Catalog name is a null reference (Nothing in Visual Basic) Creates a backup of the specified database using the specified and . A defining the type of output device. Device path. is a null reference (Nothing in Visual Basic) Restores a backup of the specified database using the specified and . A defining the type of output device. Device path. is a null reference (Nothing in Visual Basic) If you plan to override an existing database, you must first drop this database. This method takes a conservative behavior and will not override an existing database. Priorly to restore the database, the method kills all the processes associeted to the database. Creates a new database on the server Drops an existing new database on the server is a null reference (Nothing in Visual Basic) Gets the connection string with Initial Catalog information. Connection string with Initial catalog information. A implementation for MSSQL server. Creates a instance. Creates a instance. Connection string to server A instance. Abstract base class for MSSQL server database testing. The DbFixture (SqlFixture for MsSQL server) can be used as a base class for the fixtures involving database testing. [TestFixture] public class DatabaseTest : SqlFixture { public DatabaseTest() :base("Data Source=testserver;...","MyTestDatabase") {} [SetUp] public void SetUp() { this.Open(); this.BeginTransaction(); } [Test] public void Selec() { IDbCollection cmd = this.Connection.CreateCommand("select * from anytable",this.Transaction); ... } [TearDown] public void TearDown() { this.Close(); } } Initializes a with a connection string. Connection string for accessing the test database. database name is a null reference (Nothing in Visual Basic) Gets the current connection instance. instance. Gets the current transaction. A instance if was called and the connection not closed; otherwise, a null reference (Nothing in Visual Basic) Provides functions to capture the entire screen, or a particular window, and save it to a file. Source code takened from http://www.developerfusion.com/show/4630/ Creates an Image object containing a screen shot of the entire desktop Creates an Image object containing a screen shot of the entire desktop Creates an Image object containing a screen shot of the Creates an Image object containing a screen shot of a specific window The handle to the window. (In windows forms, this is obtained by the Handle property) Helper class containing Gdi32 API functions Helper class containing User32 API functions A that simulates a MouseDown event. Abstract base class for instance. Abstract base class for implementation. A user gesture. User gesture can be a combination of keyboard or mouse interactions. Executes the gesture This method should be executed on separate thread from the main thread, otherwize event will not be fired correctly. Gets the CodeDom statement creating this gesture Gets the that is targeted by the gesture Initializes an empty . Initializes a new instance with a form Raises the event. Converts the target from client to screen coordinates Position in client coordinates Position converted into screen coordinates This method makes a thread safe invokation of the Form.PointToScreen method. Converts the target from screen to client coordinates Position in screen coordinates Position converted into client coordinates This method makes a thread safe invokation of the Form.PointToClient method. Executes the gesture. Gets or sets the instance targeted by the A instance Raised when the target is changed A mouse gesture. Gets or sets a value indicating the involved in the gesture. A combined value of flags. Initializes an new . Initializes a new with a instance and the buttons involved in the gesture. Target instance value representing the involved in the gesture Gets or sets a value indicating the involved in the gesture. A combined value of flags. Initializes a new Initializes a new with a target instance and the left button Target form Initializes a new with a target instance and the buttons Target form value representing the involved in the gesture Executes the mouse down event A that simulates a MouseUp event Initialiazes a new . Initialiazes a new with a target . Target form Initialiazes a new with a target . Target form value representing the involved in the gesture Executes the mouse up event A that simulates a button click Initializes a new Initializes a new with a instance and the left button Target instance Initializes a new with a instance Target instance value representing the involved in the gesture Executes the mouse click A that moves the cursor to the center of a . An abstract base class for implementations that simulates a mouse movement Initializes a new Initialiazes a new with a target form and no buttons Target Initialiazes a new with a target form and the buttons Target value representing the involved in the gesture Steers the mouse towards the target Gets the target of the movement, in client coordinates A in client coordinates Gets or sets a value indicating the maximum velocity of the cursor A representing the maximum velocity of the cursor Initializes a new Initializes a new with a target and a target Target form Target control Initializes a new with a target , a target and the buttons pushed during the move Target form Target control value representing the involved in the gesture Gets or sets the target A instance where the cursor has to move Gets the center of the target . A representing the center of the target control in client coordiantes Offset of the target on the A that steers the cursor to a target Initializes a new Initializes a new with a target and a target Target form Target in client coordinates Initializes a new with a target and a target Target form Target in client coordinates value representing the involved in the gesture Gets the target of the movement, in client coordinates. A in client coordinates The property value is equal to . Gets or sets the target of the movement, in client coordinates A in client coordinates A implementation. A mutable collection of Adds a instance to the collection A instance to add to the collection Gets or sets the at position index of the gesture get property, the at position A helper factory of instance. Initializes a new with a instance Target form Creates a for the method and starts it. The to execute The started instance