当前位置: 首页>>代码示例>>C#>>正文


C# Models.ExplorerItemModel类代码示例

本文整理汇总了C#中Dev2.Models.ExplorerItemModel的典型用法代码示例。如果您正苦于以下问题:C# ExplorerItemModel类的具体用法?C# ExplorerItemModel怎么用?C# ExplorerItemModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExplorerItemModel类属于Dev2.Models命名空间,在下文中一共展示了ExplorerItemModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateModels

        protected StudioResourceRepository CreateModels(bool isChecked, Mock<IContextualResourceModel> mockResourceModel, out IEnvironmentModel environmentModel, out IExplorerItemModel resourceVm, out IExplorerItemModel rootItem)
        {
            Mock<IContextualResourceModel> resourceModel = mockResourceModel;

            var connection = new Mock<IEnvironmentConnection>();

            var mockEnvironmentModel = new Mock<IEnvironmentModel>();
            mockEnvironmentModel.Setup(e => e.Connection).Returns(connection.Object);
            mockEnvironmentModel.Setup(a => a.AuthorizationService).Returns(new Mock<IAuthorizationService>().Object);
            environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List<IResourceModel>()).Object;

            var serverItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = ResourceType.Server, EnvironmentId = environmentModel.ID, ResourcePath = "", ResourceId = Guid.NewGuid() };
            rootItem = serverItemModel;
            ExplorerItemModel workflowsFolder = new ExplorerItemModel { DisplayName = "WORKFLOWS", ResourceType = ResourceType.Folder, ResourcePath = "WORKFLOWS", EnvironmentId = mockEnvironmentModel.Object.ID, ResourceId = Guid.NewGuid() };
            serverItemModel.Children.Add(workflowsFolder);

            var studioResourceRepository = new StudioResourceRepository(serverItemModel, _Invoke);
            resourceModel.Setup(model => model.Category).Returns("WORKFLOWS\\" + resourceModel.Object.DisplayName);
            TestEnvironmentRespository testEnvironmentRespository = new TestEnvironmentRespository(environmentModel);
            // ReSharper disable ObjectCreationAsStatement
            new EnvironmentRepository(testEnvironmentRespository);
            // ReSharper restore ObjectCreationAsStatement
            IEnvironmentModel internalEnvironmentModel = environmentModel;
            studioResourceRepository.GetCurrentEnvironment = () => internalEnvironmentModel.ID;
            studioResourceRepository.AddResouceItem(resourceModel.Object);
            resourceVm = workflowsFolder.Children[0];
            resourceVm.IsChecked = isChecked;
            return studioResourceRepository;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:29,代码来源:DeployStatsCalculatorTests.cs

示例2: EnvironmentTreeViewModel_PermissionsChanged_DeployToTrue_ChildrenIsNotCleared

        public void EnvironmentTreeViewModel_PermissionsChanged_DeployToTrue_ChildrenIsNotCleared()
        {
            var connection = CreateConnection();
            connection.Setup(c => c.IsAuthorized).Returns(true);
            var authorizationService = new Mock<IAuthorizationService>();
            authorizationService.Setup(e => e.IsAuthorized(AuthorizationContext.DeployTo, null)).Returns(true);
            var mockEnvironmentModel = new Mock<IEnvironmentModel>();
            mockEnvironmentModel.SetupGet(x => x.Connection.AppServerUri).Returns(new Uri("http://127.0.0.1/"));
            mockEnvironmentModel.Setup(model => model.Equals(It.IsAny<IEnvironmentModel>())).Returns(true);
            mockEnvironmentModel.Setup(e => e.IsAuthorized).Returns(true);
            mockEnvironmentModel.Setup(model => model.AuthorizationService).Returns(authorizationService.Object);
            mockEnvironmentModel.Setup(model => model.Connection).Returns(connection.Object);

            var environmentVm = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, StudioResourceRepository.Instance);

            var child = new Mock<IExplorerItemModel>().Object;
            environmentVm.Children.Add(child);
            environmentVm.Children.Add(child);
            environmentVm.Children.Add(child);

            authorizationService.Setup(e => e.IsAuthorized(AuthorizationContext.DeployTo, null)).Returns(true);
            connection.Raise(c => c.PermissionsChanged += null, EventArgs.Empty);

            Assert.AreEqual(3, environmentVm.Children.Count);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:25,代码来源:EnvironmentTreeViewModelTests.cs

