Пример #1
0
		public UpdateOptionValueAction(ActionUpdateOptionValue actionItem, ContextEnum context)
		{
			try
			{
				if (string.IsNullOrEmpty(actionItem.Name) ||
					string.IsNullOrEmpty(actionItem.Type) ||
					string.IsNullOrEmpty(actionItem.Value) ||
					string.IsNullOrEmpty(actionItem.NewValue)) 
				{
					return;
				}
			
				Name = actionItem.Name;
				Type = actionItem.Type;
				Value = actionItem.Value;
				NewValue = actionItem.NewValue;
				Context = context;
			}
			catch (Exception ex)
			{
				Logger.LogError(ex, "Exception in setting UpdateOptionValueAction members.");
			}
		}
Пример #2
0
		public void TestUpdateOptionValueActionUser()
		{
			OptionApi.SetString("DefaultDocumentProvider", "Interwoven 8");
			
			ActionUpdateOptionValue actionItem = new ActionUpdateOptionValue();
			actionItem.Name = "DefaultDocumentProvider";
			actionItem.Type = "string";
			actionItem.Value = "Interwoven 8";
			actionItem.NewValue = "Interwoven";

			UpdateOptionValueAction action = new UpdateOptionValueAction(actionItem, ContextEnum.User);
			action.Execute();

			string value = OptionApi.GetString("DefaultDocumentProvider");
			
			Assert.IsTrue(string.Compare(value.ToLower(), "interwoven") == 0);
		}