Execute() public method

Executes the service
public Execute ( StringBuilder>.Dictionary values, IWorkspace theWorkspace ) : StringBuilder
values StringBuilder>.Dictionary The values.
theWorkspace IWorkspace The workspace.
return StringBuilder
        public void GetDirectoriesRelativeToServer_UnitTest_ExecuteWithNoDirectoryInValues_ExpectedInvalidDataContractException()
        {

            var esb = new GetDirectoriesRelativeToServer();
            var actual = esb.Execute(new Dictionary<string, StringBuilder> { { "DebugFilePath", null } }, null);
            Assert.AreEqual(string.Empty, actual);
        }
        public void GetDirectoriesRelativeToServer_UnitTest_ExecuteWithBlankDirectory_ExpectInvalidDataContractException()
        {

            var esb = new GetDirectoriesRelativeToServer();
            var actual = esb.Execute(new Dictionary<string, StringBuilder> { { "Directory", new StringBuilder() } }, null);
            Assert.AreEqual(string.Empty, actual);
        }
        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);
        }
 public void GetDirectoriesRelativeToServer_UnitTest_ExecuteWithNullValues_ExpectedInvalidDataContractException()
 {
     var esb = new GetDirectoriesRelativeToServer();
     var actual = esb.Execute(null, null);
     Assert.AreEqual(string.Empty, actual);
 }