public void HealthcareApisCreateAccountErrorTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType().Name)) { var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); // Create resource group var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); // Generate account name string accountName = TestUtilities.GenerateName("hca"); var serviceDescription = HealthcareApisManagementTestUtilities.GetServiceDescription(); // try to create account in non-existent RG HealthcareApisManagementTestUtilities.ValidateExpectedException(() => healthCareApisMgmtClient.Services.CreateOrUpdate("NotExistedRG", accountName, serviceDescription), HttpStatusCode.NotFound.ToString()); } }
public void HealthcareApisDeleteAccountErrorTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType().Name)) { var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); // Create resource group var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); // try to delete non-existent account HealthcareApisManagementTestUtilities.ValidateExpectedException( () => healthCareApisMgmtClient.Services.Delete("NotExistedRG", "nonExistedAccountName"), HttpStatusCode.NotFound.ToString()); } }