-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Azure.Sdk.Tools.NotificationConfiguration.Tests
+ improve `Noti…
…ficationConfiguration.Program.Main` (#5247)
- Loading branch information
Konrad Jamrozik
authored
Jan 27, 2023
1 parent
b3668aa
commit a442861
Showing
4 changed files
with
178 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...uration/notification-creator.Tests/Azure.Sdk.Tools.NotificationConfiguration.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<WarningsAsErrors>Nullable</WarningsAsErrors> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="NUnit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" /> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\notification-creator\Azure.Sdk.Tools.NotificationConfiguration.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
30 changes: 30 additions & 0 deletions
30
tools/notification-configuration/notification-creator.Tests/ProgramTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Sdk.Tools.NotificationConfiguration.Tests; | ||
|
||
[TestFixture] | ||
public class ProgramTests | ||
{ | ||
[Test] | ||
public void ThrowsVssUnauthorizedException() | ||
{ | ||
Environment.SetEnvironmentVariable("aadAppIdVar", "aadAppIdVarValue"); | ||
Environment.SetEnvironmentVariable("aadAppSecretVar", "aadAppSecretVarValue"); | ||
Environment.SetEnvironmentVariable("aadTenantVar", "aadTenantVarValue"); | ||
Assert.ThrowsAsync<Microsoft.VisualStudio.Services.Common.VssUnauthorizedException>( | ||
async () => | ||
// Act | ||
await Program.Main( | ||
organization: "fooOrg", | ||
project: "barProj", | ||
pathPrefix: "qux", | ||
tokenVariableName: "token", | ||
aadAppIdVar: "aadAppIdVar", | ||
aadAppSecretVar: "aadAppSecretVar", | ||
aadTenantVar: "aadTenantVar", | ||
selectionStrategy: PipelineSelectionStrategy.Scheduled, | ||
dryRun: true) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters