public static CreateTestDatabasesWithSqlAuth ( ) : void | ||
return | void |
public void SetupTest() { AzureSessionInitializer.InitializeAzureSession(); ServiceManagementProfileProvider.InitializeServiceManagementProfile(); AzureSMProfileProvider.Instance.Profile = new AzureSMProfile(); // Create 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); }
public static void InitializeClass(TestContext context) { // Create atleast two test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithSqlAuth(); }
public static void InitializeClass(TestContext context) { AzureSessionInitializer.InitializeAzureSession(); ServiceManagementProfileProvider.InitializeServiceManagementProfile(); AzureSMProfileProvider.Instance.Profile = new AzureSMProfile(); // Create atleast two test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithSqlAuth(); }
/// <summary> /// Helper function to create the test databases. /// </summary> public static void CreateTestDatabasesWithSqlAuth() { using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create()) { // Create a context NewAzureSqlDatabaseServerContextTests.CreateServerContextSqlAuth( powershell, "$context"); // Create the 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth( powershell, "$context"); } }
public void InitializeTest() { // Create 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); }
public void SetupTest() { // Create 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); }
public void RemoveAzureSqlDatabaseWithSqlAuth() { using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create()) { // Create a context NewAzureSqlDatabaseServerContextTests.CreateServerContextSqlAuth( powershell, "$context"); // Create 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth( powershell, "$context"); HttpSession testSession = MockServerHelper.DefaultSessionCollection.GetSession( "UnitTests.RemoveAzureSqlDatabaseWithSqlAuth"); DatabaseTestHelper.SetDefaultTestSessionSettings(testSession); testSession.RequestValidator = new Action <HttpMessage, HttpMessage.Request>( (expected, actual) => { Assert.AreEqual(expected.RequestInfo.Method, actual.Method); Assert.AreEqual(expected.RequestInfo.UserAgent, actual.UserAgent); if (expected.Index < 8) { // Request 0-5: Remove database requests // Request 6-7: Get all database request DatabaseTestHelper.ValidateHeadersForODataRequest( expected.RequestInfo, actual); } else { Assert.Fail("No more requests expected."); } }); using (AsyncExceptionManager exceptionManager = new AsyncExceptionManager()) { // Create context with both ManageUrl and ServerName overriden Collection <PSObject> databases; using (new MockHttpServer( exceptionManager, MockHttpServer.DefaultServerPrefixUri, testSession)) { powershell.InvokeBatchScript( @"Remove-AzureSqlDatabase " + @"-Context $context " + @"-DatabaseName testdb1 " + @"-Force"); powershell.InvokeBatchScript( @"Remove-AzureSqlDatabase " + @"-Context $context " + @"-DatabaseName testdb2 " + @"-Force"); databases = powershell.InvokeBatchScript( @"Get-AzureSqlDatabase " + @"-Context $context"); } Assert.AreEqual(0, powershell.Streams.Error.Count, "Errors during run!"); Assert.AreEqual(0, powershell.Streams.Warning.Count, "Warnings during run!"); powershell.Streams.ClearStreams(); Assert.AreEqual(1, databases.Count, "Expecting only master database object"); } } }