Ejemplo n.º 1
0
        public void TestIndexConfigBuilder()
        {
            string indexName = "indexName";

            string[] indexedColumns  = { "idx1" };
            string[] includedColumns = { "inc1", "inc2", "inc3" };

            Builder builder = IndexConfig.Builder();

            builder.IndexName(indexName);
            builder.Include(includedColumns[0], includedColumns[1], includedColumns[2]);
            builder.IndexBy(indexedColumns[0]);

            // Validate that the config was built correctly.
            IndexConfig config = builder.Create();

            Assert.Equal(indexName, config.IndexName);
            Assert.Equal(indexedColumns, config.IndexedColumns);
            Assert.Equal(includedColumns, config.IncludedColumns);
        }
Ejemplo n.º 2
0
        public void TestSignatures()
        {
            string indexName   = "testIndexName";
            var    indexConfig = new IndexConfig(indexName, new[] { "Id" }, new string[] { });

            Assert.IsType <string>(indexConfig.IndexName);
            Assert.IsType <List <string> >(indexConfig.IndexedColumns);
            Assert.IsType <List <string> >(indexConfig.IncludedColumns);
            Assert.IsType <Builder>(IndexConfig.Builder());
            Assert.IsType <bool>(indexConfig.Equals(indexConfig));
            Assert.IsType <int>(indexConfig.GetHashCode());
            Assert.IsType <string>(indexConfig.ToString());

            Builder builder = IndexConfig.Builder();

            Assert.IsType <Builder>(builder);
            Assert.IsType <Builder>(builder.IndexName("indexName"));
            Assert.IsType <Builder>(builder.IndexBy("indexed1", "indexed2"));
            Assert.IsType <Builder>(builder.Include("included1"));
            Assert.IsType <IndexConfig>(builder.Create());
        }