public void GetNextSelector_ReturnsCorrectSelector() { var s1 = new SurrogateSelector(); var s2 = new SurrogateSelector(); s2.ChainSelector(s1); Assert.Null(s1.GetNextSelector()); Assert.Same(s1, s2.GetNextSelector()); }
public ISurrogateSelector GetNextSelector() { try { return(surrogate.GetNextSelector()); } catch { return(this); } }
public bool runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; SurrogateSelector selector1; SurrogateSelector selector2; SurrogateSelector[] selectorArr; Int32 numberOfSelectors; SurrogateSelector selectorReturned; try { strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); selector2 = new SurrogateSelector(); selector1.ChainSelector(selector2); selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if (selectorReturned != selector2) { iCountErrors++; Console.WriteLine("Err_34905wdsg! Wrong value returned"); } strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if (selectorReturned != null) { iCountErrors++; Console.WriteLine("Err_93475sdg! Wrong value returned"); } strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); numberOfSelectors = 50; selectorArr = new SurrogateSelector[numberOfSelectors]; for (int i = 0; i < numberOfSelectors; i++) { selectorArr[i] = new SurrogateSelector(); selector1.ChainSelector(selectorArr[i]); } for (int i = numberOfSelectors - 1; i >= 0; i--) { selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if (selectorReturned != selectorArr[i]) { iCountErrors++; Console.WriteLine("Err_8345sdg_" + i + "! Wrong value returned"); } selector1 = selectorReturned; } } catch (Exception exc_general) { ++iCountErrors; Console.WriteLine(s_strTFAbbrev + " : Error Err_8888yyy! strLoc==" + strLoc + ", exc_general==" + exc_general.ToString()); Console.WriteLine(exc_general.StackTrace); } if (iCountErrors == 0) { Console.WriteLine("paSs. " + s_strTFPath + " " + s_strTFName + " ,iCountTestcases==" + iCountTestcases); return(true); } else { Console.WriteLine("FAiL! " + s_strTFPath + " " + s_strTFName + " ,iCountErrors==" + iCountErrors + " , BugNums?: " + s_strActiveBugNums); return(false); } }
public ISurrogateSelector GetNextSelector() { return(innerSelector.GetNextSelector()); }
public bool runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; SurrogateSelector selector1; SurrogateSelector selector2; SurrogateSelector[] selectorArr; Int32 numberOfSelectors; SurrogateSelector selectorReturned; try { strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); selector2 = new SurrogateSelector(); selector1.ChainSelector(selector2); selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if(selectorReturned != selector2){ iCountErrors++; Console.WriteLine("Err_34905wdsg! Wrong value returned"); } strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if(selectorReturned != null){ iCountErrors++; Console.WriteLine("Err_93475sdg! Wrong value returned"); } strLoc = "Loc_98374sdg"; iCountTestcases++; selector1 = new SurrogateSelector(); numberOfSelectors = 50; selectorArr = new SurrogateSelector[numberOfSelectors]; for(int i=0; i<numberOfSelectors; i++){ selectorArr[i] = new SurrogateSelector(); selector1.ChainSelector(selectorArr[i]); } for(int i=numberOfSelectors-1; i>=0; i--){ selectorReturned = (SurrogateSelector)selector1.GetNextSelector(); if(selectorReturned != selectorArr[i]){ iCountErrors++; Console.WriteLine("Err_8345sdg_" + i + "! Wrong value returned"); } selector1 = selectorReturned; } } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general.ToString()); Console.WriteLine(exc_general.StackTrace); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums ); return false; } }