Skip to content

Commit

Permalink
Fixed code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersAbel committed Feb 20, 2016
1 parent 8e1b8ec commit f09b7e0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions Kentor.AuthServices.Tests/WebSSO/HttpRequestDataTests.cs
Expand Up @@ -32,6 +32,7 @@ public void HttpRequestData_Ctor_FromParamsCalculatesApplicationUrl()
subject.ApplicationUrl.Should().Be(new Uri("http://example.com:42/ApplicationPath"));
}

[TestMethod]
public void HttpRequestData_EscapeBase64CookieValue_Nullcheck()
{
Action a = () => HttpRequestData.EscapeBase64CookieValue(null);
Expand Down
21 changes: 21 additions & 0 deletions Kentor.AuthServices.Tests/WebSSO/LogoutCommandTests.cs
Expand Up @@ -506,5 +506,26 @@ public void LogoutCommand_Run_LocalLogoutIfThereIsNoSigninCertificateForTheSP()

LogoutCommand_Run_LocalLogout();
}

[TestMethod]
public void LogoutCommand_Run_ThrowsOnUnknownMessageRecevied()
{
var msg = new Saml2MessageImplementation
{
MessageName = "SAMLRequest",
SigningCertificate = SignedXmlHelper.TestCert,
DestinationUrl = new Uri("http://localhost"),
XmlData = $"<Unknown><Issuer xmlns=\"{Saml2Namespaces.Saml2Name}\">https://idp.example.com</Issuer></Unknown>"
};

var url = Saml2Binding.Get(Saml2BindingType.HttpRedirect)
.Bind(msg).Location;

var request = new HttpRequestData("GET", url);

CommandFactory.GetCommand(CommandFactory.LogoutCommandName)
.Invoking(c => c.Run(request, StubFactory.CreateOptions()))
.ShouldThrow<NotImplementedException>();
}
}
}
7 changes: 6 additions & 1 deletion Kentor.AuthServices.Tests/WebSSO/Saml2BindingTests.cs
Expand Up @@ -116,7 +116,12 @@ public void Saml2Binding_Get_NullOnPlainPost()
}

class ConcreteSaml2Binding : Saml2Binding
{ }
{
protected internal override bool CanUnbind(HttpRequestData request)
{
throw new NotImplementedException();
}
}

[TestMethod]
public void Saml2Binding_Bind_IsNotImplemented()
Expand Down
5 changes: 1 addition & 4 deletions Kentor.AuthServices/WebSSO/Saml2Binding.cs
Expand Up @@ -105,10 +105,7 @@ public virtual UnbindResult Unbind(HttpRequestData request, IOptions options)
/// </summary>
/// <param name="request">HttpRequest to check for message.</param>
/// <returns>True if the binding supports the current request.</returns>
protected internal virtual bool CanUnbind(HttpRequestData request)
{
return false;
}
protected internal abstract bool CanUnbind(HttpRequestData request);

private static readonly IDictionary<Saml2BindingType, Saml2Binding> bindings =
new Dictionary<Saml2BindingType, Saml2Binding>()
Expand Down

0 comments on commit f09b7e0

Please sign in to comment.