Esempio n. 1
0
        public override void PerformTest(params object[] parameters)
        {
            var length             = int.Parse(parameters[0].ToString());
            var excludedCharacters = new List <char>();

            for (int i = 1; i < parameters.Length; i++)
            {
                excludedCharacters.Add((char)parameters[i]);
            }

            var excludedCharactersArray = excludedCharacters.ToArray();

            for (int i = 0; i < ExecutionTimes; i++)
            {
                string randomValue = RandomAlphanumericString.GenerateValueWithout(length, excludedCharactersArray);

                if (string.IsNullOrEmpty(randomValue))
                {
                    WrongResults.Add("NULL");
                }
                else if (ContainsAnyExcludedCharacter(randomValue, excludedCharacters))
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }

            fileLogger.LogResult(WrongResults);
        }
Esempio n. 2
0
        public override void PerformTest(params object[] parameters)
        {
            ValidateConfitions(parameters);
            int length = int.Parse(parameters[0].ToString());

            var excludedCharacters = new List <char>();

            for (int i = 1; i < parameters.Length; i++)
            {
                excludedCharacters.Add((char)parameters[i]);
            }

            for (int i = 0; i < ExecutionTimes; i++)
            {
                string randomValue = randomString.GenerateValueWithout(length, excludedCharacters.ToArray());

                char[] randomValueArray = randomValue.ToCharArray();

                if (string.IsNullOrEmpty(randomValue))
                {
                    WrongResults.Add("NULL");
                }
                else if (randomValue.Length != length || randomValueArray.Any(item => excludedCharacters.Contains(item)) || randomValueArray.Any(item => item < Consts.FirstCharacterHex) || randomValueArray.Any(item => (item > Consts.LastCharacterHex)))
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }

            fileLogger.LogResult(WrongResults);
        }
Esempio n. 3
0
 public override void PerformTest(params System.DateTime[] parameters)
 {
     for (int i = 0; i < ExecutionTimes; i++)
     {
         System.DateTime randomValue = randomDateTime.GenerateNegativeValue();
         if (randomValue > System.DateTime.Now)
         {
             WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
         }
     }
     fileLogger.LogResult(WrongResults);
 }
Esempio n. 4
0
 public override void PerformTest(params short[] parameters)
 {
     for (int i = 0; i < ExecutionTimes; i++)
     {
         short randomValue = randomShort.GenerateNegativeValue();
         if (randomValue > 0)
         {
             WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
         }
     }
     fileLogger.LogResult(WrongResults);
 }
Esempio n. 5
0
 public override void PerformTest(params long[] parameters)
 {
     for (int i = 0; i < ExecutionTimes; i++)
     {
         long randomValue = randomLong.GeneratePositiveValue();
         if (randomValue < 0)
         {
             WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
         }
     }
     fileLogger.LogResult(WrongResults);
 }
Esempio n. 6
0
        public override void CheckResearch()
        {
            foreach (var item in CorrectResults)
            {
                string a = item.Key;

                if (resultsPatient.ContainsKey(item.Key) && !Compare(resultsPatient[a], CorrectResults[a]))
                {
                    WrongResults.Add(a, resultsPatient[a]);
                }
            }
        }
Esempio n. 7
0
 public override void PerformTest(params char[] parameters)
 {
     for (int i = 0; i < ExecutionTimes; i++)
     {
         char randomValue       = randomCharacter.GenerateValue();
         var  randomArrayValues = new string(new[] { randomValue });
         if (randomArrayValues.Any(char.IsLetter) == false && randomArrayValues.Any(char.IsDigit) == false)
         {
             WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
         }
     }
     fileLogger.LogResult(WrongResults);
 }
Esempio n. 8
0
 public override void PerformTest(params object[] parameters)
 {
     for (int i = 0; i < ExecutionTimes; i++)
     {
         string randomValue = RandomAlphanumericString.GenerateUpperCaseValue(100);
         if (string.IsNullOrEmpty(randomValue))
         {
             WrongResults.Add("NULL");
         }
         else if (randomValue.Any(char.IsLower) || IsLetterOrDigit(randomValue) == false)
         {
             WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
         }
     }
     fileLogger.LogResult(WrongResults);
 }
Esempio n. 9
0
        public override void PerformTest(params int[] parameters)
        {
            int minValue = parameters[0];

            int maxValue = parameters[1];

            for (int i = 0; i < ExecutionTimes; i++)
            {
                int randomValue = randomInteger.GenerateValue(minValue, maxValue);
                if (randomValue > maxValue || randomValue < minValue)
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }
            fileLogger.LogResult(WrongResults);
        }
