Skip to content

Commit

Permalink
Test that AuthenticationRequestCreated notification is called.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersAbel committed Apr 27, 2016
1 parent 6d60f39 commit c9b4bbd
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions Kentor.AuthServices.Tests/WebSSO/SignInCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,39 +178,23 @@ public void SignInCommand_Run_NullcheckOptions()
}

[TestMethod]
public void SignInCommand_Run_With_SingleScopingProvider_Works()
public void SignInCommand_Run_Calls_AuthenticationRequestCreated_Notification()
{
//var idp = Options.FromConfiguration.IdentityProviders.Default;

//idp.ScopingProvider = new SingleSaml2ScopingProvider(new Saml2Scoping(new List<Saml2IdPEntry>(), 0, new List<Saml2RequesterId>()));

//var request = new HttpRequestData("GET",
// new Uri("http://sp.example.com?idp=" + Uri.EscapeDataString(idp.EntityId.Id)));

//var options = Options.FromConfiguration;
//options.Notifications.AuthenticationRequestCreated = (a, b, c) => { a.Scoping = b.ScopingProvider.GetScoping(a, c); };

//new SignInCommand().Run(request, options);
Assert.Inconclusive();
}

[TestMethod]
public void SignInCommand_Run_With_ScopingProvider_IsCalled()
{
//var idp = Options.FromConfiguration.IdentityProviders.Default;
//var scopingProvider = Substitute.For<ISaml2ScopingProvider>();
//idp.ScopingProvider = scopingProvider;
var options = StubFactory.CreateOptions();
var idp = options.IdentityProviders.Default;
options.SPOptions.DiscoveryServiceUrl = null;

var request = new HttpRequestData("GET",
new Uri("http://sp.example.com"));

//var request = new HttpRequestData("GET",
// new Uri("http://sp.example.com?idp=" + Uri.EscapeDataString(idp.EntityId.Id)));
var called = false;

//var options = Options.FromConfiguration;
//options.Notifications.AuthenticationRequestCreated = (a, b, c) => { a.Scoping = b.ScopingProvider.GetScoping(a, c); };
options.Notifications.AuthenticationRequestCreated =
(a, b, c) => { called = true; };

//new SignInCommand().Run(request, options);
new SignInCommand().Run(request, options);

//scopingProvider.Received().GetScoping(Arg.Any<Saml2AuthenticationRequest>(), Arg.Any<IDictionary<string, string>>());
Assert.Inconclusive();
called.Should().BeTrue("The notification should have been called");
}
}
}

0 comments on commit c9b4bbd

Please sign in to comment.