This repository has been archived by the owner on Feb 6, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added (very) basic functional tests (#21)
- Loading branch information
1 parent
e4b73cb
commit 45d8204
Showing
4 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
IdentityServer4.WsFederation.Tests/Functional/MetadataTests.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,31 @@ | ||
using IdentityServer4.WsFederation.Server; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
|
||
namespace IdentityServer4.WsFederation.Tests.Functional | ||
{ | ||
[TestClass] | ||
public class MetadataTests | ||
{ | ||
private readonly HttpClient _client; | ||
|
||
public MetadataTests() | ||
{ | ||
var factory = new WebApplicationFactory<Program>(); | ||
_client = factory.CreateClient(); | ||
} | ||
|
||
[TestMethod] | ||
public async Task MetadataSuccess() | ||
{ | ||
var response = await _client.GetAsync("/wsfederation/metadata"); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
|
||
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); | ||
StringAssert.Contains(content, "<md:EntityDescriptor entityID=\"urn:idsrv4:wsfed:server:sample\" xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\">"); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
IdentityServer4.WsFederation.Tests/Functional/SigninTests.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,32 @@ | ||
using IdentityServer4.WsFederation.Server; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
|
||
namespace IdentityServer4.WsFederation.Tests.Functional | ||
{ | ||
[TestClass] | ||
public class SigninTests | ||
{ | ||
private readonly HttpClient _client; | ||
|
||
public SigninTests() | ||
{ | ||
var factory = new WebApplicationFactory<Program>(); | ||
_client = factory.CreateClient(); | ||
} | ||
|
||
[TestMethod] | ||
public async Task SigninWithNoContextRedirectsToLogin() | ||
{ | ||
var response = await _client.GetAsync("/wsfederation/signin?wa=wsignin1.0&wtrealm=urn:idsrv4:wsfed:sample"); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
|
||
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); | ||
Assert.AreEqual("/Account/Login", response.RequestMessage.RequestUri.LocalPath); | ||
StringAssert.Contains(content, "<h1>Login</h1>"); | ||
} | ||
} | ||
} |
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
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