public override void TestFixtureSetUp() { base.TestFixtureSetUp(); connection.RunAsync(Query.DbCreate("test")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait(); testTable = Query.Db("test").Table <TestObject>("table1"); anotherTestTable = Query.Db("test").Table <AnotherTestObject>("table2"); firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName); connection.Run(firstNameIndex.IndexCreate()); connection.Run(firstNameIndex.IndexWait()); tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags); connection.Run(tagsIndex.IndexCreate()); connection.Run(tagsIndex.IndexWait()); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); connection.RunAsync(Query.DbCreate("test")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait(); testTable = Query.Db("test").Table<TestObject>("table1"); anotherTestTable = Query.Db("test").Table<AnotherTestObject>("table2"); firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName); connection.Run(firstNameIndex.IndexCreate()); connection.Run(firstNameIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags); connection.Run(tagsIndex.IndexCreate()); connection.Run(tagsIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); connection.RunAsync(Query.DbCreate("test")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait(); testTable = Query.Db("test").Table<TestObject>("table1"); anotherTestTable = Query.Db("test").Table<AnotherTestObject>("table2"); firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName); connection.Run(firstNameIndex.IndexCreate()); connection.Run(firstNameIndex.IndexWait()); tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags); connection.Run(tagsIndex.IndexCreate()); connection.Run(tagsIndex.IndexWait()); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); connection.RunAsync(Query.DbCreate("test")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table1")).Wait(); connection.RunAsync(Query.Db("test").TableCreate("table2")).Wait(); testTable = Query.Db("test").Table <TestObject>("table1"); anotherTestTable = Query.Db("test").Table <AnotherTestObject>("table2"); firstNameIndex = anotherTestTable.IndexDefine("index1", o => o.FirstName); connection.Run(firstNameIndex.IndexCreate()); connection.Run(firstNameIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed tagsIndex = testTable.IndexDefineMulti("indexTags", o => o.Tags); connection.Run(tagsIndex.IndexCreate()); connection.Run(tagsIndex.IndexWait()).ToArray(); // ToArray ensures that the IEnumerable is actually evaluated completely and the wait is completed }
public void IndexCreateMultiObjectModel() { var languages = new[] { new TestObject { Name = "C#", Tags = new[] { "dynamic", "lambdas", "object-oriented", "strongly-typed", "generics" } }, new TestObject { Name = "java", Tags = new[] { "object-oriented", "strongly-typed", "generics" } }, new TestObject { Name = "javascript", Tags = new[] { "dynamic" } } }; var resp = connection.Run(testTable.Insert(languages)); Assert.That(resp.Inserted, Is.EqualTo(3)); var index = testTable.IndexDefineMulti("index_tags", x => x.Tags); resp = connection.Run(index.IndexCreate()); Assert.That(resp.Created, Is.EqualTo(1)); connection.Run(index.IndexWait()); //and query var stronglyTyped = connection.Run(index.GetAll("strongly-typed")).ToArray(); Assert.That(stronglyTyped, Is.Not.Null); Assert.That(stronglyTyped.Length, Is.EqualTo(2)); Assert.That(stronglyTyped.All(x => x.Name != languages[2].Name)); }