forked from Sustainsys/Saml2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetadataTests.cs
48 lines (39 loc) · 1.26 KB
/
MetadataTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FluentAssertions;
using System.Xml.Linq;
namespace Kentor.AuthServices.IntegrationTests
{
[TestClass]
public class MetadataTests
{
[TestMethod]
public void Metadata_GetMetadata_Saml2AuthenticationModule()
{
var url = "http://localhost:17009/SamplePath/AuthServices/";
TestMetadata(url);
}
private static void TestMetadata(string url)
{
var client = new WebClient();
var metadata = client.DownloadString(url);
var mimeType = client.ResponseHeaders["Content-Type"];
mimeType.Should().Contain("application/samlmetadata+xml");
XDocument.Parse(metadata).Root.Name.Should()
.Be(XNamespace.Get("urn:oasis:names:tc:SAML:2.0:metadata") + "EntityDescriptor");
}
[TestMethod]
public void Metadata_GetMetadata_Mvc()
{
var url = "http://localhost:2181/AuthServices/";
TestMetadata(url);
}
[TestMethod]
public void Metadata_GetMetadata_Owin()
{
var url = "http://localhost:57294/AuthServices";
TestMetadata(url);
}
}
}