示例#1
0
        public void Should_Reject_Changes()
        {
            var adapter = new PocoTestAdapter(_tester);

            adapter.TestName = "Sandra";
            adapter.TestId   = 100;
            Assert.AreEqual("Sandra", adapter.TestName);
            Assert.AreEqual("Roger", adapter.TestNameOriginal);
            Assert.IsTrue(adapter.TestIdHasChanged);
            Assert.IsTrue(adapter.IsChanged);

            adapter.RejectChanges();

            Assert.AreEqual("Roger", adapter.TestName);
            Assert.AreEqual("Roger", adapter.TestNameOriginal);
            Assert.AreEqual(25, adapter.TestId);
            Assert.IsFalse(adapter.TestIdHasChanged);
            Assert.IsFalse(adapter.IsChanged);
        }
示例#2
0
        public void Should_Raise_PropertyChangedEvent_For_IsChanged_Property_On_Adapter()
        {
            var isRaised = false;
            var adapter  = new PocoTestAdapter(_tester);

            adapter.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(adapter.IsChanged))
                {
                    isRaised = true;
                }
            };

            var listItemToModify = adapter.Items.First();

            listItemToModify.Description = "modified item";

            Assert.IsTrue(isRaised);
        }
        public void AdapterProperty_Should_Be_Equal_To_Contained_ModelProperty()
        {
            var adapter = new PocoTestAdapter(_tester);

            Assert.AreEqual(_tester.TestName, adapter.TestName);
        }
        public void Original_Model_Should_Be_In_Adapter_ModelProperty()
        {
            var adapter = new PocoTestAdapter(_tester);

            Assert.AreEqual(_tester, adapter.Model);
        }
 public void ThrowArgumentNullExceptionIfModelIsNull()
 {
     var adapter = new PocoTestAdapter(null);
 }
示例#6
0
 private void CheckCollectionsInSync(PocoTestAdapter adapter)
 {
     Assert.AreEqual(_tester.Items.Count, adapter.Items.Count);
     Assert.IsTrue(_tester.Items.All(ti => adapter.Items.Any(ai => ai.Model == ti)));
 }