private void DropTestDatabases() { // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithCertAuth(powershell); databasesAlreadyDropped = true; }
public static void InitializeClass(TestContext context) { // Create atleast two test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithSqlAuth(); }
public void CleanupTest() { // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithSqlAuth(); // Save the mock session results MockServerHelper.SaveDefaultSessionCollection(); }
public void SetupTest() { AzureSessionInitializer.InitializeAzureSession(); ServiceManagementProfileProvider.InitializeServiceManagementProfile(); AzureSMProfileProvider.Instance.Profile = new AzureSMProfile(); // Create 2 test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithSqlAuth(); }
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(); }
public void CleanupTest() { powershell.Streams.ClearStreams(); if (!databasesAlreadyDropped) { // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithCertAuth(powershell); } // Save the mock session results MockServerHelper.SaveDefaultSessionCollection(); }
public void SetupTest() { powershell = System.Management.Automation.PowerShell.Create(); MockHttpServer.SetupCertificates(); UnitTestHelper.SetupUnitTestSubscription(powershell); serverName = SqlDatabaseTestSettings.Instance.ServerName; powershell.Runspace.SessionStateProxy.SetVariable("serverName", serverName); // Create atleast two test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithCertAuth(powershell); }
/// <summary> /// Helper function to remove the test databases. /// </summary> public static void RemoveTestDatabasesWithSqlAuth() { using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create()) { // Create a context NewAzureSqlDatabaseServerContextTests.CreateServerContextSqlAuth( powershell, "$context"); // Remove the 2 test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithSqlAuth( powershell, "$context"); } }
public static void InitializeClass(TestContext context) { powershell = PowerShell.Create(); MockHttpServer.SetupCertificates(); UnitTestHelper.SetupUnitTestSubscription(powershell); serverName = SqlDatabaseTestSettings.Instance.ServerName; powershell.Runspace.SessionStateProxy.SetVariable("serverName", serverName); // Create atleast two test databases NewAzureSqlDatabaseTests.CreateTestDatabasesWithCertAuth(powershell); // Remove the test databases NewAzureSqlDatabaseTests.RemoveTestDatabasesWithCertAuth(powershell); }
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"); } } }