Skip to content

Commit 7678e48

Browse files
committed
tests all passing
1 parent 38a2e99 commit 7678e48

File tree

3 files changed

+342
-461
lines changed

3 files changed

+342
-461
lines changed

src/Resources/Resources.Test/ScenarioTests/ActiveDirectoryTests.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,25 @@ public void TestCreateDeleteAppCredentials()
613613
[Trait(Category.AcceptanceType, Category.CheckIn)]
614614
public void TestCreateDeleteSpCredentials()
615615
{
616-
TestRunner.RunTestScript("Test-CreateDeleteSpCredentials");
616+
const string scriptMethod = "Test-CreateDeleteSpCredentials '{0}'";
617+
Application application = null;
618+
var controllerAdmin = ResourcesController.NewInstance;
619+
620+
controllerAdmin.RunPsTestWorkflow(
621+
interceptor,
622+
// scriptBuilder
623+
() =>
624+
{
625+
application = CreateNewAdApp(controllerAdmin);
626+
return new[] { string.Format(scriptMethod, application.AppId) };
627+
},
628+
// cleanup
629+
() =>
630+
{
631+
DeleteAdApp(controllerAdmin, application);
632+
},
633+
MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
634+
MethodBase.GetCurrentMethod().Name);
617635
}
618636

619637
[Fact]

src/Resources/Resources.Test/ScenarioTests/ActiveDirectoryTests.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ Tests Creating and deleting application using Service Principal Credentials.
762762
#>
763763
function Test-CreateDeleteSpCredentials
764764
{
765+
param([string]$applicationId)
766+
765767
# Setup
766768
$getAssetName = ConvertTo-SecureString "test" -AsPlainText -Force
767769
$displayName = "test"
@@ -772,7 +774,7 @@ function Test-CreateDeleteSpCredentials
772774
$keyId3 = "4141b479-4ca0-4919-8451-7e155de6aa0f"
773775

774776
# Test - Add SP
775-
$servicePrincipal = New-AzADServicePrincipal -DisplayName $displayName
777+
$servicePrincipal = New-AzADServicePrincipal -DisplayName $displayName -ApplicationId $applicationId
776778

777779
# Assert
778780
Assert-NotNull $servicePrincipal
@@ -853,9 +855,5 @@ function Test-CreateDeleteSpCredentials
853855
{
854856
# Remove Service Principal
855857
Remove-AzADServicePrincipal -ObjectId $servicePrincipal.Id -Force
856-
857-
# Remove App
858-
$app = Get-AzADApplication -ApplicationId $servicePrincipal.ApplicationId
859-
Remove-AzADApplication -ObjectId $app.ObjectId -Force
860858
}
861859
}

0 commit comments

Comments
 (0)