コード例 #1
0
        public void RoundedToFactor_ShouldReturnValidResult_ForUInt16_UsingLowFactor_InOutwardOnlyMode()
        {
            // Arrange.
            UInt16 target = 10;
            UInt16 factor = 3;
            var    mode   = FactorRoundingMode.OutwardOnly;

            // Act.
            var result = target.RoundedToFactor(factor, mode);

            // Assert.
            result.Should().Be(12);
        }
コード例 #2
0
        public void RoundedToFactor_ShouldReturnValidResult_ForUInt16_UsingHighFactor_InInwardOrOutwardMode()
        {
            // Arrange.
            UInt16 target = 10;
            UInt16 factor = 6;
            var    mode   = FactorRoundingMode.InwardOrOutward;

            // Act.
            var result = target.RoundedToFactor(factor, mode);

            // Assert.
            result.Should().Be(12);
        }
コード例 #3
0
        public void RoundedToFactor_ShouldRaiseArgumentOutOfRangeException_ForUInt16_WithUnspecifiedModeArgument()
        {
            // Arrange.
            UInt16 target = 10;
            UInt16 factor = 5;
            var    mode   = FactorRoundingMode.Unspecified;

            // Act.
            var action = new Action(() =>
            {
                var result = target.RoundedToFactor(factor, mode);
            });

            // Assert.
            action.Should().Throw <ArgumentOutOfRangeException>();
        }