public void ServerFromXElementInvalid() { var element = new XElement("Server"); element.Add(new XAttribute("type", "incorrectType")); element.Add(new XElement("Guid", "f1287c12-1cf3-45b3-ac29-5bfce34b2145")); element.Add(new XElement("ClientId", "myspecialClientId")); element.Add(new XElement("ClientSharedSecret", "acsecret123")); element.Add(new XElement("Scopes", new XElement("Scope", "foobar"))); element.Add(new XElement("AuthorizationUri", "http://example.com/anotherfunnyUri")); element.Add(new XElement("AccessTokenUri", "http://example.com/anotherfunnyUri2")); element.Add(new XElement("RedirectionUri", "http://example.com/behappy")); var server = ServerWithAuthorizationCode.FromXElement(element); }
public void ServerFromXElement() { var element = new XElement("Server"); element.Add(new XAttribute("type", "AuthorizationCode")); element.Add(new XElement("Guid", "f1287c12-1cf3-45b3-ac29-5bfce34b2145")); element.Add(new XElement("ClientId", "myspecialClientId")); element.Add(new XElement("ClientSharedSecret", "acsecret123")); element.Add(new XElement("Scopes", new XElement("Scope", "foobar"))); element.Add(new XElement("AuthorizationUri", "http://example.com/anotherfunnyUri")); element.Add(new XElement("AccessTokenUri", "http://example.com/anotherfunnyUri2")); element.Add(new XElement("RedirectionUri", "http://example.com/behappy")); var server = ServerWithAuthorizationCode.FromXElement(element); server.ClientId.Should().Be("myspecialClientId"); server.ClientSharedSecret.Should().Be("acsecret123"); server.Guid.ToString().Should().Be("f1287c12-1cf3-45b3-ac29-5bfce34b2145"); server.AuthorizationRequestUri.ToString().Should().Be("http://example.com/anotherfunnyUri"); server.AccessTokenRequestUri.ToString().Should().Be("http://example.com/anotherfunnyUri2"); server.RedirectionUri.ToString().Should().Be("http://example.com/behappy"); server.Scopes.FirstOrDefault(item => item == "foobar").Should().NotBeNull(); }