コード例 #1
0
        [TestCategory("SkipWhenLiveUnitTesting")] // Ignore for Live Unit Testing
        public void EndToEndSetWorkspaceOrganizationScopeWorkspaceParameterSet()
        {
            using (var ps = System.Management.Automation.PowerShell.Create())
            {
                // Arrange
                ProfileTestUtilities.ConnectToPowerBI(ps);
                var workspace = WorkspacesTestUtilities.GetFirstWorkspaceInOrganization(ps);
                WorkspacesTestUtilities.AssertShouldContinueOrganizationTest(workspace);
                var updatedName        = TestUtilities.GetRandomString();
                var updatedDescription = TestUtilities.GetRandomString();
                workspace.Name        = updatedName;
                workspace.Description = updatedDescription;
                var parameters = new Dictionary <string, object>
                {
                    { nameof(SetPowerBIWorkspace.Scope), PowerBIUserScope.Organization },
                    { nameof(SetPowerBIWorkspace.Workspace), workspace }
                };
                ps.AddCommand(Cmdlet).AddParameters(parameters);

                // Act
                var results = ps.Invoke();

                // Assert
                TestUtilities.AssertNoCmdletErrors(ps);
                Assert.IsNotNull(results);
                var updatedWorkspace = WorkspacesTestUtilities.GetWorkspace(ps, PowerBIUserScope.Organization, workspace.Id);
                Assert.AreEqual(updatedName, updatedWorkspace.Name);
                Assert.AreEqual(updatedDescription, updatedWorkspace.Description);
            }
        }
コード例 #2
0
        [TestCategory("SkipWhenLiveUnitTesting")] // Ignore for Live Unit Testing
        public void EndToEndAddPowerBIWorkspaceUserOrganizationScope()
        {
            using (var ps = System.Management.Automation.PowerShell.Create())
            {
                // Arrange
                ProfileTestUtilities.ConnectToPowerBI(ps);
                var workspace = WorkspacesTestUtilities.GetFirstWorkspaceInOrganization(ps);
                WorkspacesTestUtilities.AssertShouldContinueOrganizationTest(workspace);
                var emailAddress = "*****@*****.**";
                var parameters   = new Dictionary <string, object>()
                {
                    { nameof(AddPowerBIWorkspaceUser.Scope), PowerBIUserScope.Organization },
                    { nameof(AddPowerBIWorkspaceUser.Id), workspace.Id },
                    { nameof(AddPowerBIWorkspaceUser.UserPrincipalName), emailAddress },
                    { nameof(AddPowerBIWorkspaceUser.AccessRight), WorkspaceUserAccessRight.Member }
                };
                ps.AddCommand(Cmdlet).AddParameters(parameters);

                // Act
                var results = ps.Invoke();

                // Assert
                TestUtilities.AssertNoCmdletErrors(ps);
                Assert.IsNotNull(results);
                var updatedWorkspace = WorkspacesTestUtilities.GetWorkspace(ps, PowerBIUserScope.Organization, workspace.Id);
                Assert.IsTrue(updatedWorkspace.Users
                              .Any(x => x.UserPrincipalName.Equals(emailAddress, StringComparison.OrdinalIgnoreCase) &&
                                   x.AccessRight == WorkspaceUserAccessRight.Member.ToString()));
            }
        }
コード例 #3
0
        [TestCategory("SkipWhenLiveUnitTesting")] // Ignore for Live Unit Testing
        public void EndToEndSetWorkspaceOrganizationScopeCapacityParameterSet()
        {
            using (var ps = System.Management.Automation.PowerShell.Create())
            {
                // Arrange
                ProfileTestUtilities.ConnectToPowerBI(ps);
                var workspace = WorkspacesTestUtilities.GetFirstWorkspaceInOrganization(ps);
                WorkspacesTestUtilities.AssertShouldContinueOrganizationTest(workspace);
                var capacityId = WorkspacesTestUtilities.GetFirstCapacityInOrganization(ps);

                var parameters = new Dictionary <string, object>
                {
                    { nameof(SetPowerBIWorkspace.Scope), PowerBIUserScope.Organization },
                    { nameof(SetPowerBIWorkspace.Id), workspace.Id },
                    { nameof(SetPowerBIWorkspace.CapacityId), capacityId }
                };
                ps.AddCommand(Cmdlet).AddParameters(parameters);

                // Act
                var results = ps.Invoke();

                // Assert
                TestUtilities.AssertNoCmdletErrors(ps);
                Assert.IsNotNull(results);
            }
        }