Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        private async Task <bool> ValidateInputAsync()
        {
            if (string.IsNullOrWhiteSpace(textKey.Text))
            {
                textKey.ErrorText = "Enter a Name";
                return(false);
            }
            else
            {
                if (textObjectId.EditValue == null)
                {
                    textObjectId.ErrorText = "Invalid ObjectId";
                    return(false);
                }

                if (setting == null && await directory.Exists(int.Parse(textObjectId.Text), textKey.Text))
                {
                    textKey.ErrorText = "A Setting Key with this name already in exist";
                    return(false);
                }

                if (setting == null)
                {
                    setting = new Setting();
                }

                if (!Editor.ValidateValue())
                {
                    return(false);
                }

                setting.Value     = Editor.Value;
                setting.ValueType = Editor.ValueType;
                setting.Info      = textInfo.Text;
                setting.ObjectId  = int.Parse(textObjectId.Text);
                setting.Key       = textKey.Text.Trim();

                return(true);
            }
        }
Ejemplo 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);
            }
        }