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