Пример #1
0
        public void TestBasicConnection() {
            IDriver driver = new SqLiteDriver() {
                Settings = new DriverSettings() {
                    Memory = true
                }
            };

            Assert.IsTrue(driver.Connect());

            driver.Close();
        }
Пример #2
0
        /// <summary>
        /// Tests a query on an in memory sql lite
        /// </summary>
        /// <param name="setup">A list of queries to run prior to running a find query</param>
        /// <param name="query"></param>
        /// <param name="expected"></param>
        public void TestFindQuery(IEnumerable<IDatabaseObject> setup, IDatabaseObject query, JArray expected) {
            IDriver driver = new SqLiteDriver() {
                Settings = new DriverSettings() {
                    Memory = true
                }
            };

            driver.Connect();

            foreach (var item in setup) {
                driver.Query(item);
            }

            List<IDatabaseObject> results = driver.Query(query);

            Assert.AreEqual(expected.ToString(Formatting.None), ((CollectionValue)results.First()).ToJArray().ToString(Formatting.None));

            driver.Close();
        }
Пример #3
0
        public void TestMethod4() {
            IDriver driver = new SqLiteDriver() {
                Settings = new DriverSettings() {
                    Database = "test_connection"
                }
            };

            driver.Connect();

            /*
            driver.Query(
                new Save()
                .Collection("player")
                .Assignment("Name", "Phogue")
                .Assignment("Rank", 10)
                .Assignment("Score", 50)
            );
            */

            //CollectionValue result = driver.Query(new Create().Collection("Player").Field("Name").Field("Score").Index("player", "Name")) as CollectionValue;


            List<IDatabaseObject> result = driver.Query(new Find().Collection("Player").Condition("Score", 100));

            JArray array = ((CollectionValue)result.First()).ToJArray();

            driver.Close();
        }