コード例 #1
0
        private Node AddNode <T>(PipelineViewModel pvm, Mock <IDragEventInfo> mock, Point p)
        {
            mock.Setup(e => e.GetData <NodeType>()).Returns(new NodeType {
                Type = typeof(T)
            });
            mock.Setup(e => e.GetPosition(pvm)).Returns(new Point(50, 70));
            mock.SetupProperty(e => e.Effects, DragDropEffects.Copy);

            pvm.CheckClearance(mock.Object);
            Assert.Equal(DragDropEffects.Copy, mock.Object.Effects);

            pvm.Drop(mock.Object);

            var node = pvm.Nodes.Last().Model;

            Assert.True(node is T);
            Assert.Equal(50, node.X);
            Assert.Equal(70, node.Y);

            return(node);
        }
コード例 #2
0
ファイル: PipelineViewModelTest.cs プロジェクト: Kha/YUV.KA
        public void CanDropNode()
        {
            PipelineViewModel vm = MainViewModelTest.GetInstance().PipelineViewModel;

            var mock = new Mock <IDragEventInfo>();

            mock.Setup(e => e.GetData <NodeType>()).Returns(new NodeType {
                Type = typeof(BlurNode)
            });
            mock.Setup(e => e.GetPosition(vm)).Returns(new Point(42, 21));
            mock.SetupProperty(e => e.Effects, DragDropEffects.Copy);

            vm.CheckClearance(mock.Object);
            Assert.Equal(DragDropEffects.Copy, mock.Object.Effects);

            vm.Drop(mock.Object);

            var node = vm.Nodes.Single().Model;

            Assert.True(node is BlurNode);
            Assert.Equal(42, node.X);
            Assert.Equal(21, node.Y);
        }