-
-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into code-style-fixes
- Loading branch information
Showing
49 changed files
with
1,934 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="byte"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class ByteAssertions : NumericAssertions<byte> | ||
{ | ||
internal ByteAssertions(byte value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(byte subject, byte expected) | ||
{ | ||
int difference = subject - expected; | ||
return difference != 0 ? difference.ToString(CultureInfo.InvariantCulture) : null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="decimal"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class DecimalAssertions : NumericAssertions<decimal> | ||
{ | ||
internal DecimalAssertions(decimal value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(decimal subject, decimal expected) | ||
{ | ||
try | ||
{ | ||
decimal difference = checked(subject - expected); | ||
return difference != 0 ? difference.ToString(CultureInfo.InvariantCulture) : null; | ||
} | ||
catch (OverflowException) | ||
{ | ||
return null; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
namespace FluentAssertions.Numeric | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="double"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class DoubleAssertions : NumericAssertions<double> | ||
{ | ||
public DoubleAssertions(double value) | ||
internal DoubleAssertions(double value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override bool IsNaN(double value) => double.IsNaN(value); | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(double subject, double expected) | ||
{ | ||
var difference = subject - expected; | ||
return difference != 0 ? difference.ToString("R", CultureInfo.InvariantCulture) : null; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="short"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class Int16Assertions : NumericAssertions<short> | ||
{ | ||
internal Int16Assertions(short value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(short subject, short expected) | ||
{ | ||
if (subject < 10 && expected < 10) | ||
{ | ||
return null; | ||
} | ||
|
||
int difference = subject - expected; | ||
return difference != 0 ? difference.ToString(CultureInfo.InvariantCulture) : null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="int"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class Int32Assertions : NumericAssertions<int> | ||
{ | ||
internal Int32Assertions(int value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(int subject, int expected) | ||
{ | ||
if (subject is > 0 and < 10 && expected is > 0 and < 10) | ||
{ | ||
return null; | ||
} | ||
|
||
long difference = (long)subject - expected; | ||
return difference != 0 ? difference.ToString(CultureInfo.InvariantCulture) : null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Diagnostics; | ||
using System.Globalization; | ||
|
||
namespace FluentAssertions.Numeric | ||
{ | ||
/// <summary> | ||
/// Contains a number of methods to assert that a <see cref="long"/> is in the expected state. | ||
/// </summary> | ||
[DebuggerNonUserCode] | ||
internal class Int64Assertions : NumericAssertions<long> | ||
{ | ||
internal Int64Assertions(long value) | ||
: base(value) | ||
{ | ||
} | ||
|
||
private protected override string CalculateDifferenceForFailureMessage(long subject, long expected) | ||
{ | ||
if (subject is > 0 and < 10 && expected is > 0 and < 10) | ||
{ | ||
return null; | ||
} | ||
|
||
decimal difference = (decimal)subject - expected; | ||
return difference != 0 ? difference.ToString(CultureInfo.InvariantCulture) : null; | ||
} | ||
} | ||
} |
Oops, something went wrong.