コード例 #1
0
        public void TestOneOverwriteAndReadBack()
        {
            //build tables
            string prefix = RandomString(10);
            SqlServerDataStoreBuilder builder = new SqlServerDataStoreBuilder(prefix, _sqlConn);
            builder.BuildDataStore();

            //create one setting
            SqlServerDataStoreServices dataStoreServices = new SqlServerDataStoreServices(prefix, _sqlConn);
            string randomScope = RandomString(50);
            string randomSettingName = RandomString(50);
            dataStoreServices.Create(randomScope, randomSettingName, "1", "foo");

            //verify initial value
            var value = dataStoreServices.GetString(randomScope, randomSettingName, "1", "");
            Assert.AreEqual("foo", value);

            //change setting to something 
            dataStoreServices.Set(randomScope, randomSettingName, "1", "notfoo");
            value = dataStoreServices.GetString(randomScope, randomSettingName, "1", "");

            //verify it changed
            Assert.AreEqual("notfoo", value);
            
        }
コード例 #2
0
        public void TestSetNonExistent()
        {
            //build tables
            string prefix = RandomString(10);
            SqlServerDataStoreBuilder builder = new SqlServerDataStoreBuilder(prefix, _sqlConn);
            builder.BuildDataStore();

            //create one setting
            SqlServerDataStoreServices dataStoreServices = new SqlServerDataStoreServices(prefix, _sqlConn);
            string randomScope = RandomString(50);
            string randomSettingName = RandomString(50);
            
            dataStoreServices.Set(randomScope, randomSettingName, "1", "foo");
        }