public void UseEntityFrameworkCore_ThrowsAnExceptionForNullConfiguration()
        {
            // Arrange
            var services = new ServiceCollection();
            var builder  = new BpmNetCoreBuilder(services);

            // Act and assert
            var exception = Assert.Throws <ArgumentNullException>(() => builder.UseEntityFrameworkCore(configuration: null));

            Assert.Equal("configuration", exception.ParamName);
        }
        public void UseEntityFrameworkCore_RegistersCachingServices()
        {
            // Arrange
            var services = new ServiceCollection();
            var builder  = new BpmNetCoreBuilder(services);

            // Act
            builder.UseEntityFrameworkCore();

            // Assert
            Assert.Contains(services, service => service.ServiceType == typeof(IMemoryCache));
        }
        public void UseEntityFrameworkCore_RegistersEntityFrameworkCoreStore(Type type)
        {
            // Arrange
            var services = new ServiceCollection();
            var builder  = new BpmNetCoreBuilder(services);

            // Act
            builder.UseEntityFrameworkCore();

            // Assert
            Assert.Contains(services, service => service.ServiceType == type && service.ImplementationType == type);
        }
        public void UseEntityFrameworkCore_RegistersDefaultEntities()
        {
            // Arrange
            var services = new ServiceCollection().AddOptions();
            var builder  = new BpmNetCoreBuilder(services);

            // Act
            builder.UseEntityFrameworkCore(opt => { });

            // Assert
            var provider = services.BuildServiceProvider();
            var options  = provider.GetRequiredService <IOptionsMonitor <BpmNetCoreOptions> >().CurrentValue;

            Assert.Equal(typeof(BpmNetDefinition), options.DefaultDefinitionType);
            Assert.Equal(typeof(BpmNetProcessInstance), options.DefaultProcessInstanceType);
            Assert.Equal(typeof(BpmNetInstanceFlow), options.DefaultProcessInstanceFlowType);
            Assert.Equal(typeof(BpmNetHistory), options.DefaultHistoryFlowType);
        }