Inheritance: Dev2.Runtime.Diagnostics.ExceptionManager
Beispiel #1
0
        public void Paths_Expected_JSONSources()
        {
            var workspaceID = Guid.NewGuid();
            var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
            var servicesPath = Path.Combine(workspacePath, "Services");
            var sourcesPath = Path.Combine(workspacePath, "Sources");
            var pluginsPath = Path.Combine(workspacePath, "Plugins");
            try
            {
                Directory.CreateDirectory(servicesPath);
                Directory.CreateDirectory(sourcesPath);
                Directory.CreateDirectory(pluginsPath);

                var xml = XmlResource.Fetch("Calculate_RecordSet_Subtract");
                xml.Save(Path.Combine(servicesPath, "Calculate_RecordSet_Subtract.xml"));

                xml = XmlResource.Fetch("HostSecurityProviderServerSigned");
                xml.Save(Path.Combine(sourcesPath, "HostSecurityProviderServerSigned.xml"));

                var testResources = new Resources();
                var actual = testResources.Paths("", workspaceID, Guid.Empty);
                Assert.AreEqual("[\"Integration Test Services\\\\Calculate_RecordSet_Subtract\"]", actual);
            }
            finally
            {
                if(Directory.Exists(workspacePath))
                {
                    DirectoryHelper.CleanUp(workspacePath);
                }
            }
        }
Beispiel #2
0
        public void SourcesWithValidArgsExpectedReturnsList()
        {
            var workspaceID = Guid.NewGuid();
            var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
            try
            {
                const int Modulo = 2;
                const int ExpectedCount = 6;
                for(var i = 0; i < ExpectedCount; i++)
                {
                    var resource = new Resource
                    {
                        ResourceID = Guid.NewGuid(),
                        ResourceName = string.Format("My Name {0}", i),
                        ResourcePath = string.Format("My Path {0}", i),
                        ResourceType = (i % Modulo == 0) ? ResourceType.DbSource : ResourceType.Unknown
                    };
                    ResourceCatalog.Instance.SaveResource(workspaceID, resource);
                }
                var resources = new Resources();
                var result = resources.Sources("{\"resourceType\":\"" + ResourceType.DbSource + "\"}", workspaceID, Guid.Empty);

                Assert.AreEqual(ExpectedCount / Modulo, result.Count);
            }
            finally
            {
                if(Directory.Exists(workspacePath))
                {
                    DirectoryHelper.CleanUp(workspacePath);
                }
            }
        }
Beispiel #3
0
 public void SourcesWithInvalidArgsExpectedReturnsEmptyList()
 {
     var resources = new Resources();
     var result = resources.Sources("xxxx", Guid.Empty, Guid.Empty);
     Assert.AreEqual(0, result.Count);
 }
Beispiel #4
0
        // ReSharper disable InconsistentNaming
        public void Resources_UnitTest_PluginPathsAndNames_WorkflowServicesAreIncluded()
        // ReSharper restore InconsistentNaming
        {
            //Isolate PathsAndNames for workflows as a functional unit
            var workspaceID = Guid.NewGuid();
            var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
            try
            {
                const int Modulo = 4;
                const int TotalResourceCount = 9;
                for (var i = 0; i < TotalResourceCount; i++)
                {
                    var resource = new Resource
                    {
                        ResourceID = Guid.NewGuid(),
                        ResourceName = string.Format("My Name {0}", i),
                        ResourcePath = string.Format("My Path {0}\\{1}", i, string.Format("My Name {0}", i))
                    };

                    switch (i % Modulo)
                    {
                        case 0:
                            resource.ResourcePath = ResourceType.WorkflowService + "\\" + resource.ResourceName;
                            resource.ResourceType = ResourceType.WorkflowService;
                            break;
                        case 1:
                            resource.ResourcePath = ResourceType.DbService + "\\" + resource.ResourceName;
                            resource.ResourceType = ResourceType.DbService;
                            break;
                        case 2:
                            resource.ResourcePath = ResourceType.PluginService + "\\" + resource.ResourceName;
                            resource.ResourceType = ResourceType.PluginService;
                            break;
                        case 3:
                            resource.ResourcePath = ResourceType.ServerSource + "\\" + resource.ResourceName;
                            resource.ResourceType = ResourceType.ServerSource;
                            break;
                    }
                    ResourceCatalog.Instance.SaveResource(workspaceID, resource);
                }
                var resources = new Resources();
                const string ExpectedJson = "{\"Names\":[\"My Name 3\",\"My Name 7\"],\"Paths\":[\"ServerSource\"]}";

                //Run PathsAndNames
                var actualJson = resources.PathsAndNames("ServerSource", workspaceID,Guid.Empty);

                //Assert CorrectListReturned
                Assert.AreEqual(ExpectedJson, actualJson, "Incorrect list of names and paths for workflow services");
            }
            finally
            {
                if (Directory.Exists(workspacePath))
                {
                    DirectoryHelper.CleanUp(workspacePath);
                }
            }
        }
