public void ShouldThrowWhenAppBuilderIsNull() { // Arrange options = new GooglePlusAuthenticationOptions(); // Act Action action = () => appBuilder.UseGooglePlusAuthentication(options); // Assert action.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("app"); }
public static IAppBuilder UseGooglePlusAuthentication(this IAppBuilder app, GooglePlusAuthenticationOptions options) { if (app == null) throw new ArgumentNullException("app"); if (options == null) throw new ArgumentNullException("options"); app.Use(typeof(GooglePlusAuthenticationMiddleware), app, options); return app; }
public void ConstructorShouldThrowWhenClientSecretIsNull() { // Arrange var options = new GooglePlusAuthenticationOptions { ClientId = ClientId, ClientSecret = null }; // Act Action action = () => new GooglePlusAuthenticationMiddleware(null, appBuilder, options); // Assert action.ShouldThrow<ArgumentException>(); }