diff --git a/csharp/Platform.Ranges.Tests/RangeTests.cs b/csharp/Platform.Ranges.Tests/RangeTests.cs index 8806ded..61025c4 100644 --- a/csharp/Platform.Ranges.Tests/RangeTests.cs +++ b/csharp/Platform.Ranges.Tests/RangeTests.cs @@ -53,5 +53,21 @@ public static void EqualityTest() Assert.True(range1 != range2); Assert.NotEqual(range1, range2); } + + [Fact] + public static void PositiveRangesTest() + { + Assert.Equal(1, Range.PositiveSByte.Minimum); + Assert.Equal(sbyte.MaxValue, Range.PositiveSByte.Maximum); + + Assert.Equal(1, Range.PositiveInt16.Minimum); + Assert.Equal(short.MaxValue, Range.PositiveInt16.Maximum); + + Assert.Equal(1, Range.PositiveInt32.Minimum); + Assert.Equal(int.MaxValue, Range.PositiveInt32.Maximum); + + Assert.Equal(1L, Range.PositiveInt64.Minimum); + Assert.Equal(long.MaxValue, Range.PositiveInt64.Maximum); + } } } diff --git a/csharp/Platform.Ranges/Range.cs b/csharp/Platform.Ranges/Range.cs index 33422cd..516aa8a 100644 --- a/csharp/Platform.Ranges/Range.cs +++ b/csharp/Platform.Ranges/Range.cs @@ -71,5 +71,29 @@ public static class Range /// Возвращает весь диапазон значений . /// public static readonly Range Decimal = new Range(decimal.MinValue, decimal.MaxValue); + + /// + /// Gets the positive values range (from 1 to ). + /// Возвращает положительный диапазон значений (от 1 до ). + /// + public static readonly Range PositiveSByte = new Range(1, sbyte.MaxValue); + + /// + /// Gets the positive values range (from 1 to ). + /// Возвращает положительный диапазон значений (от 1 до ). + /// + public static readonly Range PositiveInt16 = new Range(1, short.MaxValue); + + /// + /// Gets the positive values range (from 1 to ). + /// Возвращает положительный диапазон значений (от 1 до ). + /// + public static readonly Range PositiveInt32 = new Range(1, int.MaxValue); + + /// + /// Gets the positive values range (from 1 to ). + /// Возвращает положительный диапазон значений (от 1 до ). + /// + public static readonly Range PositiveInt64 = new Range(1L, long.MaxValue); } }