Beispiel #5
0
        public void DataListInputWhereValidArgsDataListHasNoInputsExpectEmptyString()
        {
            //------------Setup for test--------------------------
            LoadActivitiesPresentationDll();
            var workspaceID = Guid.NewGuid();

            var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
            try
            {
                string completePath = Path.Combine(workspacePath, "Bugs");
                if(Directory.Exists(completePath))
                {
                    Directory.Delete(completePath);
                }
                var xml = XmlResource.Fetch("Bug6619");
                var resourcePath = xml.Element("Category");
                Directory.CreateDirectory(completePath);
                Assert.IsNotNull(resourcePath);
                xml.Save(Path.Combine(workspacePath, resourcePath.Value + ".xml"));
                var resources = new Resources();
                //-----------------Assert Preconditions-----------------------------
                Assert.IsNotNull(resourcePath);
                var resource = ResourceCatalog.Instance.GetResource(workspaceID, resourcePath.Value);
                Assert.IsNotNull(resource);
                //------------Execute Test---------------------------
                var dataListInputVariables = resources.DataListInputVariables(resource.ResourceID.ToString(), workspaceID, Guid.Empty);
                //------------Assert Results-------------------------
                Assert.IsTrue(string.IsNullOrEmpty(dataListInputVariables));
            }
            finally
            {
                if(Directory.Exists(workspacePath))
                {
                    DirectoryHelper.CleanUp(workspacePath);
                }
            }
        }
Beispiel #6
0
 public void DataListInputWhereValidArgsDataListHasInputsScalarsAndRecSetExpectCorrectString()
 {
     //------------Setup for test--------------------------
     var workspaceID = Guid.NewGuid();
     var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
     try
     {
         string completePath = Path.Combine(workspacePath, "Mo");
         if(Directory.Exists(completePath))
         {
             Directory.Delete(completePath);
         }
         var xml = XmlResource.Fetch("TestForEachOutput");
         var resourcePath = xml.Element("Category");
         Directory.CreateDirectory(completePath);
         Assert.IsNotNull(resourcePath);
         xml.Save(Path.Combine(workspacePath, resourcePath.Value + ".xml"));
         var resources = new Resources();
         //---------------Assert Preconditions------------------------------
         Assert.IsNotNull(resourcePath);
         var resource = ResourceCatalog.Instance.GetResource(workspaceID, resourcePath.Value);
         Assert.IsNotNull(resource);
         //------------Execute Test---------------------------
         var dataListInputVariables = resources.DataListInputVariables(resource.ResourceID.ToString(), workspaceID, Guid.Empty);
         //------------Assert Results-------------------------
         StringAssert.Contains(dataListInputVariables, "inputScalar");
         StringAssert.Contains(dataListInputVariables, "bothScalar");
     }
     finally
     {
         if(Directory.Exists(workspacePath))
         {
             DirectoryHelper.CleanUp(workspacePath);
         }
     }
 }
Beispiel #7
0
 public void DataListInputVariablesWhereInvalidArgsExpectEmptyString()
 {
     //------------Setup for test--------------------------
     var resources = new Resources();
     //------------Execute Test---------------------------
     var result = resources.DataListInputVariables("xxxx", Guid.Empty, Guid.Empty);
     //------------Assert Results-------------------------
     Assert.AreEqual("", result);
 }
Beispiel #8
0
 public void ServicesWithNullArgsExpectedReturnsEmptyList()
 {
     var resources = new Resources();
     var result = resources.Services(null, Guid.Empty, Guid.Empty);
     Assert.AreEqual(0, result.Count);
 }