public void ConnectPowerBIServiceAccountDiscoveryUrl_NullCustomEnvironment() { // Arrange var initFactory = new TestPowerBICmdletNoClientInitFactory(false); var cmdlet = new ConnectPowerBIServiceAccount(initFactory) { DiscoveryUrl = "https://api.powerbi.com/powerbi/globalservice/v201606/environments/discover?client=powerbi-msolap" }; // Act cmdlet.InvokePowerBICmdlet(); //Assert Assert.Fail("Custom environment was not provided"); }
public void ConnectPowerBIServiceAccountServiceWithTenantId_PrincipalParameterSet() { // Arrange var initFactory = new TestPowerBICmdletNoClientInitFactory(false); var testTenantName = "test.microsoftonline.com"; var cmdlet = new ConnectPowerBIServiceAccount(initFactory) { Tenant = testTenantName, ServicePrincipal = true, Credential = new PSCredential("appId", new SecureString()), ParameterSet = "ServicePrincipal" }; // Act cmdlet.InvokePowerBICmdlet(); // Assert var profile = initFactory.GetProfileFromStorage(); Assert.IsNotNull(profile); Assert.IsTrue(profile.Environment.AzureADAuthority.Contains(testTenantName)); initFactory.AssertExpectedUnitTestResults(new[] { profile }); }