public void GetPowerBIDataflowDatasourceIndividualScope_ObjectAndListParameterSet() { // Arrange var testDataflow = new Dataflow { Id = Guid.NewGuid(), Name = "TestDataflow" }; var expectedDatasources = new List <Datasource> { new Datasource { DatasourceId = Guid.NewGuid().ToString(), Name = "TestDatasource", GatewayId = Guid.NewGuid().ToString() } }; var workspaceId = Guid.NewGuid(); var client = new Mock <IPowerBIApiClient>(); client.Setup(x => x.Dataflows.GetDataflowDatasources(workspaceId, testDataflow.Id)).Returns(expectedDatasources); var initFactory = new TestPowerBICmdletInitFactory(client.Object); var cmdlet = new GetPowerBIDataflowDatasource(initFactory) { Scope = PowerBIUserScope.Individual, Dataflow = testDataflow, WorkspaceId = workspaceId, ParameterSet = "DataflowAndList", }; // Act cmdlet.InvokePowerBICmdlet(); // Assert initFactory.AssertExpectedUnitTestResults(expectedDatasources); }
public void GetPowerBIDataflowDatasourceOrganizationScope_ListParameterSet() { // Arrange var dataflowId = Guid.NewGuid(); var expectedDatasources = new List <Datasource> { new Datasource { DatasourceId = Guid.NewGuid().ToString(), Name = "TestDatasource", GatewayId = Guid.NewGuid().ToString() } }; var client = new Mock <IPowerBIApiClient>(); client.Setup(x => x.Dataflows.GetDataflowDatasourcesAsAdmin(dataflowId)).Returns(expectedDatasources); var initFactory = new TestPowerBICmdletInitFactory(client.Object); var cmdlet = new GetPowerBIDataflowDatasource(initFactory) { Scope = PowerBIUserScope.Organization, DataflowId = dataflowId, ParameterSet = "List", }; // Act cmdlet.InvokePowerBICmdlet(); // Assert initFactory.AssertExpectedUnitTestResults(expectedDatasources); }