public async Task Assertions() { Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(null, null, null, null)); var sessionsMock = new Mock <IAsyncDocumentSession>().Object; Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(sessionsMock, null, null, null)); var serializerMock = new Mock <IAuthenticationSchemeOptionsSerializer>().Object; Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(sessionsMock, serializerMock, null, null)); var eventHandlerMock = new Mock <IDynamicProviderUpdatedEventHandler>().Object; Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(sessionsMock, serializerMock, eventHandlerMock, null)); var loggerMock = new Mock <ILogger <DynamicProviderStore <SchemeDefinition> > >().Object; var store = new DynamicProviderStore <SchemeDefinition>(sessionsMock, serializerMock, eventHandlerMock, loggerMock); await Assert.ThrowsAsync <ArgumentNullException>(() => store.AddAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.UpdateAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.RemoveAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(" ")); }
public async Task Assertions() { Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(null, null, null)); var databaseMock = new Mock <IDatabase>().Object; Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(databaseMock, null, null)); Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(databaseMock, new SchemeDefinitionSerializer <SchemeDefinition>(), null)); var loggerMock = new Mock <ILogger <DynamicProviderStore <SchemeDefinition> > >().Object; var store = new DynamicProviderStore <SchemeDefinition>(databaseMock, new SchemeDefinitionSerializer <SchemeDefinition>(), loggerMock); await Assert.ThrowsAsync <ArgumentNullException>(() => store.AddAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.UpdateAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.RemoveAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(" ")); }
public async Task Assertions() { Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(null, null, null)); var contextMock = new SchemeDbContext <SchemeDefinition>(new FakeDbContextOptions()); Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(contextMock, null, null)); Assert.Throws <ArgumentNullException>(() => new DynamicProviderStore <SchemeDefinition>(contextMock, new AuthenticationSchemeOptionsSerializer(), null)); var loggerMock = new Mock <ILogger <DynamicProviderStore <SchemeDefinition> > >().Object; var store = new DynamicProviderStore <SchemeDefinition>(contextMock, new AuthenticationSchemeOptionsSerializer(), loggerMock); await Assert.ThrowsAsync <ArgumentNullException>(() => store.AddAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.UpdateAsync(null)); await Assert.ThrowsAsync <ArgumentNullException>(() => store.RemoveAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(null)); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync("")); await Assert.ThrowsAsync <ArgumentException>(() => store.FindBySchemeAsync(" ")); }