Пример #1
0
        public void Generic_WithHistory_ChangeOneProperty()
        {
            var propWatch = new PropertyWatcher <BasicPOCO>(true);

            propWatch.Set(c => c.StringValue, "First new value!");
            propWatch.Set(c => c.StringValue, "Second new value!");

            var ret = propWatch.GetHistory(c => c.StringValue).ToArray();

            Assert.AreEqual(2, ret.Length);
            Assert.AreEqual("First new value!", ret[0]);
            Assert.AreEqual("Second new value!", ret[1]);
        }
Пример #2
0
        public void Generic_NoHistory_INotifyPropertyChanged()
        {
            var propWatch = new PropertyWatcher <BasicPOCO>(false);

            bool called = false;

            propWatch.PropertyChanged += (Sender, Args) => called = true;

            propWatch.Set(c => c.StringValue, "New value!");

            Assert.IsTrue(called, "PropertyChanged was not called.");
        }
Пример #3
0
        public void Generic_NoHistory_ChangeOneProperty()
        {
            var propWatch = new PropertyWatcher <BasicPOCO>(false);

            propWatch.Set(c => c.StringValue, "New value!");

            var ret = propWatch.GetValues().ToArray();

            Assert.AreEqual(1, ret.Length, "Length was incorrect.");
            Assert.AreEqual("StringValue", ret[0].Key.Name, "Name was incorrect.");
            Assert.AreEqual("New value!", ret[0].Value, "Value was incorrect.");
        }