本文整理汇总了C#中Dev2.AppResources.Repositories.StudioResourceRepository.AddServerNode方法的典型用法代码示例。如果您正苦于以下问题:C# StudioResourceRepository.AddServerNode方法的具体用法?C# StudioResourceRepository.AddServerNode怎么用?C# StudioResourceRepository.AddServerNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dev2.AppResources.Repositories.StudioResourceRepository
的用法示例。
在下文中一共展示了StudioResourceRepository.AddServerNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StudioResourceRepository_AddServerNode_Existing_ItemExpandedAndSelected
public void StudioResourceRepository_AddServerNode_Existing_ItemExpandedAndSelected()
{
//------------Setup for test--------------------------
Mock<IContextualResourceModel> resourceModel = new Mock<IContextualResourceModel>();
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);
var environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List<IResourceModel>()).Object;
var serverItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = ResourceType.Server, EnvironmentId = environmentModel.ID, ResourcePath = "", ResourceId = Guid.NewGuid() };
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);
new EnvironmentRepository(testEnvironmentRespository);
IEnvironmentModel internalEnvironmentModel = environmentModel;
studioResourceRepository.GetCurrentEnvironment = () => internalEnvironmentModel.ID;
ExplorerItemModel serverExplorerItem = new ExplorerItemModel(studioResourceRepository, AsyncWorkerTests.CreateSynchronousAsyncWorker().Object, new Mock<IConnectControlSingleton>().Object) { EnvironmentId = Guid.NewGuid(), ResourceType = ResourceType.Server };
studioResourceRepository.AddServerNode(serverExplorerItem);
//------------Execute Test---------------------------
studioResourceRepository.AddServerNode(serverExplorerItem);
//------------Assert Results-------------------------
Assert.AreEqual(2, studioResourceRepository.ExplorerItemModels.Count);
Assert.IsTrue(studioResourceRepository.ExplorerItemModels[1].IsExplorerSelected);
Assert.IsTrue(studioResourceRepository.ExplorerItemModels[1].IsExplorerExpanded);
}