public void SetPowerBIWorkspaceOrganizationScope_WorkspaceParameterSet() { // Arrange var workspace = new Workspace { Id = Guid.NewGuid(), Name = "UpdatedName", Description = "UpdatedDescription" }; var expectedResponse = new object(); var client = new Mock <IPowerBIApiClient>(); client.Setup(x => x.Workspaces .UpdateWorkspaceAsAdmin(workspace.Id, It.Is <Workspace>(w => w.Name == workspace.Name && w.Description == workspace.Description))) .Returns(expectedResponse); var initFactory = new TestPowerBICmdletInitFactory(client.Object); var cmdlet = new SetPowerBIWorkspace(initFactory) { Scope = PowerBIUserScope.Organization, Workspace = workspace, ParameterSet = "Workspace", }; // Act cmdlet.InvokePowerBICmdlet(); // Assert TestUtilities.AssertExpectedUnitTestResults(expectedResponse, client, initFactory); }
public void SetPowerBIWorkspaceOrganizationScope_CapacityParameterSet() { // Arrange var workspaceId = Guid.NewGuid(); var capacityGuid = Guid.NewGuid(); var client = new Mock <IPowerBIApiClient>(); client.Setup(x => x.Workspaces .MigrateWorkspaceCapacity(workspaceId, capacityGuid)); var initFactory = new TestPowerBICmdletInitFactory(client.Object); var cmdlet = new SetPowerBIWorkspace(initFactory) { Scope = PowerBIUserScope.Organization, ParameterSet = "Capacity", Id = workspaceId, CapacityId = capacityGuid, }; // Act cmdlet.InvokePowerBICmdlet(); // Assert TestUtilities.AssertExpectedUnitTestResults(null, client, initFactory); }
public void SetPowerBIWorkspaceIndividualScope() { // Arrange var client = new Mock <IPowerBIApiClient>(); var initFactory = new TestPowerBICmdletInitFactory(client.Object); var cmdlet = new SetPowerBIWorkspace(initFactory) { Scope = PowerBIUserScope.Individual, Id = Guid.NewGuid(), }; try { // Act cmdlet.InvokePowerBICmdlet(); Assert.Fail("Should not have reached this point"); } catch (System.Reflection.TargetInvocationException ex) { // Assert Assert.AreEqual(ex.InnerException.GetType(), typeof(NotImplementedException)); } }