public void AzureSql_ExplicitResourceCleanup_Test() { // Create an entry point to all Azure functionality var portal = new AzurePortal(DefaultSubscription); var database = portal.Sql.CreateSqlDatabase("mytestdbx"); // check if database was created for server Assert.IsFalse(string.IsNullOrEmpty(database.ConnectionString)); // It is important to call this method in the end of your test to clean up all Azure resources // you have used explicitly or implicitly while using TestEasy API. TestEasy remembers all resources // that were created and frees them. If we don't free resources subscription will reach it's limits soon, // and tests will be blocked. // Note: !!! it is recommended though to use "using" statement since it would call Dispose even in // the case of exception, which would ensure all resources cleaned up. portal.CleanupResources(); // check if server was deleted Assert.IsFalse(database.Server.DatabaseExists(database)); }
public void AzureSql_ExplicitResourceCleanup_Test() { // Create an entry point to all Azure functionality var portal = new AzurePortal(TestConstants.TestSubscription); var database = portal.Sql.CreateSqlDatabase("mytestdbx"); // check if database was created for server Assert.AreEqual(1, database.Server.Databases.Count()); Assert.IsFalse(string.IsNullOrEmpty(database.ConnectionString)); // It is important to call this method in the end of your test to clean up all Azure resources // you have used explicitly or implicitly while using TestEasy API. TestEasy remembers all resources // that were created and frees them. If we don't free resources subscription will reach it's limits soon, // and tests will be blocked. // Note: !!! it is recommended though to use "using" statement since it would call Dispose even in // the case of exception, which would ensure all resources cleaned up. portal.CleanupResources(); // check if server was deleted Assert.IsFalse(database.Server.DatabaseExists(database)); }