Example #1
0
        public void ShouldInvokeMethodOfTypeVoidWithValidServiceCollection()
        {
            var testPlugin        = new EntityFrameworkCoreTestPlugin();
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddDbContext <CustomDbContext>(options => options.UseInMemoryDatabase(TestObjectFactory.TestDatabaseName));

            testPlugin.ServiceRegistrationDelegate(serviceCollection);

            var methodReturnType = testPlugin.ServiceRegistrationDelegate.Method.ReturnType.Name;

            Assert.True(methodReturnType == "Void");
            Assert.Contains(serviceCollection, s => s.ServiceType == typeof(DbContextOptions));
        }
Example #2
0
        public void ShouldThrowArgumentNullExceptionWithInvalidServiceCollection()
        {
            var testPlugin = new EntityFrameworkCoreTestPlugin();

            Assert.Throws <ArgumentNullException>(() => testPlugin.ServiceRegistrationDelegate(null));
        }