Exemple #1
0
        public void AssertArgument_HalfClosed_NotContained_Exception()
        {
            var subject = new Range <int>(1.Open(), 5.Close());

            Assert.That(() => subject.AssertArgument("arg", 6),
                        Throws.InstanceOf <ArgumentOutOfRangeException>()
                        .With.Message.Contains("(1..5]").And
                        .With.Message.Contains("1 (not inclusive)").And
                        .With.Message.Contains("5 (inclusive)")
                        .With.Property("ParamName").EqualTo("arg").And
                        .With.Property("ActualValue").EqualTo(6));
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of <see cref="Ratio"/> to the value of the specified <see cref="decimal"/>.
 /// </summary>
 /// <remarks>The <paramref name="value"/> must represent a value between 0 and 1.</remarks>
 /// <param name="value">The value to represent as a <see cref="Ratio"/>.</param>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> does not fall in the range [0..1]</exception>
 public Ratio(decimal value) : this()
 {
     _range.AssertArgument("value", value);
     Value = value;
 }
Exemple #3
0
        public void AssertArgument_HalfClosed_Contained_NoException()
        {
            var subject = new Range <int>(1.Open(), 5.Close());

            Assert.That(() => subject.AssertArgument("arg", 4), Throws.Nothing);
        }
Exemple #4
0
 public Quality(float factor)
 {
     _zeroToOne.AssertArgument(nameof(factor), factor);
     Factor = factor;
 }
Exemple #5
0
 internal static void AssertNumberOfRecipients(string paramName, int numberOfRecipients)
 {
     _validityRange.AssertArgument(paramName, numberOfRecipients);
 }