コード例 #1
0
        public void IsEven_ShouldReturnValidResult_ForUInt64()
        {
            // Arrange.
            UInt64 twoHundredFiftySix = 256;
            UInt64 eleven             = 11;
            UInt64 zero  = 0;
            UInt64 one   = 1;
            UInt64 two   = 2;
            UInt64 three = 3;
            UInt64 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(UInt64 valueArgument,
                                                [NotNull] String nameArgument)
        {
            nameArgument.RequireArgumentHasNonWhiteSpaceValue("nameArgument");

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