public void EntityDescriptorExtensions_ToXElement_Nodes() { EntityId entityId = new EntityId("http://dummyentityid.com"); var entityDescriptor = new EntityDescriptor(entityId); var spsso = new ServiceProviderSingleSignOnDescriptor(); string sampleAcsUri = "https://some.uri.example.com/acs"; var acs = new IndexedProtocolEndpoint() { IsDefault = false, Index = 17, Binding = Saml2Binding.HttpPostUri, Location = new Uri(sampleAcsUri) }; spsso.AssertionConsumerServices.Add(1, acs); entityDescriptor.RoleDescriptors.Add(spsso); var rootName = Saml2Namespaces.Saml2Metadata + "EntityDescriptor"; var elementName = Saml2Namespaces.Saml2Metadata + "SPSSODescriptor"; var subject = entityDescriptor.ToXElement(); subject.Name.Should().Be(rootName); subject.Elements().Single().Name.Should().Be(elementName); subject.Attribute("entityId").Value.Should().Be("http://dummyentityid.com"); }
public void SPOptionsExtensions_CreateMetadata_IncludeDiscoveryServiceResponse() { var spOptions = StubFactory.CreateSPOptions(); var urls = StubFactory.CreateAuthServicesUrls(); spOptions.DiscoveryServiceUrl = new Uri("http://ds.example.com"); var subject = spOptions.CreateMetadata(urls).Extensions.DiscoveryResponse; var expected = new IndexedProtocolEndpoint { Binding = Saml2Binding.DiscoveryResponseUri, Index = 0, IsDefault = true, Location = urls.SignInUrl }; subject.ShouldBeEquivalentTo(expected); }