public void OnAttachedShouldAttachToDragAndDropEvents()
        {
            var item = new NodeDestinationCommandDragDropBehavior();
            var nodeList = new NodeList();

            Mock.Arrange(() => RadDragAndDropManager.AddDragQueryHandler(nodeList, Arg.IsAny<EventHandler<DragDropQueryEventArgs>>())).OccursOnce();
            Mock.Arrange(() => RadDragAndDropManager.AddDragInfoHandler(nodeList, Arg.IsAny<EventHandler<DragDropEventArgs>>())).OccursOnce();
            Mock.Arrange(() => RadDragAndDropManager.AddDropQueryHandler(nodeList, Arg.IsAny<EventHandler<DragDropQueryEventArgs>>())).OccursOnce();
            Mock.Arrange(() => RadDragAndDropManager.AddDropInfoHandler(nodeList, Arg.IsAny<EventHandler<DragDropEventArgs>>())).OccursOnce();

            item.Attach(nodeList);

            Mock.AssertAll(item);
        }
Пример #2
0
 public void PropertiesTests()
 {
     var vm = new NodeDestinationCommandDragDropBehavior();
     TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true);
 }
        public void OnDragQueryShouldFillEventParams()
        {
            var item = new NodeDestinationCommandDragDropBehavior();
            item.Attach(new NodeList());
            item.DragCommand = new ActionCommand<object>();
            var args = Mock.Create<DragDropQueryEventArgs>(null, null, new DragDropOptions());

            Mock.ArrangeSet(() => args.Handled = true).DoNothing().OccursOnce();

            item.OnDragQuery(new object(), args);

            Assert.AreEqual(true, args.QueryResult);
        }
 public void OnDragQueryShouldThrowExceptionIfArgsIsNull()
 {
     var item = new NodeDestinationCommandDragDropBehavior();
     item.OnDragQuery(new object(), null);
 }
        public void OnDragInfoShouldFillEventParams()
        {
            var item = new NodeDestinationCommandDragDropBehavior();
            item.Attach(new NodeList());
            item.DragCommand = new ActionCommand<object>();
            
            var args = Mock.Create<DragDropEventArgs>(null, null, new DragDropOptions());
            args.Source = new TextBlock { DataContext = Mock.Create<INodeViewModel>() };
            
            Mock.ArrangeSet(() => args.Handled = true).DoNothing().OccursOnce();

            item.OnDragInfo(new object(), args);

            Assert.IsNotNull(args.Options.Payload);
            Assert.IsNotNull(args.Options.DragCue);
        }