Exemplo n.º 1
0
        public void CreateIndexesAliasNameTest(string indexName, SearchCategory searchCategory, string expected)
        {
            var _sut   = new IndexNameCreator();
            var actual = _sut.CreateIndexesAliasName(indexName, searchCategory);

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 2
0
        public void CreateNewIndexNameTest()
        {
            var _sut     = new IndexNameCreator();
            var actual   = _sut.CreateNewIndexName("local_das_support", SearchCategory.User);
            var expected = $"local_das_support-user_{DateTime.UtcNow.ToString("yyyyMMddHHmmss").ToLower()}";

            Assert.AreEqual(expected, actual);
        }
        private static IndexAnnotation CreateIndexAnnotation(string tableName, string propertyName, int count)
        {
            var indexName = IndexNameCreator.CreateName(tableName, propertyName);

            // If there are two Indicies on the same property, the count is added.
            // In SQLite an Index name must be global unique.
            // To be honest, it should never happen. But because its possible by using the API, it should be covered.
            if (count > 0)
            {
                indexName = String.Format(CultureInfo.InvariantCulture, "{0}_{1}", indexName, count);
            }

            var indexAttribute = new IndexAttribute(indexName);

            return(new IndexAnnotation(indexAttribute));
        }
Exemplo n.º 4
0
        public void CreateIndexName()
        {
            string result = IndexNameCreator.CreateIndexName("MyTable", "MyProperty");

            Assert.AreEqual("\"IX_MyTable_MyProperty\"", result);
        }
        public void CreateIndexNameEscaped()
        {
            string result = IndexNameCreator.CreateName("\"base.MyTable\"", "MyProperty");

            Assert.AreEqual("\"IX_base.MyTable_MyProperty\"", result);
        }
 private string GetIndexName(IndexAttribute index, EdmProperty property)
 {
     return(index.Name == null?IndexNameCreator.CreateName(entitySet.ElementType.GetTableName(), property.Name) : NameCreator.EscapeName(index.Name));
 }