示例3: ExplorerItemModel_Constructor_HasChildrenCollectionInstantiated

 public void ExplorerItemModel_Constructor_HasChildrenCollectionInstantiated()
 {
     //------------Setup for test--------------------------
     //------------Execute Test---------------------------
     var explorerItemModel = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object);
     //------------Assert Results-------------------------
     Assert.IsNotNull(explorerItemModel);
     Assert.IsNotNull(explorerItemModel.Children);
     Assert.AreEqual(0, explorerItemModel.ChildrenCount);
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:10,代码来源:ExplorerItemModelTest.cs

示例4: StudioResourceRepository

 //This is for testing only need better way of putting this together
 internal StudioResourceRepository(ExplorerItemModel explorerItem, Action<System.Action, DispatcherPriority> invoke)
 {
     ExplorerItemModelClone = a => a.Clone();
     ExplorerItemModels = new ObservableCollection<IExplorerItemModel>();
     _invoke = invoke;
     if(explorerItem != null)
     {
         LoadItemsToTree(explorerItem.EnvironmentId, explorerItem);
         Instance = this;
     }
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:12,代码来源:StudioResourceRepository.cs

示例5: DeployStatsCalculator_Calculate_HasFolders_Expect_NoFoldersCounted

        public void DeployStatsCalculator_Calculate_HasFolders_Expect_NoFoldersCounted()
        {
            //------------Setup for test--------------------------

            var conn = new Mock<IConnectControlSingleton>().Object;
            var studio = new Mock<IStudioResourceRepository>().Object;
            ExplorerItemModel navigationItemViewModel = new ExplorerItemModel(conn,studio){ResourceType = ResourceType.Folder,IsChecked = true};
            IEnvironmentModel environmentModel = Dev2MockFactory.SetupEnvironmentModel().Object;
            bool actual = DeployStatsCalculator.DeploySummaryPredicateNew(navigationItemViewModel, environmentModel);
            Assert.IsFalse(actual);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:11,代码来源:DeployStatsCalculatorTests.cs

示例6: ExplorerView_Move_FolderExpectRename

        // ReSharper disable once InconsistentNaming
        public void ExplorerView_Move_FolderExpectRename()
        {
            //------------Setup for test--------------------------
            var stud = new Mock<IStudioResourceRepository>();
            var model1 = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.Folder, ResourcePath = "bob" };
            var model2 = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.Folder, ResourcePath = "dave", Parent = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourcePath = "moo" } };
            stud.Setup(a => a.MoveItem(model1, "bob"));
            ExplorerView.MoveItem(model1, model2, stud.Object);

            //------------Execute Test---------------------------
            stud.Verify(a => a.MoveItem(model1, "dave"));
            //------------Assert Results-------------------------
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:14,代码来源:ExplorereViewTests.cs

示例7: ExplorerItemModel_Constructor_Has4ChildrenCount

 public void ExplorerItemModel_Constructor_Has4ChildrenCount()
 {
     //------------Setup for test--------------------------
     //------------Execute Test---------------------------
     var connectControlSingleton = new Mock<IConnectControlSingleton>().Object;
     var explorerItemModel = new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object);
     explorerItemModel.Children.Add(new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.WorkflowService });
     explorerItemModel.Children.Add(new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.WorkflowService });
     explorerItemModel.Children.Add(new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.WorkflowService });
     explorerItemModel.Children.Add(new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.WorkflowService });
     //------------Assert Results-------------------------
     Assert.IsNotNull(explorerItemModel);
     Assert.IsNotNull(explorerItemModel.Children);
     Assert.AreEqual(4, explorerItemModel.ChildrenCount);
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:15,代码来源:ExplorerItemModelTest.cs

示例8: DragDropHelpers_PreventDrop_DataContextViewModelSameEnvironmentID_ReturnsFalse

 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);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:15,代码来源:DragDropHelpersTests.cs

