public static void ClassInitialize(TestContext testContext) { IComputeProvider provider = Bootstrapper.CreateComputeProvider(); string serverName = UserComputeTests.UnitTestServerPrefix + Path.GetRandomFileName(); Flavor flavor = UserComputeTests.ListAllFlavorsWithDetails(provider).OrderBy(i => i.RAMInMB).ThenBy(i => i.DiskSizeInGB).FirstOrDefault(); if (flavor == null) { Assert.Inconclusive("Couldn't find a flavor to use for the test server."); } SimpleServerImage[] images = UserComputeTests.ListAllImages(provider).ToArray(); SimpleServerImage image = images.FirstOrDefault(i => i.Name.IndexOf(TestImageNameSubstring, StringComparison.OrdinalIgnoreCase) >= 0); if (image == null) { Assert.Inconclusive(string.Format("Couldn't find the {0} image to use for the test server.", TestImageNameSubstring)); } Stopwatch timer = Stopwatch.StartNew(); Console.Write("Creating server for image {0}...", image.Name); NewServer server = provider.CreateServer(serverName, image.Id, flavor.Id, attachToServiceNetwork: true); Assert.IsNotNull(server); Assert.IsFalse(string.IsNullOrEmpty(server.Id)); _password = server.AdminPassword; _server = provider.WaitForServerActive(server.Id); Assert.IsNotNull(_server); Assert.AreEqual(server.Id, _server.Id); Assert.AreEqual(ServerState.Active, _server.Status); Console.WriteLine("done. {0} seconds", timer.Elapsed.TotalSeconds); }