Ejemplo n.º 1
0
            protected void Initialize(MockContext context)
            {
                if (!initialized)
                {
                    lock (locker)
                    {
                        if (!initialized)
                        {
                            resourcesClient = PowerBITestUtilities.GetResourceManagementClient(context, new RecordedDelegatingHandler {
                                StatusCodeToReturn = HttpStatusCode.OK
                            });
                            powerBIClient = PowerBITestUtilities.GetPowerBiEmbeddedManagementClient(context, new RecordedDelegatingHandler {
                                StatusCodeToReturn = HttpStatusCode.OK
                            });

                            if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION")))
                            {
                                location = PowerBITestUtilities.DefaultLocation;
                            }
                            else
                            {
                                location = Environment.GetEnvironmentVariable("AZURE_VM_TEST_LOCATION").Replace(" ", "").ToLower();
                            }

                            this.initialized = true;
                        }
                    }
                }
            }
Ejemplo n.º 2
0
            protected ResourceGroup CreateResourceGroup()
            {
                var resourceGroupName = PowerBITestUtilities.GenerateName("rg");

                return(this.resourcesClient.ResourceGroups.CreateOrUpdate(resourceGroupName,
                                                                          new ResourceGroup
                {
                    Location = PowerBITestUtilities.DefaultLocation
                }));
            }
Ejemplo n.º 3
0
            protected WorkspaceCollection CreateWorkspaceCollection(ResourceGroup resourceGroup)
            {
                var createWorkspaceRequest = new CreateWorkspaceCollectionRequest
                {
                    Location = this.location
                };

                var workspaceCollectionName = PowerBITestUtilities.GenerateName("wc");

                return(this.powerBIClient.WorkspaceCollections.Create(
                           resourceGroup.Name,
                           workspaceCollectionName,
                           createWorkspaceRequest));
            }