Esempio n. 10
0
        public override void PerformTest(params long[] parameters)
        {
            ValidateConfitions(parameters);
            long minValue = parameters[0];

            long maxValue = parameters[1];


            for (int i = 0; i < ExecutionTimes; i++)
            {
                long randomValue = randomLong.GenerateValue(minValue, maxValue);
                if (randomValue > maxValue || randomValue < minValue)
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }
            fileLogger.LogResult(WrongResults);
        }
Esempio n. 11
0
        public override void PerformTest(params short[] parameters)
        {
            ValidateConfitions(parameters);
            // ReSharper disable once PossibleNullReferenceException
            short minValue = parameters[0];
            // ReSharper disable once PossibleNullReferenceException
            short maxValue = parameters[1];

            for (int i = 0; i < ExecutionTimes; i++)
            {
                short randomValue = randomShort.GenerateValue(minValue, maxValue);
                if (randomValue > maxValue || randomValue < minValue)
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }
            fileLogger.LogResult(WrongResults);
        }
Esempio n. 12
0
        public override void PerformTest(params object[] parameters)
        {
            for (int i = 0; i < ExecutionTimes; i++)
            {
                string randomValue = randomString.GenerateValue();

                char[] randomValueArray = randomValue.ToCharArray();

                if (string.IsNullOrEmpty(randomValue))
                {
                    WrongResults.Add("NULL");
                }
                else if (randomValue.Length != 25 || randomValueArray.Any(item => item < Consts.FirstCharacterHex) || randomValueArray.Any(item => (item > Consts.LastCharacterHex)))
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }

            fileLogger.LogResult(WrongResults);
        }
Esempio n. 13
0
        public override void PerformTest(params char[] parameters)
        {
            ValidateConfitions(parameters);

            char minValue = parameters[0];

            char maxValue = parameters[1];

            int minValueIndex = Consts.AlphanumericCharacters.IndexOf(minValue);
            int maxValueIndex = Consts.AlphanumericCharacters.IndexOf(maxValue);

            for (int i = 0; i < ExecutionTimes; i++)
            {
                char randomValue        = randomCharacter.GenerateValue(minValue, maxValue);
                int  indexOfRandomValue = Consts.AlphanumericCharacters.IndexOf(randomValue);

                if (indexOfRandomValue < minValueIndex || indexOfRandomValue > maxValueIndex)
                {
                    WrongResults.Add(Consts.AlphanumericCharacters[indexOfRandomValue].ToString());
                }
            }
            fileLogger.LogResult(WrongResults);
        }
Esempio n. 14
0
        public override void PerformTest(params System.DateTime[] parameters)
        {
            ValidateConfitions(parameters);

            System.DateTime minValue = parameters[0];

            System.DateTime maxValue = parameters[1];

            for (int i = 0; i < ExecutionTimes; i++)
            {
                System.DateTime randomValue = randomDateTime.GenerateValue(minValue, maxValue);

                // very specific condition :(
                if ((randomValue > maxValue || randomValue < minValue) && IsDifferenceOnlyInMilliseconds(minValue, maxValue, randomValue) == false)
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }
            if (WrongResults.Count > 0)
            {
                fileLogger.LogResult(WrongResults, minValue.ToString(CultureInfo.InvariantCulture), maxValue.ToString(CultureInfo.InvariantCulture));
            }
        }
Esempio n. 15
0
        public override void PerformTest(params object[] parameters)
        {
            ValidateConfitions(parameters);
            int fixedLenght = int.Parse(parameters[0].ToString());

            for (int i = 0; i < ExecutionTimes; i++)
            {
                string randomValue = randomString.GenerateUpperCaseValue(fixedLenght);

                char[] randomValueArray = randomValue.ToCharArray();

                if (string.IsNullOrEmpty(randomValue))
                {
                    WrongResults.Add("NULL");
                }
                else if (randomValue.Length != fixedLenght || randomValueArray.Any(item => item < Consts.FirstCharacterHex) || randomValueArray.Any(item => item > Consts.LastCharacterHex) ||
                         randomValueArray.Any(char.IsLower))
                {
                    WrongResults.Add(randomValue.ToString(CultureInfo.InvariantCulture));
                }
            }

            fileLogger.LogResult(WrongResults);
        }