Data Type Object Class for the representation of a belief that the asset has about a property of the world
        private void addOrEditBeliefButton_Click(object sender, EventArgs e)
        {
            //clear errors
            addBeliefErrorProvider.Clear();
            var newBelief = new BeliefDTO
            {
                Name = this.beliefNameTextBox.Text.Trim(),
                Perspective = this.beliefVisibilityComboBox.Text,
                Value = this.beliefValueTextBox.Text.Trim()
            };

            try
            {
                if (_beliefToEdit != null)
                {
                    _knowledgeBaseVm.RemoveBeliefs(new[] {_beliefToEdit});
                    _knowledgeBaseVm.AddBelief(newBelief);
                    this.Close();
                }
                else
                {
                    _knowledgeBaseVm.AddBelief(newBelief);
                }
            }
            catch (Exception ex)
            {
                addBeliefErrorProvider.SetError(beliefNameTextBox, ex.Message);
                if (_beliefToEdit != null)
                {
                    _knowledgeBaseVm.AddBelief(_beliefToEdit);
                }
                return;
            }
        }
 public void AddBelief(BeliefDTO belief)
 {
     if (emotionalAppraisalAsset.BeliefExists(belief.Name))
     {
         throw new Exception(Resources.BeliefAlreadyExistsExceptionMessage);
     }
     emotionalAppraisalAsset.AddOrUpdateBelief(belief);
     Beliefs.DataSource.Add(belief);
     Beliefs.Refresh();
     _mainForm.SetModified();
 }
        public AddOrEditBeliefForm(KnowledgeBaseVM kbVM, BeliefDTO beliefToEdit = null)
        {
            InitializeComponent();

            _knowledgeBaseVm = kbVM;
            _beliefToEdit = beliefToEdit;

            //Default Values
            beliefVisibilityComboBox.DataSource = KnowledgeBaseVM.KnowledgeVisibilities;
            beliefVisibilityComboBox.SelectedIndex = 0;

            if (beliefToEdit != null)
            {
                this.Text = Resources.AddOrEditBeliefForm_AddOrEditBeliefForm_Edit_Belief;
                this.addOrEditBeliefButton.Text = Resources.AddOrEditBeliefForm_AddOrEditBeliefForm_Update;

                beliefNameTextBox.Text = beliefToEdit.Name;
                beliefValueTextBox.Text = beliefToEdit.Value;
                beliefVisibilityComboBox.Text = beliefToEdit.Perspective;
            }
        }
        public static void Test_Conferrals(string name, string expectedResult)
        {
            var n = new BeliefDTO()
            {
                Name = $"AskedDrink({name})",
                Perspective = "Self",
                Value = "true"
            };
            ASSET_TO_TEST.LinkedEA.AddOrUpdateBelief(n);
            var a = ASSET_TO_TEST.DecideConferral(Name.SELF_STRING);
            ASSET_TO_TEST.LinkedEA.RemoveBelief($"AskedDrink({name})","self");

            if (string.IsNullOrEmpty(expectedResult))
            {
                if(a==null)
                    Assert.Pass();
                else
                    Assert.Fail();
            }

            var an = (Name)expectedResult;
            Assert.AreEqual(an, a.ToNameRepresentation());
        }