public void LocationBasedServicesAccountDeleteTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType().FullName)) { var resourcesClient = LocationBasedServicesManagementTestUtilities.GetResourceManagementClient(context, handler); var locationBasedServicesManagementClient = LocationBasedServicesManagementTestUtilities.GetLocationBasedServicesManagementClient(context, handler); // Create resource group var rgname = LocationBasedServicesManagementTestUtilities.CreateResourceGroup(resourcesClient); // Delete an account which does not exist locationBasedServicesManagementClient.Accounts.Delete(rgname, "missingaccount"); // prepare account properties string accountName = TestUtilities.GenerateName("lbs"); var parameters = LocationBasedServicesManagementTestUtilities.GetDefaultLocationBasedServicesAccountParameters(); // Create account var newAccount = locationBasedServicesManagementClient.Accounts.CreateOrUpdate(rgname, accountName, parameters); // Delete an account locationBasedServicesManagementClient.Accounts.Delete(rgname, accountName); // Delete an account which was just deleted locationBasedServicesManagementClient.Accounts.Delete(rgname, accountName); } }
public void LocationBasedServicesAccountCreateTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { var resourcesClient = LocationBasedServicesManagementTestUtilities.GetResourceManagementClient(context, handler); var locationBasedServicesManagementClient = LocationBasedServicesManagementTestUtilities.GetLocationBasedServicesManagementClient(context, handler); // Create resource group var rgname = LocationBasedServicesManagementTestUtilities.CreateResourceGroup(resourcesClient); // prepare account properties string accountName = TestUtilities.GenerateName("lbs"); var parameters = LocationBasedServicesManagementTestUtilities.GetDefaultLocationBasedServicesAccountParameters(); // Create account var newAccount = locationBasedServicesManagementClient.Accounts.CreateOrUpdate(rgname, accountName, parameters); LocationBasedServicesManagementTestUtilities.VerifyAccountProperties(newAccount, true); // now get the account var account = locationBasedServicesManagementClient.Accounts.Get(rgname, accountName); LocationBasedServicesManagementTestUtilities.VerifyAccountProperties(account, true); // now delete the account locationBasedServicesManagementClient.Accounts.Delete(rgname, accountName); } }
public void LocationBasedServicesAccountUpdateTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType().FullName)) { var resourcesClient = LocationBasedServicesManagementTestUtilities.GetResourceManagementClient(context, handler); var locationBasedServicesManagementClient = LocationBasedServicesManagementTestUtilities.GetLocationBasedServicesManagementClient(context, handler); // Create resource group var rgname = LocationBasedServicesManagementTestUtilities.CreateResourceGroup(resourcesClient); // prepare account properties string accountName = TestUtilities.GenerateName("lbs"); var parameters = LocationBasedServicesManagementTestUtilities.GetDefaultLocationBasedServicesAccountParameters(); // create the account var newAccount = locationBasedServicesManagementClient.Accounts.CreateOrUpdate(rgname, accountName, parameters); LocationBasedServicesManagementTestUtilities.VerifyAccountProperties(newAccount, true); // create new parameters which are almost the same, but have different tags var newParameters = LocationBasedServicesManagementTestUtilities.GetDefaultLocationBasedServicesAccountParameters(); newParameters.Tags = new Dictionary <string, string> { { "key3", "value3" }, { "key4", "value4" } }; var updatedAccount = locationBasedServicesManagementClient.Accounts.CreateOrUpdate(rgname, accountName, newParameters); LocationBasedServicesManagementTestUtilities.VerifyAccountProperties(updatedAccount, false); Assert.NotNull(updatedAccount.Tags); Assert.Equal(2, updatedAccount.Tags.Count); Assert.Equal("value3", updatedAccount.Tags["key3"]); Assert.Equal("value4", updatedAccount.Tags["key4"]); } }