Exemplo n.º 1
0
        public void RoundedToFactor_ShouldReturnValidResult_ForUInt32_UsingLowFactor_InOutwardOnlyMode()
        {
            // Arrange.
            UInt32 target = 10;
            UInt32 factor = 3;
            var    mode   = FactorRoundingMode.OutwardOnly;

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

            // Assert.
            result.Should().Be(12);
        }
Exemplo n.º 2
0
        public void RoundedToFactor_ShouldReturnValidResult_ForUInt32_UsingHighFactor_InInwardOrOutwardMode()
        {
            // Arrange.
            UInt32 target = 10;
            UInt32 factor = 6;
            var    mode   = FactorRoundingMode.InwardOrOutward;

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

            // Assert.
            result.Should().Be(12);
        }
Exemplo n.º 3
0
        public void RoundedToFactor_ShouldRaiseArgumentOutOfRangeException_ForUInt32_WithUnspecifiedModeArgument()
        {
            // Arrange.
            UInt32 target = 10;
            UInt32 factor = 5;
            var    mode   = FactorRoundingMode.Unspecified;

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

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