コード例 #1
0
ファイル: Tests.cs プロジェクト: HannaFilon/laba1_OS
        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);
        }
コード例 #2
0
ファイル: Tests.cs プロジェクト: HannaFilon/laba1_OS
        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);
        }
コード例 #3
0
ファイル: Tests.cs プロジェクト: HannaFilon/laba1_OS
        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);
        }