/// <inheritdoc />
        public ICreateGiSTIndexOptionsSyntax Buffering(GistBuffering buffering)
        {
            var additionalFeatures = CreateIndexOptionsSyntax as ISupportAdditionalFeatures;

            additionalFeatures.SetAdditionalFeature(PostgresExtensions.IndexBuffering, buffering);
            return(this);
        }
예제 #2
0
        public virtual void CanCreateIndexWithBuffering(GistBuffering buffering)
        {
            var expression = GetCreateIndexWithExpression(x =>
            {
                x.Index.GetAdditionalFeature(PostgresExtensions.IndexBuffering, () => buffering);
            });

            Assert.Throws <NotSupportedException>(() => Generator.Generate(expression));
        }
        public override void CanCreateIndexWithBuffering(GistBuffering buffering)
        {
            var expression = GetCreateIndexWithExpression(x =>
            {
                x.Index.GetAdditionalFeature(PostgresExtensions.IndexBuffering, () => buffering);
            });

            var result = Generator.Generate(expression);

            result.ShouldBe($"CREATE INDEX \"TestIndex\" ON \"public\".\"TestTable1\" (\"TestColumn1\" ASC) WITH ( BUFFERING = {buffering.ToString().ToUpper()} );");
        }
예제 #4
0
        public void CallingWithBufferingInPostgres(GistBuffering buffering)
        {
            var additionalFeatures = new Dictionary <string, object>();

            var indexMock = new Mock <IndexDefinition>();

            indexMock.Setup(x => x.AdditionalFeatures).Returns(additionalFeatures);

            var expressionMock = new Mock <CreateIndexExpression>();

            expressionMock.SetupGet(e => e.Index).Returns(indexMock.Object);

            ICreateIndexOnColumnOrInSchemaSyntax builder = new CreateIndexExpressionBuilder(expressionMock.Object);

            builder.WithOptions().UsingGist().Buffering(buffering);
            indexMock.VerifyGet(x => x.AdditionalFeatures);
            expressionMock.VerifyGet(e => e.Index);

            Assert.AreEqual(buffering, additionalFeatures[PostgresExtensions.IndexBuffering]);
        }