public void AddAuthorizationStore_ThrowsAnExceptionForInvalidStore() { // Arrange var services = new ServiceCollection(); services.AddOptions(); var builder = new OpenIddictBuilder(services); builder.AuthorizationType = typeof(object); // Act and assert var exception = Assert.Throws <InvalidOperationException>(() => builder.AddAuthorizationStore(typeof(object))); Assert.Equal("The specified type is invalid.", exception.Message); }
public void AddAuthorizationStore_OverridesDefaultManager() { // Arrange var services = new ServiceCollection(); services.AddOptions(); var builder = new OpenIddictBuilder(services); builder.AuthorizationType = typeof(object); var type = Mock.Of <IOpenIddictAuthorizationStore <object> >().GetType(); // Act builder.AddAuthorizationStore(type); var provider = services.BuildServiceProvider(); var store = provider.GetRequiredService <IOpenIddictAuthorizationStore <object> >(); // Assert Assert.IsType(type, store); }