Sources() public method

public Sources ( string args, System.Guid workspaceID, System.Guid dataListID ) : ResourceList
args string
workspaceID System.Guid
dataListID System.Guid
return ResourceList
コード例 #1
0
ファイル: ResourcesTests.cs プロジェクト: Robin--/Warewolf
        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);
                }
            }
        }
コード例 #2
0
ファイル: ResourcesTests.cs プロジェクト: Robin--/Warewolf
 public void SourcesWithInvalidArgsExpectedReturnsEmptyList()
 {
     var resources = new Resources();
     var result = resources.Sources("xxxx", Guid.Empty, Guid.Empty);
     Assert.AreEqual(0, result.Count);
 }