Esempio n. 1
0
        public void GivenAnyWhenEmailStringThenEmailReturned()
        {
            var email = AnyVal.EmailString();

            email.Should().MatchRegex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
            Console.WriteLine(email);
        }
Esempio n. 2
0
        public void GivenAnyWhenNegativeIntegerThenNegativeIntegerReturned()
        {
            var negativeInt = AnyVal.NegativeInt32();

            negativeInt.Should().BeLessOrEqualTo(0);
            Console.WriteLine(negativeInt);
        }
Esempio n. 3
0
        public void GivenAnyWhenPositiveIntegerThenPositiveIntegerReturned()
        {
            var positiveInt = AnyVal.PositiveInt32();

            positiveInt.Should().BeGreaterOrEqualTo(0);
            Console.WriteLine(positiveInt);
        }
Esempio n. 4
0
        public void GivenAnyWhenFloatThenFloatReturned()
        {
            var floatVal = AnyVal.Decimal();

            floatVal.Should().BeLessOrEqualTo(100);
            Console.WriteLine(floatVal);
        }
Esempio n. 5
0
        public void GivenAnyWhenAddressThenAddressReturned()
        {
            var addressReturned = AnyVal.AddressString();

            addressReturned.Should().MatchRegex("^[0-9]{1,4} [a-zA-Z]{8,16} [a-zA-Z]{2}$");
            Console.WriteLine(addressReturned);
        }
Esempio n. 6
0
        public void GivenAnyAndWhenStringWithSingleQuotesThenStringWithQuotesReturned()
        {
            var alpha = AnyVal.StringWithSingleQuotes();

            alpha.Should().NotBeNullOrEmpty();
            alpha.Should().Contain("\'");
        }
Esempio n. 7
0
        public void GivenAnyWhenAlphanumericThenAlphanumericReturned()
        {
            var alphaNumericReturned = AnyVal.Alphanumeric();

            alphaNumericReturned.Should().MatchRegex("^[a-zA-Z0-9]*");
            Console.WriteLine(alphaNumericReturned);
        }
Esempio n. 8
0
        public void GivenAnyWhenPositiveLongThenPositiveLongReturned()
        {
            var positiveLong = AnyVal.PositiveInt64();

            positiveLong.Should().BeGreaterOrEqualTo(0);
            Console.WriteLine(positiveLong);
        }
Esempio n. 9
0
        public void GivenAnyWhenFloatMaxValThenFloatMaxValReturned()
        {
            const int maxVal   = 500;
            var       floatVal = AnyVal.Decimal(maxVal);

            floatVal.Should().BeLessOrEqualTo(maxVal);
            Console.WriteLine(floatVal);
        }
Esempio n. 10
0
        public void GivenAnyWhenAlphaThenAlphaReturned()
        {
            var alpha = AnyVal.String();

            alpha.Should().NotBeNullOrEmpty();
            alpha.Should().MatchRegex("^[a-zA-Z]+$");
            Console.WriteLine(alpha);
        }
Esempio n. 11
0
        public void GivenAnyWhenAlphaLowercaseThenAlphaLowerCaseReturned()
        {
            var alphaLowerCase = AnyVal.StringLowerCase();

            alphaLowerCase.Should().NotBeNullOrEmpty();
            alphaLowerCase.Should().MatchRegex("^[a-z]+$");
            Console.WriteLine(alphaLowerCase);
        }
Esempio n. 12
0
        public void GivenAnyWhenDateAfterThenDateAfterReturned()
        {
            var dateAfter        = DateTime.Now;
            var dateAfterFromAny = AnyVal.DateTimeAfter(dateAfter);

            dateAfterFromAny.Should().BeAfter(dateAfter);
            Console.WriteLine(dateAfterFromAny);
        }
Esempio n. 13
0
        public void GivenAnyWhenDateBeforeThenDateBeforeReturned()
        {
            var dateBefore        = DateTime.Now;
            var dateBeforeFromAny = AnyVal.DateTimeBefore(dateBefore);

            dateBeforeFromAny.Should().BeBefore(dateBefore);
            Console.WriteLine(dateBeforeFromAny);
        }
Esempio n. 14
0
        public void GivenAnyWhenEnumValueOfThenEnumValueReturned()
        {
            var enumValue = AnyVal.OfEnum <TestEnum>();

            ((int)enumValue).Should().BeGreaterOrEqualTo((int)TestEnum.First);
            ((int)enumValue).Should().BeLessOrEqualTo((int)TestEnum.Third);
            Console.WriteLine(enumValue.ToString());
        }
Esempio n. 15
0
        public void GivenAnyWhenShortParagraphThenParagraphReturned()
        {
            const int maximumLength     = 1;
            var       paragraphReturned = AnyVal.Paragraphs(maximumLength);

            paragraphReturned.Length.Should().Be(maximumLength);
            Console.WriteLine(paragraphReturned);
        }
