Пример #1
0
        public void IsEven_ShouldReturnValidResult_ForUInt32()
        {
            // Arrange.
            UInt32 twoHundredFiftySix = 256;
            UInt32 eleven             = 11;
            UInt32 zero  = 0;
            UInt32 one   = 1;
            UInt32 two   = 2;
            UInt32 three = 3;
            UInt32 four  = 4;

            // Act.
            var resultOne   = twoHundredFiftySix.IsEven();
            var resultTwo   = eleven.IsEven();
            var resultThree = zero.IsEven();
            var resultFour  = one.IsEven();
            var resultFive  = two.IsEven();
            var resultSix   = three.IsEven();
            var resultSeven = four.IsEven();

            // Assert.
            resultOne.Should().BeTrue();
            resultTwo.Should().BeFalse();
            resultThree.Should().BeTrue();
            resultFour.Should().BeFalse();
            resultFive.Should().BeTrue();
            resultSix.Should().BeFalse();
            resultSeven.Should().BeTrue();
        }
        public static void RequireArgumentIsOdd(UInt32 valueArgument,
                                                [NotNull] String nameArgument)
        {
            nameArgument.RequireArgumentHasNonWhiteSpaceValue("nameArgument");

            if (valueArgument.IsEven())
            {
                throw new ArgumentOutOfRangeException(nameArgument, valueArgument, String.Format(CultureInfo.InvariantCulture, "{0}.", Resources.ValueMustBeOdd));
            }
        }