Exemplo n.º 1
0
        public void Observe_Vertex_DeletePropertyOperation_Test()
        {
            var vertex = new DataVertex();

            vertex.AddProperty(new Model.PropertyViewmodel(0, "", "", vertex)
            {
                IsSelected = true
            });

            var vm = new GraphExplorerViewmodel();

            vm.OnVertexLoaded(new DataVertex[] { vertex }, true);

            vertex.DeleteCommand.Execute();

            Assert.IsTrue(vm.HasUndoable);
            Assert.AreEqual(vertex.Properties.Count, 0);

            vm.UndoCommand.Execute();

            Assert.IsTrue(vm.HasRedoable);
            Assert.AreEqual(vertex.Properties.Count, 1);

            vm.RedoCommand.Execute();

            Assert.IsTrue(vm.HasUndoable);
            Assert.AreEqual(vertex.Properties.Count, 0);
        }
Exemplo n.º 2
0
        public void EditKeyPropertyOperation_Test()
        {
            var vertex   = new DataVertex();
            var property = new PropertyViewmodel(1, "key", "value", vertex);

            vertex.AddProperty(property);
            var ekpo = new EditKeyPropertyOperation(property, "key changed");

            ekpo.Do();

            Assert.AreEqual(property.Key, "key changed");

            ekpo.UnDo();

            Assert.AreEqual(property.Key, "key");
        }
Exemplo n.º 3
0
        public void EditValuePropertyOperation_Test()
        {
            var vertex = new DataVertex();
            var property = new PropertyViewmodel(1, "key", "value", vertex);
            vertex.AddProperty(property);
            var evpo = new EditValuePropertyOperation(property, "value changed");

            evpo.Do();

            Assert.AreEqual(property.Value, "value changed");

            evpo.UnDo();

            Assert.AreEqual(property.Value, "value");
        }
        public void Observe_Vertex_DeletePropertyOperation_Test()
        {
            var vertex = new DataVertex();

            vertex.AddProperty(new Model.PropertyViewmodel(0, "", "", vertex) { IsSelected = true});

            var vm = new GraphExplorerViewmodel();

            vm.OnVertexLoaded(new DataVertex[] { vertex }, true);

            vertex.DeleteCommand.Execute();

            Assert.IsTrue(vm.HasUndoable);
            Assert.AreEqual(vertex.Properties.Count, 0);

            vm.UndoCommand.Execute();

            Assert.IsTrue(vm.HasRedoable);
            Assert.AreEqual(vertex.Properties.Count, 1);

            vm.RedoCommand.Execute();

            Assert.IsTrue(vm.HasUndoable);
            Assert.AreEqual(vertex.Properties.Count, 0);
        }