public void calculate_StringSunRepeatsThreeTimes_DictionaryValueOfElementCatEquals3() { ThreadsFunction.Strings = new List <String>(); ThreadsFunction.SortedStrings = new ConcurrentDictionary <string, int>(); ThreadsFunction.StrPortion = 3; for (int i = 0; i < 3; i++) { ThreadsFunction.Strings.Add("Sun"); } int begin = 0; //act ThreadsFunction.Calculate(begin); //assert Assert.AreEqual(ThreadsFunction.SortedStrings.GetValueOrDefault("Sun"), 3); }
public void calculate_EndBorderIsBiggerThanDictionarySize_DictionarySizeEqualsN() { //arrange ThreadsFunction.Strings = new List <String>(); ThreadsFunction.SortedStrings = new ConcurrentDictionary <string, int>(); ThreadsFunction.StrPortion = 18; for (int i = 0; i < 7; i++) { ThreadsFunction.Strings.Add(i.ToString()); } int begin = 0; //act ThreadsFunction.Calculate(begin); //assert Assert.AreEqual(ThreadsFunction.SortedStrings.Count, 7); }
public void calculate_AllStringsAreTheSame_DictionarySizeEqualsOne() { //arrange ThreadsFunction.Strings = new List <String>(); ThreadsFunction.SortedStrings = new ConcurrentDictionary <string, int>(); ThreadsFunction.StrPortion = 7; for (int i = 0; i < 7; i++) { ThreadsFunction.Strings.Add("Nice smile"); } int begin = 0; //act ThreadsFunction.Calculate(begin); //assert Assert.AreEqual(ThreadsFunction.SortedStrings.Count, 1); }