示例9: ExplorerView_Move_FolderExpectPopup

        // ReSharper disable once InconsistentNaming
        public void ExplorerView_Move_FolderExpectPopup()
        {
            //------------Setup for test--------------------------
            var stud = new Mock<IStudioResourceRepository>();
            var popup = new Mock<IPopupController>();
            CustomContainer.Register(popup.Object);
            var model1 = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.Folder, ResourcePath = "bob",EnvironmentId = Guid.NewGuid()};
            var model2 = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourceType = ResourceType.Folder, ResourcePath = "dave", Parent = new ExplorerItemModel(new Mock<IConnectControlSingleton>().Object, new Mock<IStudioResourceRepository>().Object) { ResourcePath = "moo" } };
            stud.Setup(a => a.MoveItem(model1, "bob"));
            ExplorerView.MoveItem(model1, model2, stud.Object);

            //------------Execute Test---------------------------
            popup.Verify(a=>a.Show());
            popup.VerifySet(a => a.Description = "You are not allowed to move items between Servers using the explorer. Please use the deploy instead");
            //------------Assert Results-------------------------
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:17,代码来源:ExplorereViewTests.cs

示例10: MoveItem

        public static void MoveItem(ExplorerItemModel source, ExplorerItemModel destination, IStudioResourceRepository rep)
        {
            if (source != null)
            {
                if(source.EnvironmentId != destination.EnvironmentId)
                {
                    var popup = CustomContainer.Get<IPopupController>();
                    popup.Description = "You are not allowed to move items between Servers using the explorer. Please use the deploy instead";
                    popup.Buttons = MessageBoxButton.OK;
                    popup.Header = "Invalid Action";
                    popup.ImageType = MessageBoxImage.Error;
                    popup.Show();

                }
                else
                switch (destination.ResourceType)
                {
                    case ResourceType.Folder:
                    case ResourceType.Server:
                        rep.MoveItem(source, destination.ResourcePath);
                        break;
                    default:
                        rep.MoveItem(source, destination.Parent.ResourcePath);
                        break;
                }
            }
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:27,代码来源:ExplorerView.xaml.cs

示例11: StudioResourceRepository_DeleteItem_ItemParentNull_Exception

        public void StudioResourceRepository_DeleteItem_ItemParentNull_Exception()
        {
            //------------Setup for test--------------------------
            var _propertyChangedCalled = false;
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            mockExplorerResourceRepository.Setup(m => m.DeleteItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()))
                                          .Returns(new ExplorerRepositoryResult(ExecStatus.Success, "Success"))
                                          .Verifiable();

            var environmentId = Guid.NewGuid();
            var workflowId = Guid.NewGuid();
            var folderID = Guid.NewGuid();
            SetupEnvironmentRepo(environmentId);
            var mockVersionRepository = new Mock<IVersionRepository>();
            var repository = new StudioResourceRepository(GetTestData(workflowId.ToString(), folderID: folderID), environmentId, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object
            };

            var folderItem = repository.FindItemById(folderID);

            ExplorerItemModel item = folderItem.Parent as ExplorerItemModel;
            // ReSharper disable PossibleNullReferenceException
            item.PropertyChanged += (sender, args) =>
            // ReSharper restore PossibleNullReferenceException
            {
                if(args.PropertyName == "ChildrenCount")
                {
                    _propertyChangedCalled = true;
                }
            };
            //------------Execute Test---------------------------
            ExplorerItemModel explorerItemModel = new ExplorerItemModel();
            repository.DeleteItem(explorerItemModel);
            //------------Assert Results-------------------------
            Assert.IsFalse(_propertyChangedCalled);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:38,代码来源:StudioResourceRepositoryTests.cs

示例12: DragDropHelpers_PreventDrop_UserIsAuthorized_False

        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);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:17,代码来源:DragDropHelpersTests.cs

