public void TestResultMapperForDifferentTypeSameResult()
        {
            var engine = new ExecuteEngineConfig().ToEngine();

            var columns = new[]
            {
                new MockColumn(typeof(long), "Id"),
                new MockColumn(typeof(string), "Name")
            };

            var cmd = new MockDbCommand();

            cmd.SetupResult(new MockDataReader(columns, new List <object[]>()));
            cmd.SetupResult(new MockDataReader(columns, new List <object[]>()));

            engine.QueryBuffer <CacheEntity>(cmd);

            Assert.Equal(1, ((IEngineController)engine).Diagnostics.ResultMapperCacheCount);

            engine.QueryBuffer <Cache2Entity>(cmd);

            Assert.Equal(2, ((IEngineController)engine).Diagnostics.ResultMapperCacheCount);

            ((IEngineController)engine).ClearResultMapperCache();

            Assert.Equal(0, ((IEngineController)engine).Diagnostics.ResultMapperCacheCount);
        }
        public void CoverageFix()
        {
            var config = new ExecuteEngineConfig();

            Assert.Throws <ArgumentNullException>(() => config.SetServiceProvider(null));
            Assert.Throws <ArgumentNullException>(() => config.ConfigureComponents(null));
            Assert.Throws <ArgumentNullException>(() => config.ConfigureTypeMap(null));
            Assert.Throws <ArgumentNullException>(() => config.ConfigureTypeHandlers(null));
            Assert.Throws <ArgumentNullException>(() => config.ConfigureResultMapperFactories(null));

            var provider = new ComponentConfig().ToContainer();

            config.SetServiceProvider(provider);
            Assert.Equal(provider, ((IExecuteEngineConfig)config).GetServiceProvider());

            config.ConfigureComponents(components => { });
            Assert.NotEqual(provider, ((IExecuteEngineConfig)config).GetServiceProvider());
        }