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 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); }
                                  );
            }
        }