Beispiel #1
0
        public void Test_CIF_SE_ToString()
        {
            var cif      = BuildCIFAsset();
            var se       = cif.GetAllSocialExchanges().First(x => x.Name == (Name)"Flirt");
            var toString = new SocialExchange(se).ToString();

            Assert.IsTrue(toString.Contains("Flirt"));
        }
Beispiel #2
0
        private void influenceRules_Click(object sender, EventArgs e)
        {
            var selectedRule = EditorTools.GetSelectedDtoFromTable <SocialExchangeDTO>(gridSocialExchanges);
            var newSE        = new SocialExchange(selectedRule);
            var diag         = new InfluenceRuleInspector(_loadedAsset, newSE);

            diag.ShowDialog(this);
            _loadedAsset.UpdateSocialExchange(newSE.ToDTO);
            _socialExchangeList.DataSource = _loadedAsset.GetAllSocialExchanges().ToList();
        }
Beispiel #3
0
        public void Test_CIF_SE_AddStartingCondition()
        {
            var cif = BuildCIFAsset();

            var seDTO            = cif.GetAllSocialExchanges().First(x => x.Name == (Name)"Flirt");
            var se               = new SocialExchange(seDTO);
            var totalCondsBefore = se.StartingConditions.Count;

            se.AddStartingCondition(Condition.Parse("[x] != Start"));

            Assert.AreEqual((totalCondsBefore + 1), se.StartingConditions.Count);
        }
Beispiel #4
0
        public void Test_CIF_SE_RemoveStartingCondition()
        {
            var cif = BuildCIFAsset();


            var seDTO = cif.GetAllSocialExchanges().First(x => x.Name == (Name)"Flirt");
            var se    = new SocialExchange(seDTO);

            var originalCount = se.StartingConditions.Count();

            se.RemoveStartingCondition(Condition.Parse("Has(Floor) = SELF"));

            Assert.AreEqual(se.StartingConditions.Count, originalCount - 1);
        }
Beispiel #5
0
        public void Test_CIF_SE_AddInfluenceRule()
        {
            var cif = BuildCIFAsset();

            var seDTO            = cif.GetAllSocialExchanges().First(x => x.Name == (Name)"Flirt");
            var se               = new SocialExchange(seDTO);
            var totalCondsBefore = se.InfluenceRules.Count;

            se.InfluenceRules.Add(new InfluenceRule(new InfluenceRuleDTO()
            {
                Value = 2,
                Rule  = new Conditions.DTOs.ConditionSetDTO()
            })
                                  );

            Assert.AreEqual((totalCondsBefore + 1), se.InfluenceRules.Count);
        }
Beispiel #6
0
        public void Test_CIF_UpdateSocialExchange()
        {
            var cif = BuildCIFAsset();

            var se = new SocialExchange(cif.GetAllSocialExchanges().FirstOrDefault(x => x.Name == (Name)"Flirt"));

            var initialValue = se.StartingConditions.Count();

            var c = Condition.Parse("[x] != False");

            se.AddStartingCondition(c);

            cif.UpdateSocialExchange(se.ToDTO);

            var aux = cif.GetAllSocialExchanges().First(x => x.Name == (Name)"Flirt").StartingConditions.ConditionSet.Count();

            Assert.AreEqual(aux, (initialValue + 1));
        }
        public InfluenceRuleInspector(CommeillFautAsset asset, SocialExchange dto)
        {
            InitializeComponent();

            this._influenceRuleList       = new BindingListView <InfluenceRuleDTO>((IList)null);
            gridInfluenceRules.DataSource = this._influenceRuleList;


            this.dto   = dto;
            this.asset = asset;



            this._influenceRuleList.DataSource = dto.InfluenceRules.Select(x => x.ToDTO()).ToList();

            EditorTools.HideColumns(gridInfluenceRules, new string[] { "Id" });

            label3.Text = dto.Name.ToString();
        }
Beispiel #8
0
        public AddInfluenceRule(SocialExchange _se, InfluenceRuleDTO dto)
        {
            InitializeComponent();

            _dto = dto;
            SE   = _se;

            conditions = new ConditionSetView();
            conditionSetEditorControl.View = conditions;
            //conditions.OnDataChanged += ConditionSetView_OnDataChanged;
            conditions.SetData(dto.Rule);

            if (dto != null)
            {
                valueFieldBox.Value = dto.Value;

                if (dto.Mode != null)
                {
                    modeNameField.Value = dto.Mode;
                }
            }

            buttonAdd.Text = (dto.Id == Guid.Empty) ? "Add" : "Update";
        }