Skip to content

Commit

Permalink
Merge branch 'release/2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
eoehen committed Aug 22, 2022
2 parents a3fb75d + 68df883 commit 7308a67
Show file tree
Hide file tree
Showing 11 changed files with 300 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using FluentAssertions;
using Xunit;

namespace oehen.arguard
{
[UseCulture("en-US")]
public class ArgumentDecimalLessOrEqualThanZeroGuardTest
{
[Theory]
[InlineData(-1.33)]
[InlineData(-2.55)]
[InlineData(-3.5889)]
[InlineData(-123456.789)]
public void Decimal_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(
decimal argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
argument.ThrowIfIsLessOrEqualThanZero(nameof(argument));
});
exception.Message.Should().Be("Argument is less or equal than 0. (Parameter 'argument')" +
Environment.NewLine + $"Actual value was {argument}.");
}

[Fact]
public void Decimal_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const decimal argument = 0;
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
argument.ThrowIfIsLessOrEqualThanZero(nameof(argument));
});
exception.Message.Should().Be("Argument is less or equal than 0. (Parameter 'argument')" +
Environment.NewLine + "Actual value was 0.");
}

[Theory]
[InlineData(1.23)]
[InlineData(2.23)]
[InlineData(3.23)]
[InlineData(123456.23)]
[InlineData(int.MaxValue)]
public void Decimal_ThrowIfIsLessOrEqualThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
decimal argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessOrEqualThanZero(nameof(argument)); });
Assert.Null(exception);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using FluentAssertions;
using Xunit;

namespace oehen.arguard
{
[UseCulture("en-US")]
public class ArgumentDecimalLessThanGuardTest
{
[Theory]
[InlineData(-1.23, 0.23)]
[InlineData(2.23, 3.23)]
[InlineData(-3.23, 5.23)]
[InlineData(5.23, 5.23)]
public void
Decimal_ThrowIfIsLessOrEqualThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessOrEqualThanTheCompareValue(
decimal argument, decimal compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
argument.ThrowIfIsLessOrEqualThan(compareValue, nameof(argument));
});
exception.Message.Should().Be($"Argument is less or equal than {compareValue}. (Parameter 'argument')" +
Environment.NewLine + $"Actual value was {argument}.");
}

[Theory]
[InlineData(-1.23, 0.23)]
[InlineData(2.23, 3.23)]
[InlineData(-3.23, 5.23)]
public void
Decimal_ThrowIfIsLessThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessThanTheCompareValue(
decimal argument, decimal compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
argument.ThrowIfIsLessThan(compareValue, nameof(argument));
});
exception.Message.Should().Be($"Argument is less than {compareValue}. (Parameter 'argument')" +
Environment.NewLine + $"Actual value was {argument}.");
}

[Theory]
[InlineData(11.23, 2.23)]
[InlineData(3.23, 2.23)]
[InlineData(5.23, 3.23)]
[InlineData(3.23, 3.23)]
public void
Decimal_ThrowIfIsLessThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterThanTheCompareValue(
decimal argument, decimal compareValue)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThan(compareValue, nameof(argument)); });
Assert.Null(exception);
}

[Theory]
[InlineData(11.23, 2.23)]
[InlineData(3.23, 2.23)]
[InlineData(5.23, 3.23)]
public void
Decimal_ThrowIfIsLessOrEqualThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterOrEqualThanTheCompareValue(
decimal argument, decimal compareValue)
{
var exception = Record.Exception(() =>
{
argument.ThrowIfIsLessOrEqualThan(compareValue, nameof(argument));
});
Assert.Null(exception);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using FluentAssertions;
using Xunit;

namespace oehen.arguard
{
[UseCulture("en-US")]
public class ArgumentDecimalLessThanZeroGuardTest
{
[Theory]
[InlineData(-1.33)]
[InlineData(-2.55)]
[InlineData(-3.5889)]
[InlineData(-123456.789)]
public void Decimal_ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(decimal argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
argument.ThrowIfIsLessThanZero(nameof(argument));
});
exception.Message.Should().Be("Argument is less than 0. (Parameter 'argument')" +
Environment.NewLine + $"Actual value was {argument}.");
}

[Theory]
[InlineData(1.33)]
[InlineData(2.55)]
[InlineData(3.5889)]
[InlineData(123456)]
public void Decimal_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
decimal argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Assert.Null(exception);
}

[Fact]
public void Decimal_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const decimal argument = 0;
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Assert.Null(exception);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ArgumentIntLessOrEqualThanZeroGuardTest
[InlineData(-2)]
[InlineData(-3)]
[InlineData(-123456)]
public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(
public void Int_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(
int argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -24,7 +24,7 @@ public class ArgumentIntLessOrEqualThanZeroGuardTest
}

[Fact]
public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentIsZero()
public void Int_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const int argument = 0;
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -41,7 +41,7 @@ public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_
[InlineData(3)]
[InlineData(123456)]
[InlineData(int.MaxValue)]
public void ThrowIfIsLessOrEqualThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
public void Int_ThrowIfIsLessOrEqualThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
int argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessOrEqualThanZero(nameof(argument)); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ArgumentIntLessThanGuardTest
[InlineData(-3, 5)]
[InlineData(5, 5)]
public void
ThrowIfIsLessOrEqualThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessOrEqualThanTheCompareValue(
Int_ThrowIfIsLessOrEqualThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessOrEqualThanTheCompareValue(
int argument, int compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -29,7 +29,7 @@ public void
[InlineData(2, 3)]
[InlineData(-3, 5)]
public void
ThrowIfIsLessThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessThanTheCompareValue(
Int_ThrowIfIsLessThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessThanTheCompareValue(
int argument, int compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -46,7 +46,7 @@ public void
[InlineData(5, 3)]
[InlineData(3, 3)]
public void
ThrowIfIsLessThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterThanTheCompareValue(
Int_ThrowIfIsLessThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterThanTheCompareValue(
int argument, int compareValue)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThan(compareValue, nameof(argument)); });
Expand All @@ -58,7 +58,7 @@ public void
[InlineData(3, 2)]
[InlineData(5, 3)]
public void
ThrowIfIsLessOrEqualThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterOrEqualThanTheCompareValue(
Int_ThrowIfIsLessOrEqualThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterOrEqualThanTheCompareValue(
int argument, int compareValue)
{
var exception = Record.Exception(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ArgumentIntLessThanZeroGuardTest
[InlineData(-2)]
[InlineData(-3)]
[InlineData(-123456)]
public void ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(int argument)
public void Int_ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(int argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
Expand All @@ -28,15 +28,15 @@ public void ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgum
[InlineData(3)]
[InlineData(123456)]
[InlineData(int.MaxValue)]
public void ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
public void Int_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
int argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Assert.Null(exception);
}

[Fact]
public void ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsZero()
public void Int_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const int argument = 0;
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ArgumentLongLessOrEqualThanZeroGuardTest
[InlineData(-2)]
[InlineData(-3)]
[InlineData(-123456)]
public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(
public void Long_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(
long argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -24,7 +24,7 @@ public class ArgumentLongLessOrEqualThanZeroGuardTest
}

[Fact]
public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentIsZero()
public void Long_ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const long argument = 0;
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
Expand All @@ -41,7 +41,7 @@ public void ThrowIfIsLessOrEqualThanZero_ShouldThrowArgumentOutOfRangeException_
[InlineData(3)]
[InlineData(123456)]
[InlineData(int.MaxValue)]
public void ThrowIfIsLessOrEqualThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
public void Long_ThrowIfIsLessOrEqualThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
long argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessOrEqualThanZero(nameof(argument)); });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class ArgumentLongLessThanGuardTest
[InlineData(-3, 5)]
[InlineData(5, 5)]
public void
ThrowIfIsLessOrEqualThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessOrEqualThanTheCompareValue(
long argument, int compareValue)
Long_ThrowIfIsLessOrEqualThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessOrEqualThanTheCompareValue(
long argument, long compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
Expand All @@ -29,8 +29,8 @@ public void
[InlineData(2, 3)]
[InlineData(-3, 5)]
public void
ThrowIfIsLessThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessThanTheCompareValue(
long argument, int compareValue)
Long_ThrowIfIsLessThanCompareValue_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsLessThanTheCompareValue(
long argument, long compareValue)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
Expand All @@ -46,8 +46,8 @@ public void
[InlineData(5, 3)]
[InlineData(3, 3)]
public void
ThrowIfIsLessThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterThanTheCompareValue(
long argument, int compareValue)
Long_ThrowIfIsLessThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterThanTheCompareValue(
long argument, long compareValue)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThan(compareValue, nameof(argument)); });
Assert.Null(exception);
Expand All @@ -58,8 +58,8 @@ public void
[InlineData(3, 2)]
[InlineData(5, 3)]
public void
ThrowIfIsLessOrEqualThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterOrEqualThanTheCompareValue(
long argument, int compareValue)
Long_ThrowIfIsLessOrEqualThanCompareValue_ShouldNotThrowArgumentOutOfRangeException_IfArgumentValueIsGreaterOrEqualThanTheCompareValue(
long argument, long compareValue)
{
var exception = Record.Exception(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ArgumentLongLessThanZeroGuardTest
[InlineData(-2)]
[InlineData(-3)]
[InlineData(-123456)]
public void ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(long argument)
public void Long_ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgumentValueIsNegative(long argument)
{
var exception = Assert.Throws<ArgumentOutOfRangeException>(() =>
{
Expand All @@ -28,15 +28,15 @@ public void ThrowIfIsLessThanZero_ShouldThrowArgumentOutOfRangeException_IfArgum
[InlineData(3)]
[InlineData(123456)]
[InlineData(int.MaxValue)]
public void ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
public void Long_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsMoreThanZero(
long argument)
{
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Assert.Null(exception);
}

[Fact]
public void ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsZero()
public void Long_ThrowIfIsLessThanZero_ShouldNotThrowArgumentOutOfRangeException_IfArgumentIsZero()
{
const int argument = 0;
var exception = Record.Exception(() => { argument.ThrowIfIsLessThanZero(nameof(argument)); });
Expand Down

0 comments on commit 7308a67

Please sign in to comment.