public void BaseVM_CRUD() { var vm = new TestVM(); vm.AddList(() => vm.Sequence, new TestObject { Id = 4, Name = "Four" }); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_add")); Assert.IsNotNull(vm.ChangedProperties["Sequence_add"] as TestObject); Assert.AreEqual(4, (vm.ChangedProperties["Sequence_add"] as TestObject).Id); Assert.AreEqual("Four", (vm.ChangedProperties["Sequence_add"] as TestObject).Name); vm.UpdateList(() => vm.Sequence, new TestObject { Id = 2, Name = "Two" }); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_update")); Assert.IsNotNull(vm.ChangedProperties["Sequence_update"] as TestObject); Assert.AreEqual(2, (vm.ChangedProperties["Sequence_update"] as TestObject).Id); Assert.AreEqual("Two", (vm.ChangedProperties["Sequence_update"] as TestObject).Name); vm.RemoveList(() => vm.Sequence, 3); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_remove")); Assert.AreEqual(3, vm.ChangedProperties["Sequence_remove"]); }
public void BaseVM_CRUD() { var vm = new TestVM(); vm.AddList(() => vm.Sequence, new TestObject { Id = 4, Name = "Four" }); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_add")); Assert.IsNotNull(vm.ChangedProperties["Sequence_add"] as TestObject); Assert.AreEqual(4, (vm.ChangedProperties["Sequence_add"] as TestObject).Id); Assert.AreEqual("Four", (vm.ChangedProperties["Sequence_add"] as TestObject).Name); vm.UpdateList(() => vm.Sequence, new TestObject { Id = 2, Name = "Two" }); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_update")); Assert.IsNotNull(vm.ChangedProperties["Sequence_update"] as TestObject); Assert.AreEqual(2, (vm.ChangedProperties["Sequence_update"] as TestObject).Id); Assert.AreEqual("Two", (vm.ChangedProperties["Sequence_update"] as TestObject).Name); vm.RemoveList(() => vm.Sequence, 3); Assert.IsNotNull(vm.ChangedProperties); Assert.IsTrue(vm.ChangedProperties.ContainsKey("Sequence_remove")); Assert.AreEqual(3, vm.ChangedProperties["Sequence_remove"]); }