public WorkflowDesignerView()
 {
     InitializeComponent();
     PreviewDrop     += DropPointOnDragEnter;
     PreviewDragOver += DropPointOnDragEnter;
     _dragDropHelpers = new DragDropHelpers(this);
 }
 public void DragDropHelpers_PreventDrop_GetDataReturnsNull_ReturnsFalse()
 {
     //------------Setup for test--------------------------
     var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView());
     //------------Execute Test---------------------------
     bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatNoData(new[] { "ExplorerItemModel", "SomeText" }));
     //------------Assert Results-------------------------
     Assert.IsFalse(canDoDrop);
 }
 public void DragDropHelpers_PreventDrop_FormatsReturnsNotResourceTreeViewModelOrWorkflowItemTypeNameFormat_ReturnsFalse()
 {
     //------------Setup for test--------------------------
     var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView());
     //------------Execute Test---------------------------
     bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormat(new[] { "SomeText" }));
     //------------Assert Results-------------------------
     Assert.IsFalse(canDoDrop);
 }
 public void DragDropHelpers_PreventDrop_NoFormats_ReturnsFalse()
 {
     //------------Setup for test--------------------------
     var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView());
     //------------Execute Test---------------------------
     bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectNoFormats());
     //------------Assert Results-------------------------
     Assert.IsFalse(canDoDrop);
 }
 //IDisposable _subscription;
 public WorkflowDesignerView()
 {
     InitializeComponent();
     PreviewDrop += DropPointOnDragEnter;
     PreviewDragOver += DropPointOnDragEnter;
     PreviewMouseDown += WorkflowDesignerView_PreviewMouseDown;
     _dragDropHelpers = new DragDropHelpers(this);
     //            var pattern = Observable.FromEventPattern<KeyEventArgs>(this,"KeyUp");
     //            pattern.Throttle(TimeSpan.FromMilliseconds(50000))
     //                .ObserveOn(SynchronizationContext.Current);
     //
     //            pattern.Subscribe(PerformOnDispatcher);
 }
Exemplo n.º 6
0
 //IDisposable _subscription;
 public WorkflowDesignerView()
 {
     InitializeComponent();
     PreviewDrop      += DropPointOnDragEnter;
     PreviewDragOver  += DropPointOnDragEnter;
     PreviewMouseDown += WorkflowDesignerView_PreviewMouseDown;
     _dragDropHelpers  = new DragDropHelpers(this);
     //            var pattern = Observable.FromEventPattern<KeyEventArgs>(this,"KeyUp");
     //            pattern.Throttle(TimeSpan.FromMilliseconds(50000))
     //                .ObserveOn(SynchronizationContext.Current);
     //
     //            pattern.Subscribe(PerformOnDispatcher);
 }
Exemplo n.º 7
0
 public void DragDropHelpers_PreventDrop_DataContextViewModelSameEnvironmentID_ReturnsFalse()
 {
     //------------Setup for test--------------------------
     var environmentMock = new Mock<IEnvironmentModel>();
     Guid guid = Guid.NewGuid();
     environmentMock.Setup(model => model.ID).Returns(guid);
     var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.Execute, ResourceType = ResourceType.DbService, EnvironmentId = environmentMock.Object.ID };
     var dataContext = new Mock<IWorkflowDesignerViewModel>();
     dataContext.Setup(model => model.EnvironmentModel).Returns(environmentMock.Object);
     var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext.Object));
     //------------Execute Test---------------------------
     bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));
     //------------Assert Results-------------------------
     Assert.IsFalse(canDoDrop);
 }
Exemplo n.º 8
0
        public void DragDropHelpers_PreventDrop_FormatOfWorkflowItemTypeNameFormat_ReturnsFalse()
        {
            //------------Setup for test--------------------------
            object dataContext = new object();
            var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext));

            var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.Execute, ResourceType = ResourceType.DbService };
            //------------Execute Test---------------------------
            bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "WorkflowItemTypeNameFormat" }, data));
            //------------Assert Results-------------------------
            Assert.IsFalse(canDoDrop);
        }
Exemplo n.º 9
0
        public void DragDropHelpers_PreventDrop_UserIsNotAuthorized_True()
        {
            //------------Setup for test--------------------------
            var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.View, ResourceType = ResourceType.WorkflowService };

            var dataContext = new object();
            var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext));

            //------------Execute Test---------------------------
            var canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));

            //------------Assert Results-------------------------
            Assert.IsTrue(canDoDrop);
        }
Exemplo n.º 10
0
        public void DragDropHelpers_PreventDrop_UserIsAuthorized_False()
        {
            //------------Setup for test--------------------------
            var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.Execute, ResourceType = ResourceType.WorkflowService };

            var dataContext = new Mock<IWorkflowDesignerViewModel>();
            var differentEnvironment = new Mock<IEnvironmentModel>();
            differentEnvironment.Setup(model => model.ID).Returns(Guid.Empty);
            dataContext.Setup(model => model.EnvironmentModel).Returns(differentEnvironment.Object);
            var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext.Object));

            //------------Execute Test---------------------------
            var canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));

            //------------Assert Results-------------------------
            Assert.IsFalse(canDoDrop);
        }
Exemplo n.º 11
0
        public void DragDropHelpers_PreventDrop_LocalResourceOnRemoteDesignSurface_ReturnsFalse()
        {
            //------------Setup for test--------------------------
            var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.Execute, ResourceType = ResourceType.WorkflowService,EnvironmentId = Guid.NewGuid()};
            var dataContext = new Mock<IWorkflowDesignerViewModel>();

            var differentEnvironment = new Mock<IEnvironmentModel>();
            differentEnvironment.Setup(model => model.ID).Returns(Guid.Empty);
            dataContext.Setup(model => model.EnvironmentModel).Returns(differentEnvironment.Object);
            differentEnvironment.Setup(a => a.IsLocalHost).Returns(false);
            var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext.Object));
            CustomContainer.Register(new Mock<IPopupController>().Object);
            //------------Execute Test---------------------------
            bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));
            //------------Assert Results-------------------------
            Assert.IsTrue(canDoDrop);
        }
Exemplo n.º 12
0
 public void DragDropHelpers_PreventDrop_GetDataReturnsNonExplorerItemModel_ReturnsFalse()
 {
     //------------Setup for test--------------------------
     var data = new Object();
     var dataContext = new Mock<IWorkflowDesignerViewModel>();
     var differentEnvironment = new Mock<IEnvironmentModel>();
     differentEnvironment.Setup(model => model.ID).Returns(Guid.Empty);
     dataContext.Setup(model => model.EnvironmentModel).Returns(differentEnvironment.Object);
     var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext.Object));
     //------------Execute Test---------------------------
     bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));
     //------------Assert Results-------------------------
     Assert.IsTrue(canDoDrop);
 }
        public void DragDropHelpers_PreventDrop_GetDataReturnsExplorerItemModelNotWorkflowServiceDataContextNotViewModel_ReturnsTrue()
        {
            //------------Setup for test--------------------------
            object dataContext = new object();
            var dragDropHelpers = new DragDropHelpers(GetMockWorkflowDesignerView(dataContext));

            var data = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { Permissions = Permissions.Execute, ResourceType = Common.Interfaces.Data.ResourceType.DbService };
            //------------Execute Test---------------------------
            bool canDoDrop = dragDropHelpers.PreventDrop(GetMockDataObjectWithFormatData(new[] { "ExplorerItemModel" }, data));
            //------------Assert Results-------------------------
            Assert.IsTrue(canDoDrop);
        }