Esempio n. 16
0
        public void GivenMinValueAndMaxValueWhenNegativeInt32ThenNegativeValueReturned()
        {
            const int startValue    = -200;
            const int endValue      = -100;
            var       negativeValue = AnyVal.NegativeInt32(startValue, endValue);

            negativeValue.Should().BeGreaterOrEqualTo(startValue);
            negativeValue.Should().BeLessOrEqualTo(endValue);
        }
Esempio n. 17
0
        public void GivenNegativeFirstIntegerAndPositiveSecondIntegerWhenPositiveIntegerThenValueReturned()
        {
            const int startValue    = -100;
            const int endValue      = 100;
            var       positiveRange = AnyVal.PositiveInt32(startValue, endValue);

            positiveRange.Should().Be(endValue);
            Console.WriteLine(positiveRange);
        }
Esempio n. 18
0
        public void GivenAnyWhenNegativeIntegerMaxThenNegativeIntegerReturned()
        {
            const int minValue    = -50;
            var       negativeInt = AnyVal.NegativeInt32(minValue);

            negativeInt.Should().BeLessOrEqualTo(0);
            negativeInt.Should().BeGreaterOrEqualTo(minValue);
            Console.WriteLine(negativeInt);
        }
Esempio n. 19
0
 public void GivenAnyWhenEnumValueOfExceptFirstThenEnumValueReturned()
 {
     for (var tries = 0; tries < 20; tries++)
     {
         var enumValue = AnyVal.OfEnumExceptFirst <TestEnum>();
         enumValue.Should().NotBe(TestEnum.First);
         Console.WriteLine(enumValue.ToString());
     }
 }
Esempio n. 20
0
        public void GivenAnyWhenPositiveIntegerMaxThenPositiveIntegerReturned()
        {
            const int maxValue    = 50;
            var       positiveInt = AnyVal.PositiveInt32(maxValue);

            positiveInt.Should().BeLessOrEqualTo(maxValue);
            positiveInt.Should().BeGreaterOrEqualTo(0);
            Console.WriteLine(positiveInt);
        }
Esempio n. 21
0
        public void GivenAnyWhenAlphanumericWithSizeThenAlphanumericReturned()
        {
            var size = AnyVal.PositiveInt32(32);
            var alphaNumericReturned = AnyVal.Alphanumeric(size);

            alphaNumericReturned.Should().MatchRegex("^[a-zA-Z0-9]*");
            alphaNumericReturned.Length.Should().Be(size);
            Console.WriteLine(alphaNumericReturned);
        }
Esempio n. 22
0
        public void GivenAnyAndSmallSizeWhenStringWithSingleQuotesThenStringWithQuotesReturned()
        {
            const int maxLength = 2;
            var       alpha     = AnyVal.StringWithSingleQuotes(maxLength);

            alpha.Length.Should().Be(maxLength);
            alpha.Should().NotBeNullOrEmpty();
            alpha.Should().Contain("\'");
        }
Esempio n. 23
0
        public void GivenAnyWhenDateThenDateReturned()
        {
            var dateVal  = AnyVal.DateTime();
            var thisYear = DateTime.Now.Date.Year;

            dateVal.Should().BeAfter(new DateTime(thisYear - 25, 1, 1));
            dateVal.Should().BeBefore(new DateTime(thisYear + 25, 12, 31));
            Console.WriteLine(dateVal);
        }
Esempio n. 24
0
        public void GivenNegativeFirstIntegerAndNegativeSecondIntegerWhenPositiveIntegerThenValueReturned()
        {
            const int startValue    = -100;
            const int endValue      = -200;
            var       positiveValue = AnyVal.PositiveInt32(startValue, endValue);

            positiveValue.Should().BeGreaterOrEqualTo(Math.Abs(startValue));
            positiveValue.Should().BeLessOrEqualTo(Math.Abs(endValue));
            Console.WriteLine(positiveValue);
        }
Esempio n. 25
0
        public void GivenAnyWhenNegativeRangeThenPositiveInRangeReturned()
        {
            const int startValue    = 1024;
            const int endValue      = -2048;
            var       positiveRange = AnyVal.PositiveInt32(startValue, endValue);

            positiveRange.Should().BeGreaterOrEqualTo(startValue);
            positiveRange.Should().BeLessOrEqualTo(Math.Abs(endValue));
            Console.WriteLine(positiveRange);
        }
Esempio n. 26
0
        public void GivenAnyWhenAlphaMaxLenThenAlphaMaxLenReturned()
        {
            const int maxLength = 120;
            var       alpha     = AnyVal.String(maxLength);

            alpha.Length.Should().BeLessOrEqualTo(maxLength);
            alpha.Should().NotBeNullOrEmpty();
            alpha.Should().MatchRegex("^[a-zA-Z]{" + maxLength + "}$");
            Console.WriteLine(alpha);
        }
Esempio n. 27
0
        public void GivenAnyWhenLongParagraphThenParagraphReturned()
        {
            const int maximumLength     = 500;
            var       paragraphReturned = AnyVal.Paragraphs(maximumLength);

            paragraphReturned.Length.Should().Be(maximumLength);
            paragraphReturned.Should().Contain(" ");
            paragraphReturned.Should().Contain(".\r\n");
            Console.WriteLine(paragraphReturned);
        }