Ejemplo n.º 1
0
        public void TestBuildTables()
        {
            //create random prefix
            string prefix = RandomString(10);

            SqlServerDataStoreBuilder builder = new SqlServerDataStoreBuilder(prefix, _sqlConn);
            //call Validate() method
            var isValid = builder.IsDataStoreValid();

            //see that it's false
            Assert.IsFalse(isValid);

            //build tables afterwards
            builder.BuildDataStore();

            //re-validate second time
            isValid = builder.IsDataStoreValid();
            //see that it's now true
            Assert.IsTrue(isValid);
            
            //test setting value to the parameter
            SqlServerDataStoreServices dataStoreServices = new SqlServerDataStoreServices(prefix, _sqlConn);
            string randomScope = RandomString(50);
            string randomSettingName = RandomString(50);
            var exists = dataStoreServices.Exists(randomScope, randomSettingName);
            //check that the setting exists
            Assert.IsFalse(exists);

            dataStoreServices.Create(randomScope, randomSettingName, "1", "foo");
            //retrieve the value
            var settingValue = dataStoreServices.GetString(randomScope, randomSettingName, "1", "notfoo");
            Assert.AreEqual("foo", settingValue);
        }
Ejemplo n.º 2
0
        public void TestTablesExists()
        {
            //create random prefix
            string prefix = RandomString(10);
            
            SqlServerDataStoreBuilder builder = new SqlServerDataStoreBuilder(prefix, _sqlConn);
            //call Validate() method
            var isValid = builder.IsDataStoreValid();

            //see that it's false
            Assert.IsFalse(isValid);
        }