コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: tomnolan/papyruscs
        public void ParameterTest(int columns, int rows, int expectedParameterCount, int expectedBatchSize, int expectedRemainderBatchsize)
        {
            DbContextOptionsBuilder<MyContext> opt = new DbContextOptionsBuilder<MyContext>();
            opt.UseSqlite("Filename=testparameter.sqlite");

            var context = new MyContext(opt.Options);

            var (dbParameters, batchSize, remainder) = DbContextExtensions.GetInsertParametersAndBatchSize(context, columns, rows);

            Assert.That(dbParameters.Length, Is.EqualTo(expectedParameterCount));
            Assert.That(batchSize, Is.EqualTo(expectedBatchSize));
            Assert.That(remainder, Is.EqualTo(expectedRemainderBatchsize));
            Assert.That(dbParameters[0].ParameterName, Is.EqualTo("p0"));
            Assert.That(dbParameters[dbParameters.Length-1].ParameterName, Is.EqualTo("p"+(dbParameters.Length-1)));
        }