示例#1
0
 public DashboardClient(IPowerBiAuthentication bi)
 {
     this._bi = bi;
     this._client = new RestClient("https://api.powerbi.com");
     this._client.AddDefaultHeader("Authorization", _bi.GetAccessToken());
     this._cancellationToken = new CancellationTokenSource();
     this._addresses = new PowerBiAddresses();
 }
        public void WithGroupId_AddOrRemoveRows_MatchesDocumentation()
        {
            var expected = "v1.0/myorg/groups/123/datasets/{datasetId}/tables/{tableName}/rows";
            var addresses = new PowerBiAddresses();

            var actual = addresses.AddOrRemoveRows("123");

            Assert.AreEqual(expected, actual);
        }
        public void NoGroupId_UpdateTableSchema_MatchesDocumentation()
        {
            var expected = "v1.0/myorg/datasets/{datasetId}/tables/{tableName}";
            var addresses = new PowerBiAddresses();

            var actual = addresses.UpdateTableSchema(string.Empty);

            Assert.AreEqual(expected, actual);
        }
        public void NoGroupId_GetDatasetTables_MatchesDocumentation()
        {
            var expected = "v1.0/myorg/datasets/{datasetId}/tables";
            var addresses = new PowerBiAddresses();

            var actual = addresses.GetDatasetTables(string.Empty);

            Assert.AreEqual(expected, actual);
        }
        public void NoGroupId_CreateDataset_MatchesDocumentation()
        {
            var expected = "v1.0/myorg/datasets?defaultRetentionPolicy={defaultRetentionPolicy}";
            var addresses = new PowerBiAddresses();

            var actual = addresses.CreateDataset(string.Empty);

            Assert.AreEqual(expected, actual);
        }
        public void NoGroupId_GetDashboards_ValidUrl()
        {
            var expected = "beta/myorg/dashboards";
            var addresses = new PowerBiAddresses();

            var actual = addresses.GetDashboards(string.Empty);

            Assert.AreEqual(expected, actual);
        }
        public void GroupId_GetDashboardTiles_ValidUrl()
        {
            var expected = "beta/myorg/groups/123/dashboards/{dashboardId}/tiles";
            var addresses = new PowerBiAddresses();

            var actual = addresses.GetDashboardTiles("123");

            Assert.AreEqual(expected, actual);
        }
        public void WithGroupId_GetDatasets_MatchesDocumentation()
        {
            var expected = "v1.0/myorg/groups/123/datasets";
            var addresses = new PowerBiAddresses();

            var actual = addresses.GetDatasets("123");

            Assert.AreEqual(expected, actual);
        }
        public void NoGroupId_GetDashboardTileById_ValidUrl()
        {
            var expected = "beta/myorg/dashboards/{dashboardId}/tiles/{tileId}";
            var addresses = new PowerBiAddresses();

            var actual = addresses.GetDashboardTile(string.Empty);

            Assert.AreEqual(expected, actual);
        }