本文整理汇总了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);
}