public void HealthcareApisCreateTestWithDefaultKind() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { 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("workspace"); var workspace = HealthcareApisManagementTestUtilities.GetWorkspace(); var account = healthCareApisMgmtClient.Workspaces.BeginCreateOrUpdate(rgname, accountName, workspace); var fhirServiceName = TestUtilities.GenerateName("fhirservice"); var serviceDescription = HealthcareApisManagementTestUtilities.GetFhirService(false); var fhirService = healthCareApisMgmtClient.FhirServices.BeginCreateOrUpdate(rgname, accountName, fhirServiceName, serviceDescription); Assert.Equal("fhir-R4", fhirService.Kind); } }
public void HealthcareApisGetAccountTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); // Create resource group var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); //generate account name string workspaceName = TestUtilities.GenerateName("hca"); var workspaceDescription = HealthcareApisManagementTestUtilities.GetWorkspace(); // Create healthcareApis account var workspace = healthCareApisMgmtClient.Workspaces.BeginCreateOrUpdate(rgname, workspaceName, workspaceDescription); // Validate var fetchedWorkspace = healthCareApisMgmtClient.Workspaces.Get(rgname, workspaceName); Assert.Equal("westus2", fetchedWorkspace.Location); } }
public void HealthcareApisDeleteTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { 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 workspace = HealthcareApisManagementTestUtilities.GetWorkspace(); // Create healthcareApis account var account = healthCareApisMgmtClient.Workspaces.BeginCreateOrUpdate(rgname, accountName, workspace); // Delete an account healthCareApisMgmtClient.Workspaces.BeginDelete(rgname, accountName); // Delete an account which does not exist healthCareApisMgmtClient.Services.Delete(rgname, "missingaccount"); } }
public void HealthcareApisAccountUpdateWithCreateTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); // Create resource group var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); // Generate account name string workspaceName = TestUtilities.GenerateName("hca"); var workspaceDescription = HealthcareApisManagementTestUtilities.GetWorkspace(); var workspace = healthCareApisMgmtClient.Workspaces.BeginCreateOrUpdate(rgname, workspaceName, workspaceDescription); string fhirServiceName = TestUtilities.GenerateName("fhirservice"); var fhirServiceDescription = HealthcareApisManagementTestUtilities.GetFhirService(false); // Create FhirService var fhirService = healthCareApisMgmtClient.FhirServices.BeginCreateOrUpdate(rgname, workspaceName, fhirServiceName, fhirServiceDescription); var updatedFhirServiceDescription = HealthcareApisManagementTestUtilities.GetFhirService(true); // Update Tags var updatedFhirService = healthCareApisMgmtClient.FhirServices.BeginCreateOrUpdate(rgname, workspaceName, fhirServiceName, updatedFhirServiceDescription); Assert.True(updatedFhirService.Tags.Values.Contains("value3")); Assert.True(updatedFhirService.Tags.Values.Contains("value4")); Assert.False(updatedFhirService.Tags.Values.Contains("value1")); Assert.False(updatedFhirService.Tags.Values.Contains("value2")); // Validate var fetchedAccount = healthCareApisMgmtClient.FhirServices.Get(rgname, workspaceName, fhirServiceName); Assert.Equal(updatedFhirServiceDescription.Tags.Count, fetchedAccount.Tags.Count); Assert.Collection(fetchedAccount.Tags, (keyValue) => { Assert.Equal("key3", keyValue.Key); Assert.Equal("value3", keyValue.Value); }, (keyValue) => { Assert.Equal("key4", keyValue.Key); Assert.Equal("value4", keyValue.Value); }, (keyValue) => { Assert.Equal("key5", keyValue.Key); Assert.Equal("value5", keyValue.Value); } ); } }
public void HealthcareApisAccountPrivateEndpointConnectionTest() { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { var resourcesClient = HealthcareApisManagementTestUtilities.GetResourceManagementClient(context, handler); var healthCareApisMgmtClient = HealthcareApisManagementTestUtilities.GetHealthcareApisManagementClient(context, handler); // Create resource group var rgname = HealthcareApisManagementTestUtilities.CreateResourceGroup(resourcesClient); { // prepare account properties string accountName = TestUtilities.GenerateName("hca1234"); var workspace = HealthcareApisManagementTestUtilities.GetWorkspace(); // Create healthcare apis account var account = healthCareApisMgmtClient.Workspaces.BeginCreateOrUpdate(rgname, accountName, workspace); // Create private link resource var plResouces = healthCareApisMgmtClient.WorkspacePrivateLinkResources.ListByWorkspace(rgname, accountName); PrivateEndpointConnection pec = null; try { pec = healthCareApisMgmtClient.WorkspacePrivateEndpointConnections.Get(rgname, accountName, "notExistPCN"); } catch { } // verify Assert.NotNull(plResouces); Assert.True(plResouces.Count() == 1); Assert.Equal("healthcareworkspace", plResouces.First().GroupId); Assert.Null(pec); var plConnections = healthCareApisMgmtClient.WorkspacePrivateEndpointConnections.ListByWorkspace(rgname, accountName); Assert.True(plConnections.ToList().Count == 0); } } }