Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit da6bd6f

Browse files
Update tests
1 parent b96666a commit da6bd6f

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

test/IdentityModel.OidcClient.Tests/CodeFlowResponseTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public async Task malformed_identity_token_on_token_response_should_fail()
252252
var result = await client.ProcessResponseAsync(url, state);
253253

254254
result.IsError.Should().BeTrue();
255-
result.Error.Should().StartWith("Error validating token response: Error validating identity token: System.ArgumentException: IDX10709: JWT is not well formed");
255+
result.Error.Should().Contain("IDX12709: JWT is not well formed");
256256
}
257257

258258
[Fact]
@@ -299,7 +299,7 @@ public async Task untrusted_identity_token_should_fail()
299299
var result = await client.ProcessResponseAsync(url, state);
300300

301301
result.IsError.Should().BeTrue();
302-
result.Error.Should().StartWith("Error validating token response: Error validating identity token: Microsoft.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException: IDX10501: Signature validation failed. Unable to match 'kid'");
302+
result.Error.Should().Contain("IDX10501: Signature validation failed");
303303
}
304304

305305
[Theory]

test/IdentityModel.OidcClient.Tests/ConfigurationTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void null_options_should_throw_exception()
2121

2222
Action act = () => new OidcClient(options);
2323

24-
act.ShouldThrow<ArgumentNullException>();
24+
act.Should().Throw<ArgumentNullException>();
2525
}
2626

2727
[Fact]
@@ -31,7 +31,7 @@ public void no_authority_and_no_static_config_should_throw_exception()
3131

3232
Action act = () => new OidcClient(options);
3333

34-
act.ShouldThrow<ArgumentException>().Where(e => e.Message.StartsWith("No authority specified"));
34+
act.Should().Throw<ArgumentException>().Where(e => e.Message.StartsWith("No authority specified"));
3535
}
3636

3737
[Fact]
@@ -52,7 +52,7 @@ public void providing_required_provider_information_should_not_throw()
5252

5353
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
5454

55-
act.ShouldNotThrow();
55+
act.Should().NotThrow();
5656
}
5757

5858
[Fact]
@@ -73,7 +73,7 @@ public void missing_issuer_should_throw()
7373

7474
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
7575

76-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Issuer name is missing in provider information"));
76+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Issuer name is missing in provider information"));
7777
}
7878

7979
[Fact]
@@ -94,7 +94,7 @@ public void missing_authorize_endpoint_should_throw()
9494

9595
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
9696

97-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Authorize endpoint is missing in provider information"));
97+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Authorize endpoint is missing in provider information"));
9898
}
9999

100100
[Fact]
@@ -115,7 +115,7 @@ public void missing_token_endpoint_should_throw()
115115

116116
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
117117

118-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Token endpoint is missing in provider information"));
118+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Token endpoint is missing in provider information"));
119119
}
120120

121121
[Fact]
@@ -136,7 +136,7 @@ public void missing_keyset_should_throw()
136136

137137
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
138138

139-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Key set is missing in provider information"));
139+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Key set is missing in provider information"));
140140
}
141141

142142
[Fact]
@@ -153,7 +153,7 @@ public void exception_while_loading_discovery_document_should_throw()
153153

154154
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
155155

156-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Error loading discovery document: Error connecting to https://authority/.well-known/openid-configuration: error"));
156+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Error loading discovery document: Error connecting to https://authority/.well-known/openid-configuration: error"));
157157
}
158158

159159
[Fact]
@@ -170,7 +170,7 @@ public void error401_while_loading_discovery_document_should_throw()
170170

171171
Func<Task> act = async () => { await client.EnsureProviderInformationAsync(); };
172172

173-
act.ShouldThrow<InvalidOperationException>().Where(e => e.Message.Equals("Error loading discovery document: Error connecting to https://authority/.well-known/openid-configuration: not found"));
173+
act.Should().Throw<InvalidOperationException>().Where(e => e.Message.Equals("Error loading discovery document: Error connecting to https://authority/.well-known/openid-configuration: not found"));
174174
}
175175
}
176176
}

test/IdentityModel.OidcClient.Tests/IdentityModel.OidcClient.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
1414
<PackageReference Include="xunit" Version="2.3.1" />
15-
<PackageReference Include="FluentAssertions" Version="4.19.4" />
15+
<PackageReference Include="FluentAssertions" Version="5.1.2" />
1616
</ItemGroup>
1717

1818
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">

0 commit comments

Comments
 (0)