Tmx.TestData.GetTestSuite C# (CSharp) Method

GetTestSuite() static private method

static private GetTestSuite ( string testSuiteName, string testSuiteId, System.Guid testPlatformUniqueId ) : ITestSuite
testSuiteName string
testSuiteId string
testPlatformUniqueId System.Guid
return ITestSuite
        internal static ITestSuite GetTestSuite(string testSuiteName, string testSuiteId, Guid testPlatformUniqueId)
        {
            ITestSuite result = null;
            
            if (!string.IsNullOrEmpty(testSuiteName)) {
                foreach (var testSuite in TestSuites.Where(ts => ts.Name == testSuiteName)) {
                    
                    // id does not match
                    if (!string.IsNullOrEmpty(testSuiteId) && testSuiteId != testSuite.Id)
                        continue;
                    // 20140902
//                    if (!string.IsNullOrEmpty(testSuiteId) && testSuiteId == testSuite.Id) {
//                        if (testPlatformId != testSuite.PlatformId)
//                            continue;
//                        result = testSuite;
//                    }
//                   
//                    if (string.IsNullOrEmpty(testSuiteId)) {
//                        // does this code ever work?
//                        if (testPlatformId != testSuite.PlatformId)
//                            continue;
//                        result = testSuite;
//                    }
//                    
//                    if (result != null)
//                        return result;
                    // 20140922
                    if (string.IsNullOrEmpty(testSuiteId) || testSuiteId == testSuite.Id)
                        // result = testSuite;
                        // 20141114
                        // if (testPlatformId == testSuite.PlatformId)
                        // 20141119
                        // if (testPlatformUniqueId == testSuite.PlatformId)
                        if (testPlatformUniqueId == testSuite.PlatformUniqueId)
                            result = testSuite;
                    if (null != result)
                       return result;
                }
            }
            
            if (!string.IsNullOrEmpty(testSuiteId)) {
                foreach (var testSuite in TestSuites) {
                    if (testSuite.Id == testSuiteId) {
                        
                        // 20141114
                        // if (testPlatformId != testSuite.PlatformId)
                        // 20141119
                        // if (testPlatformUniqueId != testSuite.PlatformId)
                        if (testPlatformUniqueId != testSuite.PlatformUniqueId)
                            continue;
                        if (testSuiteName != testSuite.Name && !string.IsNullOrEmpty(testSuiteName))
                            continue;
                        result = testSuite;
                        return result;
                    }
                }
            }
            return result;
        }