• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Explorer.ServerExplorerItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ServerExplorerItem_GetHashCode_ExpectHashCodeSameAsID

        public void ServerExplorerItem_GetHashCode_ExpectHashCodeSameAsID()
        {
            //------------Setup for test--------------------------
            var guid = Guid.NewGuid();
            const string name = "a";
            const ResourceType explorerItemType = ResourceType.PluginService;
            var children = new List<IExplorerItem>();
            const Permissions permissions = Permissions.DeployFrom;


            //------------Execute Test---------------------------
            var serverExplorerItem = new ServerExplorerItem(name, guid, explorerItemType, children, permissions, "");
            //------------Assert Results-------------------------

            Assert.AreEqual(guid.GetHashCode(), serverExplorerItem.GetHashCode());

        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:17,代码来源:ServerExplorerItemTest.cs


示例2: FetchExplorerItems_Execute_ExpectName

        public void FetchExplorerItems_Execute_ExpectName()
        {
            //------------Setup for test--------------------------
            var fetchExplorerItems = new FetchExplorerItems();

            ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
            var repo = new Mock<IExplorerServerResourceRepository>();
            var ws = new Mock<IWorkspace>();
            repo.Setup(a => a.Load(It.IsAny<Guid>())).Returns(item).Verifiable();
            var serializer = new Dev2JsonSerializer();
            ws.Setup(a => a.ID).Returns(Guid.Empty);
            fetchExplorerItems.ServerExplorerRepo = repo.Object;
            //------------Execute Test---------------------------
            var ax = fetchExplorerItems.Execute(new Dictionary<string, StringBuilder>(), ws.Object);
            //------------Assert Results-------------------------
            repo.Verify(a => a.Load(It.IsAny<Guid>()));
            Assert.AreEqual(serializer.Deserialize<IExplorerItem>(ax.ToString()).ResourceId, item.ResourceId);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:18,代码来源:FetchExplorerItemsTest.cs


示例3: GetVersions_Execute_ExpectName

 public void GetVersions_Execute_ExpectName()
 {
     //------------Setup for test--------------------------
     var getVersions = new GetVersions();
     var resourceId = Guid.NewGuid();
     ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
     var repo = new Mock<IServerVersionRepository>();
     var ws = new Mock<IWorkspace>();
     repo.Setup(a => a.GetVersions(resourceId)).Returns(new List<IExplorerItem> {item});
     var serializer = new Dev2JsonSerializer();
     ws.Setup(a => a.ID).Returns(Guid.Empty);
     getVersions.ServerVersionRepo = repo.Object;
     //------------Execute Test---------------------------
     var ax = getVersions.Execute(new Dictionary<string, StringBuilder> {{"resourceId",new StringBuilder( resourceId.ToString())}}, ws.Object);
     //------------Assert Results-------------------------
     repo.Verify(a => a.GetVersions(It.IsAny<Guid>()));
     Assert.AreEqual(serializer.Deserialize<IList<IExplorerItem>>(ax.ToString())[0].ResourceId, item.ResourceId);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:18,代码来源:GetServerVersionTest.cs


示例4: ServerExplorerItem_Constructor_Construct_ExpectAllFieldsAreSetup

        public void ServerExplorerItem_Constructor_Construct_ExpectAllFieldsAreSetup()
        {
            //------------Setup for test--------------------------
            var guid = Guid.NewGuid();
            const string name = "a";
            const ResourceType explorerItemType = ResourceType.Folder;
            var children = new List<IExplorerItem>();
            const Permissions permissions = Permissions.DeployFrom;


            //------------Execute Test---------------------------
            var serverExplorerItem = new ServerExplorerItem(name, guid, explorerItemType, children, permissions, "/");
            //------------Assert Results-------------------------

            Assert.AreEqual(children, serverExplorerItem.Children);
            Assert.AreEqual(name, serverExplorerItem.DisplayName);
            Assert.AreEqual(serverExplorerItem.ResourceType, explorerItemType);
            Assert.AreEqual(permissions, serverExplorerItem.Permissions);
            Assert.AreEqual(guid, serverExplorerItem.ResourceId);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:20,代码来源:ServerExplorerItemTest.cs


示例5: CreateFolder_Execute_ExpectCreateCalled

        public void CreateFolder_Execute_ExpectCreateCalled()
        {
            //------------Setup for test--------------------------
            var createFolderService = new AddFolderService();

            ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
            var repo = new Mock<IExplorerServerResourceRepository>();
            var ws = new Mock<IWorkspace>();
            repo.Setup(a => a.AddItem(item, It.IsAny<Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Fail, "noddy"));
            var serializer = new Dev2JsonSerializer();
            var inputs = new Dictionary<string, StringBuilder>();
            inputs.Add("itemToAdd", serializer.SerializeToBuilder(item));

            ws.Setup(a => a.ID).Returns(Guid.Empty);
            createFolderService.ServerExplorerRepo = repo.Object;
            //------------Execute Test---------------------------
            createFolderService.Execute(inputs, ws.Object);
            //------------Assert Results-------------------------
            repo.Verify(a => a.AddItem(It.IsAny<IExplorerItem>(), It.IsAny<Guid>()));
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:20,代码来源:CreateFolderTest.cs


示例6: ServerExplorerItem_Equals_ExpectEqualityOnGuidOnly

        public void ServerExplorerItem_Equals_ExpectEqualityOnGuidOnly()
        {
            //------------Setup for test--------------------------
            var guid = Guid.NewGuid();
            const string name = "a";
            const ResourceType explorerItemType = ResourceType.PluginService;
            var children = new List<IExplorerItem>();
            const Permissions permissions = Permissions.DeployFrom;


            //------------Execute Test---------------------------
            var serverExplorerItem = new ServerExplorerItem(name, guid, explorerItemType, children, permissions, "");
            var serverExplorerItem2 = new ServerExplorerItem(name, guid, explorerItemType, children, Permissions.Administrator, "");
            var serverExplorerItem3 = new ServerExplorerItem(name, Guid.NewGuid(), explorerItemType, children, permissions, "");
            //------------Assert Results-------------------------

            Assert.AreEqual(serverExplorerItem, serverExplorerItem2);
            Assert.AreNotEqual(serverExplorerItem, null);
            Assert.AreEqual(serverExplorerItem, serverExplorerItem);
            Assert.AreNotEqual(serverExplorerItem, guid);
            Assert.AreNotEqual(serverExplorerItem, serverExplorerItem3);

        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:23,代码来源:ServerExplorerItemTest.cs


示例7: StudioResourceRepository_HideHistory_ClearsChildren

        public void StudioResourceRepository_HideHistory_ClearsChildren()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            var mockVersionRepository = new Mock<IVersionRepository>();
           
            var superWFId = Guid.NewGuid();
            var parent = new ServerExplorerItem
            {
                ResourceType = ResourceType.WorkflowService,
                DisplayName = "SuperWF",
                ResourceId = superWFId,
                Permissions = Permissions.Contribute,
                ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER",
                Children = new List<IExplorerItem>
                    {
                        new ServerExplorerItem{ ResourceType = ResourceType.WebService, DisplayName = "v2 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View },
                        new ServerExplorerItem{ ResourceType = ResourceType.WebService, DisplayName = "v2 2012-10-10 Save", ResourceId = Guid.NewGuid(), Permissions = Permissions.View }
                    }
            };

            SetupEnvironmentRepo(Guid.Empty);

            var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object,
                GetCurrentEnvironment = () => Guid.Empty
            };
            //------------Execute Test---------------------------
            repo.HideVersionHistory(Guid.Empty, superWFId);
            //------------Assert Results-------------------------
            var actual = repo.FindItemById(superWFId);
            Assert.AreEqual(0, actual.Children.Count);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:35,代码来源:StudioResourceRepositoryTests.cs


示例8: StudioResourceRepository_GetEnvironmentModel_HasMatchingID_ReturnsTrue

 public void StudioResourceRepository_GetEnvironmentModel_HasMatchingID_ReturnsTrue()
 {
     //------------Setup for test--------------------------
     var environmentModel = new Mock<IEnvironmentModel>();
     var environmentId = Guid.NewGuid();
     environmentModel.Setup(model => model.ID).Returns(environmentId);
     var mockConnection = new Mock<IEnvironmentConnection>();
     mockConnection.Setup(connection => connection.WebServerUri).Returns(new Uri("http://bob:3142/"));
     var serverID = Guid.NewGuid();
     mockConnection.Setup(connection => connection.ServerID).Returns(serverID);
     environmentModel.Setup(a => a.Connection).Returns(mockConnection.Object);
     ServerExplorerItem serverExplorerItem = new ServerExplorerItem { WebserverUri = "http://bob:3142/", ServerId = serverID };
     //------------Execute Test---------------------------
     var found = StudioResourceRepository.GetEnvironmentModel(environmentModel.Object, serverExplorerItem, environmentId);
     //------------Assert Results-------------------------
     Assert.IsTrue(found);
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:17,代码来源:StudioResourceRepositoryTests.cs


示例9: StudioResourceRepository_ShowVersionHistory_NoItemsReturned_InfoItemAttachedToParent

        public void StudioResourceRepository_ShowVersionHistory_NoItemsReturned_InfoItemAttachedToParent()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            var mockVersionRepository = new Mock<IVersionRepository>();
            mockVersionRepository.Setup(m => m.GetVersions(It.IsAny<Guid>())).Returns(new List<IExplorerItem>());

            var superWFId = Guid.NewGuid();
            var parent = new ServerExplorerItem
            {
                ResourceType = ResourceType.WorkflowService,
                DisplayName = "SuperWF",
                ResourceId = superWFId,
                Permissions = Permissions.Contribute,
                ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
            };

            SetupEnvironmentRepo(Guid.Empty);

            var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object,
                GetCurrentEnvironment = () => Guid.Empty
            };
            //------------Execute Test---------------------------
            repo.ShowVersionHistory(Guid.Empty, superWFId);
            //------------Assert Results-------------------------
            var actual = repo.FindItemById(superWFId);
            Assert.AreEqual(1, actual.Children.Count);
            Assert.AreEqual("There is no version history to display", actual.Children[0].DisplayName);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:StudioResourceRepositoryTests.cs


示例10: ServerExplorerRepository_RenameFolder_FilesystemError_ExpectFailureMessage

        public void ServerExplorerRepository_RenameFolder_FilesystemError_ExpectFailureMessage()
        {
            //------------Setup for test--------------------------
            var catalogue = new Mock<IResourceCatalog>();
            ResourceCatalogResult resourceCatalogResult = new ResourceCatalogResult { Status = ExecStatus.Success, Message = "" };
            catalogue.Setup(catalog => catalog.RenameCategory(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>())).Returns(resourceCatalogResult);
            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            var guid = Guid.NewGuid();

            var explorerItem = new ServerExplorerItem(
                "dave", guid,
                ResourceType.DbSource,
                new List<IExplorerItem>()
                , Permissions.Administrator, "bob"
                );
            factory.Setup(a => a.CreateRootExplorerItem(It.IsAny<string>(), It.IsAny<Guid>())).Returns(explorerItem);

            dir.Setup(a => a.Exists(It.IsAny<string>())).Returns(true);
            dir.Setup(a => a.Delete(It.IsAny<string>(), It.IsAny<bool>())).Throws(new FieldAccessException("bob has an error")).Verifiable();

            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());


            //------------Execute Test---------------------------
            var result = serverExplorerRepository.RenameFolder("monkey", "moocowimpi", Guid.NewGuid());
            //------------Assert Results-------------------------
            Assert.AreEqual(result.Message, "bob has an error");
            Assert.AreEqual(result.Status, ExecStatus.AccessViolation);

        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:32,代码来源:ServerExplorerRepositoryTests.cs


示例11: BuildStructureFromFilePath

        private IList<IExplorerItem> BuildStructureFromFilePath(IDirectory directory, string path, string rootPath)
        {

            var firstGen =
                directory.GetDirectories(path)
                         .Where(a => !a.EndsWith("VersionControl"));

            IList<IExplorerItem> children = new List<IExplorerItem>();
            foreach(var resource in firstGen)
            {
                var resourcePath = resource.Replace(rootPath, "").Substring(1);

                var node = new ServerExplorerItem(new DirectoryInfo(resource).Name, Guid.NewGuid(), ResourceType.Folder, null, _authService.GetResourcePermissions(Guid.Empty), resourcePath);
                children.Add(node);
                node.Children = BuildStructureFromFilePath(directory, resource, rootPath);
            }
            return children;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:ExplorerItemFactory.cs


示例12: StudioResourceRepository_GetVersion_VersionIsNull_ThrowsException

        public void StudioResourceRepository_GetVersion_VersionIsNull_ThrowsException()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            var mockVersionRepository = new Mock<IVersionRepository>();
            var parent = new ServerExplorerItem
            {
                ResourceType = ResourceType.WorkflowService,
                DisplayName = "SuperWF",
                ResourceId = Guid.NewGuid(),
                Permissions = Permissions.Contribute,
                ResourcePath = "MANFOLDER\\APRIL WORK\\SUB FOLDER"
            };

            var repo = new StudioResourceRepository(parent, Guid.Empty, _invoke)
            {
                GetVersionProxy = id => mockVersionRepository.Object,
                GetExplorerProxy = id => mockExplorerResourceRepository.Object,
                GetCurrentEnvironment = () => Guid.Empty
            };
            //------------Execute Test---------------------------
            repo.GetVersion(null, Guid.Empty);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:23,代码来源:StudioResourceRepositoryTests.cs


示例13: GetTestData

        private IExplorerItem GetTestData(string workFlowId = "DF279411-F678-4FCC-BE88-A1B613EE51E3",
                                          string dbServiceId = "DF279411-F678-4FCC-BE88-A1B613EE51E3", Guid? folderID = null)
        {
            var workflow1 = new ServerExplorerItem
                {
                    ResourceType = ResourceType.WorkflowService,
                    DisplayName = "workflow1",
                    ResourceId = string.IsNullOrEmpty(workFlowId) ? Guid.NewGuid() : Guid.Parse(workFlowId),
                    Permissions = Permissions.Administrator
                };

            var dbService1 = new ServerExplorerItem { ResourceType = ResourceType.DbService, DisplayName = "dbService1", ResourceId = string.IsNullOrEmpty(dbServiceId) ? Guid.NewGuid() : Guid.Parse(dbServiceId), Permissions = Permissions.Contribute };
            var webService1 = new ServerExplorerItem { ResourceType = ResourceType.WebService, DisplayName = "webService1", ResourceId = Guid.NewGuid(), Permissions = Permissions.View };
            var pluginService1 = new ServerExplorerItem { ResourceType = ResourceType.PluginService, DisplayName = "pluginService1", ResourceId = Guid.NewGuid(), Permissions = Permissions.View };
            var dbSource1 = new ServerExplorerItem { ResourceType = ResourceType.DbSource, DisplayName = "dbSource1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var webSource1 = new ServerExplorerItem { ResourceType = ResourceType.WebSource, DisplayName = "webSource1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var pluginSource1 = new ServerExplorerItem { ResourceType = ResourceType.PluginSource, DisplayName = "pluginSource1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var emailSource1 = new ServerExplorerItem { ResourceType = ResourceType.EmailSource, DisplayName = "emailSource1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var serverSource1 = new ServerExplorerItem { ResourceType = ResourceType.ServerSource, DisplayName = "serverSource1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var folder1 = new ServerExplorerItem { ResourceType = ResourceType.Folder, DisplayName = "folder1", ResourceId = folderID ?? Guid.NewGuid(), Permissions = Permissions.Administrator };
            var folder2 = new ServerExplorerItem { ResourceType = ResourceType.Folder, DisplayName = "folder2", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var subfolder1 = new ServerExplorerItem { ResourceType = ResourceType.Folder, DisplayName = "subfolder1", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };
            var localhost = new ServerExplorerItem { ResourceType = ResourceType.Server, DisplayName = "localhost", ResourceId = Guid.NewGuid(), Permissions = Permissions.Administrator };

            dbService1.Parent = webService1.Parent = pluginService1.Parent = subfolder1.Parent = folder1;
            dbSource1.Parent = webSource1.Parent = pluginSource1.Parent = emailSource1.Parent = serverSource1.Parent = folder2;

            folder2.Children = new List<IExplorerItem>
                {
                    dbSource1,
                    webSource1,
                    pluginSource1,
                    emailSource1,
                    serverSource1
                };


            folder1.Children = new List<IExplorerItem>
                {
                    dbService1, 
                    webService1,
                    pluginService1, 
                    subfolder1
                };

            localhost.Children = new List<IExplorerItem> { folder1, workflow1 };
            workflow1.Parent = localhost;
            folder1.Parent = localhost;

            return localhost;
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:51,代码来源:StudioResourceRepositoryTests.cs


示例14: MoveItem_Execute_ExpectRename

        public void MoveItem_Execute_ExpectRename()
        {
            //------------Setup for test--------------------------
            var MoveItemService = new MoveItemService();

            ServerExplorerItem item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom, "");
            var repo = new Mock<IExplorerServerResourceRepository>();
            var ws = new Mock<IWorkspace>();
            repo.Setup(a => a.MoveItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Success, "")).Verifiable();

            var serializer = new Dev2JsonSerializer();
            var inputs = new Dictionary<string, StringBuilder>
                {
                    {
                        "itemToMove", serializer.SerializeToBuilder(item)
                    },
                    {
                        "newPath", new StringBuilder("bob")
                    }
                };
            ws.Setup(a => a.ID).Returns(Guid.Empty);
            MoveItemService.ServerExplorerRepo = repo.Object;
            //------------Execute Test---------------------------
            MoveItemService.Execute(inputs, ws.Object);
            //------------Assert Results-------------------------
            repo.Verify(a => a.MoveItem(It.IsAny<IExplorerItem>(), It.IsAny<string>(), It.IsAny<Guid>()));
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:27,代码来源:MoveItemService.cs


示例15: SetupEnvironmentRepo

        public void StudioResourceRepository_ItemAddedMessageHandler_ItemNotFoundInResourceRepo_Workflow_AddedSuccessfully()
        {
            //------------Setup for test--------------------------
            var mockExplorerResourceRepository = new Mock<IClientExplorerResourceRepository>();
            var mockVersionRepository = new Mock<IVersionRepository>();
            var parent = new ServerExplorerItem
                {
                    ResourceType = ResourceType.Folder,
                    DisplayName = "SUB FOLDER",
                    ResourceId = Guid.NewGuid(),
                    Permissions = Permissions.Contribute,
                    ResourcePath = "MANFOLDER\\SUB FOLDER"
                };
            var mockResourceRepo = SetupEnvironmentRepo(Guid.Empty);
            mockResourceRepo.Setup(repository => repository.ReloadResource(It.IsAny<Guid>(), It.Is<Studio.Core.AppResources.Enums.ResourceType>(type => type == Studio.Core.AppResources.Enums.ResourceType.WorkflowService), It.IsAny<IEqualityComparer<IResourceModel>>(), It.IsAny<bool>()));
            // ReSharper disable ObjectCreationAsStatement
            new StudioResourceRepository(parent, Guid.Empty, _invoke)
                // ReSharper restore ObjectCreationAsStatement
                {
                    GetVersionProxy = id => mockVersionRepository.Object,
                    GetExplorerProxy = id => mockExplorerResourceRepository.Object,
                    GetCurrentEnvironment = () => Guid.Empty
                };

            var studioResourceRepository = StudioResourceRepository.Instance;
            //------------Execute Test---------------------------
            studioResourceRepository.ItemAddedMessageHandler(new ServerExplorerItem
                {
                    DisplayName = "TEST FOLDER",
                    ResourcePath = "MANFOLDER\\SUB FOLDER\\TEST FOLDER",
                    ResourceType = ResourceType.WorkflowService
                });

            //------------Assert Results-------------------------
            mockResourceRepo.Verify(repository => repository.ReloadResource(It.IsAny<Guid>(), It.Is<Studio.Core.AppResources.Enums.ResourceType>(type => type == Studio.Core.AppResources.Enums.ResourceType.WorkflowService), It.IsAny<IEqualityComparer<IResourceModel>>(), It.IsAny<bool>()), Times.Once());
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:36,代码来源:StudioResourceRepositoryTests.cs


示例16: GetDirectoriesRelativeToServer_UnitTest_ExecuteWithDirectory_ExpectDirectoryStructure

        public void GetDirectoriesRelativeToServer_UnitTest_ExecuteWithDirectory_ExpectDirectoryStructure()
        {
            //----------------Setup---------------------------------------------
            var esb = new GetDirectoriesRelativeToServer();
            Mock<IExplorerServerResourceRepository> mockRepo = new Mock<IExplorerServerResourceRepository>();
            ServerExplorerItem serverExplorerItem = new ServerExplorerItem();
            serverExplorerItem.ResourceType = ResourceType.Server;
            ServerExplorerItem levelOneFolder = new ServerExplorerItem();
            levelOneFolder.ResourceType = ResourceType.Folder;
            levelOneFolder.DisplayName = "Test1";
            levelOneFolder.ResourcePath = "Test1";
            serverExplorerItem.Children.Add(levelOneFolder);
            IExplorerItem levelOneFolderTwo = new ServerExplorerItem();
            levelOneFolderTwo.ResourceType = ResourceType.Folder;
            levelOneFolderTwo.DisplayName = "Test2";
            levelOneFolderTwo.ResourcePath = "Test2";
            ServerExplorerItem levelTwoFolderInFolderTwo = new ServerExplorerItem();
            levelTwoFolderInFolderTwo.ResourceType = ResourceType.Folder;
            levelTwoFolderInFolderTwo.DisplayName = "InnerTest2";
            levelTwoFolderInFolderTwo.ResourcePath = levelOneFolderTwo.ResourcePath + "\\InnerTest2";
            levelOneFolderTwo.Children.Add(levelTwoFolderInFolderTwo);
            serverExplorerItem.Children.Add(levelOneFolderTwo);
            mockRepo.Setup(repository => repository.Load(ResourceType.Folder, It.IsAny<string>())).Returns(serverExplorerItem);
            esb.ServerExplorerRepo = mockRepo.Object;
            //----------------Execute------------------------------------------------
            var actual = esb.Execute(new Dictionary<string, StringBuilder> { { "Directory", new StringBuilder("Resources") } }, null);
            //----------------Assert Results-----------------------------------------
            Assert.AreNotEqual(string.Empty, actual);
            const string expected = @"<JSON>{
  ""$type"": ""Dev2.Runtime.ESB.Management.Services.JsonTreeNode, Dev2.Runtime.Services"",
  ""title"": ""Root"",
  ""isFolder"": true,
  ""key"": ""root"",
  ""isLazy"": false,
  ""children"": [
    {
      ""$type"": ""Dev2.Runtime.ESB.Management.Services.JsonTreeNode, Dev2.Runtime.Services"",
      ""title"": ""Test1"",
      ""isFolder"": true,
      ""key"": ""Test1"",
      ""isLazy"": false,
      ""children"": []
    },
    {
      ""$type"": ""Dev2.Runtime.ESB.Management.Services.JsonTreeNode, Dev2.Runtime.Services"",
      ""title"": ""Test2"",
      ""isFolder"": true,
      ""key"": ""Test2"",
      ""isLazy"": false,
      ""children"": [
        {
          ""$type"": ""Dev2.Runtime.ESB.Management.Services.JsonTreeNode, Dev2.Runtime.Services"",
          ""title"": ""InnerTest2"",
          ""isFolder"": true,
          ""key"": ""Test2\\\\InnerTest2"",
          ""isLazy"": false,
          ""children"": []
        }
      ]
    }
  ]
}</JSON>
";
            var actuals = actual.ToString().Trim();
            Assert.AreEqual(expected.Trim(), actuals);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:66,代码来源:GetDirectoriesRelativeToServerTests.cs


示例17: Equals

 protected bool Equals(ServerExplorerItem other)
 {
     return ResourceId.Equals(other.ResourceId);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:4,代码来源:ServerExplorerItem.cs


示例18: ServerExplorerRepository_CreateItem_FileSystemException_ExpectErrorMessageFromException

        public void ServerExplorerRepository_CreateItem_FileSystemException_ExpectErrorMessageFromException()
        {
            //------------Setup for test--------------------------
            var catalogue = new Mock<IResourceCatalog>();
            var factory = new Mock<IExplorerItemFactory>();
            var dir = new Mock<IDirectory>();
            dir.Setup(a => a.Exists(It.IsAny<string>())).Returns(false);
            dir.Setup(a => a.CreateIfNotExists(It.IsAny<string>())).Throws(new FileNotFoundException("bobe"));
            var sync = new Mock<IExplorerRepositorySync>();
            var serverExplorerRepository = new ServerExplorerRepository(catalogue.Object, factory.Object, dir.Object, sync.Object, new Mock<IServerVersionRepository>().Object, new FileWrapper());
            var item = new ServerExplorerItem("a", Guid.NewGuid(), ResourceType.Folder, null, Permissions.DeployFrom,
                                              "/bob/dave");

            //------------Execute Test---------------------------
            var result = serverExplorerRepository.AddItem(item, Guid.NewGuid());
            //------------Assert Results-------------------------
            Assert.AreEqual(result.Message, "bobe");
            Assert.AreEqual(result.Status, ExecStatus.Fail);
            dir.Verify(a => a.Exists(It.IsAny<string>()));
            dir.Verify(a => a.CreateIfNotExists(It.IsAny<string>()));

        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:22,代码来源:ServerExplorerRepositoryTests.cs


示例19: AddResouceItem

 public void AddResouceItem(IContextualResourceModel resourceModel)
 {
     var explorerItemModel = new ServerExplorerItem { ResourcePath = resourceModel.Category, DisplayName = resourceModel.DisplayName, ResourceId = resourceModel.ID, Permissions = resourceModel.UserPermissions,ServerId = resourceModel.Environment.ID};
     ResourceType resourceType;
     Enum.TryParse(resourceModel.ServerResourceType, out resourceType);
     explorerItemModel.ResourceType = resourceType;
     ItemAddedMessageHandler(explorerItemModel);
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:8,代码来源:StudioResourceRepository.cs


示例20: BuildRoot

 public IExplorerItem BuildRoot()
 {
     ServerExplorerItem serverExplorerItem = new ServerExplorerItem(RootName, Guid.Empty, ResourceType.Server, new List<IExplorerItem>(), _authService.GetResourcePermissions(Guid.Empty), "") { ServerId = HostSecurityProvider.Instance.ServerID, WebserverUri = EnvironmentVariables.WebServerUri };
     return serverExplorerItem;
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:5,代码来源:ExplorerItemFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.ExplorerItemModel类代码示例发布时间:2022-05-24
下一篇:
C# Objects.ServiceAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap