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


C# ExplorerItemModel.Clone方法代码示例

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


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

示例1: ExplorerItemModel_Clone_ReturnsNewObjectWithAllPropertiesSet

        // ReSharper disable MethodTooLong
        public void ExplorerItemModel_Clone_ReturnsNewObjectWithAllPropertiesSet()
        
        {
            //------------Setup for test--------------------------
            var connectControlSingleton = new Mock<IConnectControlSingleton>().Object;
            var explorerItemModel = new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object);
            var parentModel = new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object);
            explorerItemModel.DisplayName = "Test1";
            var childItemModel = new ExplorerItemModel(connectControlSingleton, new Mock<IStudioResourceRepository>().Object);
            explorerItemModel.Children.Add(childItemModel);
            explorerItemModel.EnvironmentId = Guid.NewGuid();
            explorerItemModel.Parent = parentModel;
            explorerItemModel.Permissions = Permissions.Contribute;
            explorerItemModel.ResourceId = Guid.NewGuid();
            explorerItemModel.ResourcePath = "TestResourcePath";
            explorerItemModel.ResourceType = ResourceType.PluginService;
            explorerItemModel.VersionInfo = new VersionInfo { VersionNumber = "2" , Reason = "Save", ResourceId =  Guid.NewGuid()};

            var properties = typeof(ExplorerItemModel).GetProperties();

            //------------Execute Test---------------------------
            var clonedItemModel = explorerItemModel.Clone(connectControlSingleton, new Mock<IStudioResourceRepository>().Object);
            //------------Assert Results-------------------------
            Assert.AreEqual(68, properties.Length);
            Assert.AreEqual(explorerItemModel.DisplayName, clonedItemModel.DisplayName);
            Assert.AreEqual(explorerItemModel.Children.Count, clonedItemModel.Children.Count);
            Assert.AreEqual(explorerItemModel.CanConnect, clonedItemModel.CanConnect);
            Assert.AreEqual(explorerItemModel.CanDelete, clonedItemModel.CanDelete);
            Assert.AreEqual(explorerItemModel.CanDebug, clonedItemModel.CanDebug);
            Assert.AreEqual(explorerItemModel.CanDeploy, clonedItemModel.CanDeploy);
            Assert.AreEqual(explorerItemModel.CanDisconnect, clonedItemModel.CanDisconnect);
            Assert.AreEqual(explorerItemModel.CanEdit, clonedItemModel.CanEdit);
            Assert.AreEqual(explorerItemModel.CanExecute, clonedItemModel.CanExecute);
            Assert.AreEqual(explorerItemModel.CanRemove, clonedItemModel.CanRemove);
            Assert.AreEqual(explorerItemModel.CanRename, clonedItemModel.CanRename);
            Assert.AreEqual(explorerItemModel.CanShowDependencies, clonedItemModel.CanShowDependencies);
            Assert.AreEqual(explorerItemModel.CanSelectDependencies, clonedItemModel.CanSelectDependencies);
            Assert.AreEqual(explorerItemModel.EnvironmentId, clonedItemModel.EnvironmentId);
            Assert.AreEqual(explorerItemModel.Parent, clonedItemModel.Parent);
            Assert.AreEqual(explorerItemModel.Permissions, clonedItemModel.Permissions);
            Assert.AreEqual(explorerItemModel.ResourceId, clonedItemModel.ResourceId);
            Assert.AreEqual(explorerItemModel.ResourcePath, clonedItemModel.ResourcePath);
            Assert.AreEqual(explorerItemModel.ResourceType, clonedItemModel.ResourceType);
            Assert.AreEqual(explorerItemModel.VersionInfo, clonedItemModel.VersionInfo);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:46,代码来源:ExplorerItemModelTest.cs


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