public void ThrowsNullArgumentExceptionForNullSpecimenContext() { var databaseName = Guid.NewGuid().ToString(); var builder = new InMemoryOptionsBuilder(databaseName); Action act = () => builder.Create(typeof(DbContextOptions <TestDbContext>), null); act.Should().ThrowExactly <ArgumentNullException>(); }
public void ReturnsNoSpecimenForNonOptionsRequest(object request) { var databaseName = Guid.NewGuid().ToString(); var contextMock = new Mock <ISpecimenContext>(); var builder = new InMemoryOptionsBuilder(databaseName); var actual = builder.Create(request, contextMock.Object); actual.Should().BeOfType <NoSpecimen>(); }
public void ReturnsOptionsInstanceWithExpectedProvider() { var databaseName = Guid.NewGuid().ToString(); var contextMock = new Mock <ISpecimenContext>(); var builder = new InMemoryOptionsBuilder(databaseName); var actual = builder.Create(typeof(DbContextOptions <TestDbContext>), contextMock.Object); actual.As <DbContextOptions <TestDbContext> >() .Extensions.Should().Contain(x => x.GetType() == typeof(InMemoryOptionsExtension)); }
public void ReturnsRequestedDbContextOptionsInstance() { var databaseName = Guid.NewGuid().ToString(); var contextMock = new Mock <ISpecimenContext>(); var builder = new InMemoryOptionsBuilder(databaseName); var actual = builder.Create(typeof(DbContextOptions <TestDbContext>), contextMock.Object); actual.Should().NotBeNull() .And.Subject.Should().BeOfType <DbContextOptions <TestDbContext> >(); }