示例13: CreateModels

        protected static StudioResourceRepository CreateModels(bool isChecked, IEnvironmentModel environmentModel, out IExplorerItemModel resourceVm)
        {
            Mock<IContextualResourceModel> resourceModel = Dev2MockFactory.SetupResourceModelMock(ResourceType.WorkflowService, Guid.NewGuid());
            var serverItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = Common.Interfaces.Data.ResourceType.Server, EnvironmentId = environmentModel.ID, ResourceId = Guid.NewGuid(), ResourcePath = "" };

            ExplorerItemModel workflowsFolder = new ExplorerItemModel { DisplayName = "WORKFLOWS", ResourceType = Common.Interfaces.Data.ResourceType.Folder, ResourcePath = "WORKFLOWS", ResourceId = Guid.NewGuid(), EnvironmentId = environmentModel.ID };

            serverItemModel.Children.Add(workflowsFolder);

            var studioResourceRepository = new StudioResourceRepository(serverItemModel, Invoke);

            resourceModel.Setup(model => model.Category).Returns("WORKFLOWS\\" + resourceModel.Object.DisplayName);
            resourceModel.Setup(a => a.ServerID).Returns(environmentModel.ID);
            var env = new Mock<IEnvironmentModel>();
            resourceModel.Setup(a => a.Environment).Returns(env.Object);
            env.Setup(a => a.ID).Returns(environmentModel.ID);
            TestEnvironmentRespository testEnvironmentRespository = new TestEnvironmentRespository(environmentModel);
            // ReSharper disable ObjectCreationAsStatement
            new EnvironmentRepository(testEnvironmentRespository);
            // ReSharper restore ObjectCreationAsStatement
            IEnvironmentModel internalEnvironmentModel = environmentModel;
            studioResourceRepository.GetCurrentEnvironment = () => internalEnvironmentModel.ID;
            studioResourceRepository.AddResouceItem(resourceModel.Object);
            resourceVm = workflowsFolder.Children[0];
            resourceVm.IsChecked = isChecked;
            return studioResourceRepository;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:27,代码来源:DeployViewModelTestBase.cs

示例14: TestNavigationItemViewModelMouseDownBehavior

        public void NavigationItemViewModelMouseDownBehavior_OnMouseDown_OpenOnDoubleClickIsTrueAndClickCountIsOne_PublishesEvent()
        {
            //------------Setup for test--------------------------
            var eventPublisher = new Mock<IEventAggregator>();
            var behavior = new TestNavigationItemViewModelMouseDownBehavior(eventPublisher.Object) { OpenOnDoubleClick = true };

            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(c => c.ServerEvents).Returns(new Mock<IEventPublisher>().Object);
            var environmentModel = new Mock<IEnvironmentModel>();
            environmentModel.Setup(e => e.Connection).Returns(connection.Object);

            var resourceModel = new Mock<IContextualResourceModel>();
            resourceModel.Setup(r => r.Environment).Returns(environmentModel.Object);
            resourceModel.Setup(r => r.IsAuthorized(AuthorizationContext.View)).Returns(true);

            var explorerItemModel = new ExplorerItemModel(new Mock<IStudioResourceRepository>().Object, new Mock<IAsyncWorker>().Object, new Mock<IConnectControlSingleton>().Object);

            //------------Execute Test---------------------------
            var result = behavior.TestOnMouseDown(explorerItemModel, 1);

            //------------Assert Results-------------------------
            Assert.IsTrue(result);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:23,代码来源:NavigationItemViewModelMouseDownBehaviorTests.cs

示例15: Verify_OnMouseDown_SelectOnRightClick

        static void Verify_OnMouseDown_SelectOnRightClick(bool selectOnRightClick)
        {
            //------------Setup for test--------------------------
            var eventPublisher = new Mock<IEventAggregator>();
            var behavior = new TestNavigationItemViewModelMouseDownBehavior(eventPublisher.Object) { SelectOnRightClick = selectOnRightClick };

            var explorerItemModel = new ExplorerItemModel(new Mock<IStudioResourceRepository>().Object, new Mock<IAsyncWorker>().Object, new Mock<IConnectControlSingleton>().Object);

            //------------Execute Test---------------------------
            var result = behavior.TestOnMouseDown(explorerItemModel, 1);

            //------------Assert Results-------------------------
            Assert.IsTrue(result);
            Assert.AreEqual(selectOnRightClick, explorerItemModel.IsExplorerSelected);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:15,代码来源:NavigationItemViewModelMouseDownBehaviorTests.cs


注:本文中的Dev2.Models.ExplorerItemModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。