DatabaseTestService Class

Provides common functionality that is used by the DatabaseTestClass and methods during test execution.

Inheritance Hierarchy

System.Object
  Microsoft.Data.Schema.UnitTesting.DatabaseTestService

Namespace:  Microsoft.Data.Schema.UnitTesting
Assembly:  Microsoft.Data.Schema.UnitTesting (in Microsoft.Data.Schema.UnitTesting.dll)

Syntax

'Declaration
Public Class DatabaseTestService
public class DatabaseTestService
public ref class DatabaseTestService
type DatabaseTestService =  class end
public class DatabaseTestService

The DatabaseTestService type exposes the following members.

Constructors

  Name Description
Public method DatabaseTestService Initializes a new instance of the DatabaseTestService class.

Top

Methods

  Name Description
Public method DeployDatabaseProject() Deploys the database project by using the settings of the user in the app.config file.
Protected methodStatic member DeployDatabaseProject(String, String, String, String) Deploys a database project to the database that is specified in the referenced configuration.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method Execute Executes the supplied DatabaseTestAction and evaluates the results of the execution by using each TestCondition that is contained in the Conditions collection.
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GenerateData() When overridden in a derived class, generates data by using the settings of the user in the app.config file.
Protected methodStatic member GenerateData(String, Boolean, String, String) When overridden in a derived class, generates data to the specified database by using the referenced data generation plan.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method OpenExecutionContext Opens the ConnectionContext that will be used for a test execution.
Public method OpenPrivilegedContext Opens the context that is used when the results of SQL execution are verified and when the database is set up.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

The services provided by this class include the following:

  • Reading the application configuration to open and supply database connections.

  • Executing the Transact-SQL script.

  • Evaluating test conditions.

  • Deploying database projects that are based on application configuration.

  • Generating data by using a data generator configuration.

To provide your own custom DatabaseTestService implementation, override methods in this class. This is the primary mechanism for modifying how tests are executed, how test conditions are evaluated, and how connections are created while still working in the context of the Database Unit Test Designer.

When you create your implementation, it must be registered by using the TestService. If you want to open an execution context and you do not want to use impersonation, also implement your own ConnectionContext.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Data.Schema.UnitTesting Namespace

DatabaseTestClass

TestService

ConnectionContext