Esempio n. 1
0
        public async Task SaveBoolean()
        {
            await CreateApplicationMasterAsync();

            await currentDirectory.SaveAsync("boolTrue", true);

            await currentDirectory.SaveAsync("boolFalse", false);

            await currentDirectory.SaveNullAsync("boolNull", ValueDataType.Bool);

            Assert.IsTrue((await currentDirectory.GetBooleanAsync("boolTrue")).Value);
            Assert.IsFalse((await currentDirectory.GetBooleanAsync("boolFalse")).Value);
            Assert.IsNull((await currentDirectory.GetBooleanAsync("boolNull")));
        }
Esempio n. 2
0
        public async Task SettingsPerObject()
        {
            await CreateApplicationMasterAsync();

            List <Setting> settings = new List <Setting>();

            settings.Add(new Setting {
                ObjectId = 0, Key = Util.RandomString(), Value = Util.RandomString()
            });
            settings.Add(new Setting {
                ObjectId = 1, Key = Util.RandomString(), Value = Util.RandomString()
            });

            await currentDirectory.SaveAsync(settings);


            currentDirectory = await settingsManager.OpenDirectoryAsync(currentApplicationName, currentDirectory.Name);

            Assert.IsTrue(currentDirectory.Items.Count() == 2);

            currentDirectory.ObjectID = 1;
            Assert.IsTrue(currentDirectory.Items.Count() == 1);


            await currentDirectory.SaveAsync("test", "tst");

            Assert.IsTrue(currentDirectory.Items.Count() == 2);

            Assert.IsTrue(currentDirectory.Items.All(i => i.ObjectId == 1));
        }
Esempio n. 3
0
        public async Task CopyDirectoryMasterAsync()
        {
            await CreateDirectoryMasterAsync();

            try
            {
                string newName = Util.RandomString();

                string directoryDescription = currentDirectory.Description;

                string settingsKey  = "Sample";
                bool   settingValue = true;

                await currentDirectory.SaveAsync(settingsKey, settingValue);

                await settingsManager.CopyDirectoryAsync(currentApplicationName, currentDirectory.Name, newName);

                currentDirectory = await settingsManager.OpenDirectoryAsync(currentApplicationName, newName);

                Assert.AreEqual(newName, currentDirectory.Name);
                Assert.AreEqual(directoryDescription, currentDirectory.Description);
                Assert.IsTrue(await currentDirectory.Exists(settingsKey));
                Assert.IsTrue((await currentDirectory.GetBooleanAsync(settingsKey)).Value);
            }
            catch (SettingsException ex)
            {
                Assert.Fail(ex.Message);
            }
        }