Inheritance: IModelChange
示例#1
0
        public void ApplyListClear()
        {
            var change = new ListDeletion(railway.AbsoluteUri, "Semaphores", 0, int.MaxValue);

            change.Apply(repository);

            Assert.AreEqual(0, railway.Semaphores.Count);
        }
示例#2
0
        public void ApplyListDeletion()
        {
            var toDelete = railway.Routes.Take(1).ToList();
            var change = new ListDeletion(railway.AbsoluteUri, "Routes", 0, 1);

            change.Apply(repository);

            Assert.AreNotEqual(toDelete, railway.Routes.FirstOrDefault());
            CollectionAssert.DoesNotContain(railway.Routes.ToList(), toDelete);
        }
示例#3
0
        public void RecordListDeletion()
        {
            var rec = new ModelChangeRecorder();
            rec.Start(railway);

            railway.Semaphores.RemoveAt(0);

            var expected = new ListDeletion(railway.AbsoluteUri, "Semaphores", 0, 1);
            var actual = ((ChangeTransaction)rec.GetModelChanges().Changes[0]).SourceChange;
            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void RecordListClear()
        {
            var parent = railway.Routes[0].DefinedBy[0].Elements[0];
            var rec = new ModelChangeRecorder();
            rec.Start(railway);

            parent.ConnectsTo.Clear();

            var expected = new ListDeletion(parent.AbsoluteUri, "ConnectsTo", 0, int.MaxValue);
            var actual = rec.GetModelChanges().Changes[0];
            Assert.AreEqual(expected, actual);
        }
示例#5
0
 public void SerializeListDeletion()
 {
     var change = new ListDeletion(uri, property, 42, 23);
     SerializeAndAssert(change);
 }