public void ExportPowerBIDataflowOrganizationScope_ByDataflowId()
        {
            try
            {
                // Arrange
                var dataflowId = Guid.NewGuid();
                var client     = new Mock <IPowerBIApiClient>();

                using (var expecedDataflowStream = File.OpenRead(c_dataflowModel))
                {
                    client.Setup(x => x.Dataflows.ExportDataflowAsAdmin(dataflowId)).Returns(expecedDataflowStream);

                    var initFactory = new TestPowerBICmdletInitFactory(client.Object);
                    var cmdlet      = new ExportPowerBIDataflow(initFactory)
                    {
                        Scope        = PowerBIUserScope.Organization,
                        ParameterSet = "Id",
                        Id           = dataflowId,
                        OutFile      = c_ExportedDataflowModel
                    };

                    // Act
                    cmdlet.InvokePowerBICmdlet();
                }

                // Assert
                Assert.IsTrue(File.Exists(c_ExportedDataflowModel));
            }
            finally
            {
                // always delete the test's exported file
                File.Delete(c_ExportedDataflowModel);
            }
        }
        public void ExportPowerBIDataflowIndividualScope_ByDataflow()
        {
            try
            {
                // Arrange
                var workspaceId = Guid.NewGuid();
                var dataflow    = new Dataflow {
                    Id = Guid.NewGuid(), Name = "DataflowName"
                };
                var client = new Mock <IPowerBIApiClient>();

                using (var expecedDataflowStream = File.OpenRead(c_dataflowModel))
                {
                    client.Setup(x => x.Dataflows.GetDataflow(workspaceId, dataflow.Id)).Returns(expecedDataflowStream);

                    var initFactory = new TestPowerBICmdletInitFactory(client.Object);
                    var cmdlet      = new ExportPowerBIDataflow(initFactory)
                    {
                        Scope        = PowerBIUserScope.Individual,
                        ParameterSet = "Id",
                        WorkspaceId  = workspaceId,
                        Dataflow     = dataflow,
                        OutFile      = c_ExportedDataflowModel
                    };

                    // Act
                    cmdlet.InvokePowerBICmdlet();
                }

                // Assert
                Assert.IsTrue(File.Exists(c_ExportedDataflowModel));
            }
            finally
            {
                // always delete the test's exported file
                File.Delete(c_ExportedDataflowModel);
            }
        }