Initial commit
This commit is contained in:
commit
4b1294b32d
23 changed files with 5134 additions and 0 deletions
32
MathInterpreter.Test/ScanResultTests.cs
Normal file
32
MathInterpreter.Test/ScanResultTests.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using MathInterpreter.Core;
|
||||
|
||||
namespace MathInterpreter.Test;
|
||||
|
||||
public sealed class ScanResultTests
|
||||
{
|
||||
[Fact]
|
||||
public void ScanResult_Construction_Valid()
|
||||
{
|
||||
const int ExpectedValue = -123;
|
||||
const int ExpectedLength = 3;
|
||||
const string ExpectedRemainingExpression = "abc";
|
||||
|
||||
var result = new ScanResult<int>(ExpectedValue, ExpectedLength, ExpectedRemainingExpression);
|
||||
|
||||
result.Value.Should().Be(ExpectedValue);
|
||||
result.Length.Should().Be(ExpectedLength);
|
||||
result.RemainingExpression.ToString().Should().Be(ExpectedRemainingExpression);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScanResult_Construction_Invalid()
|
||||
{
|
||||
var action = () =>
|
||||
{
|
||||
var _ = new ScanResult<int>(1, -2, string.Empty);
|
||||
};
|
||||
|
||||
action.Should().Throw<ArgumentOutOfRangeException>()
|
||||
.WithMessage("Length must be non-negative (Parameter 'length')");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue