pq connection string parsing from other project
This commit is contained in:
parent
9a5feb9d54
commit
d803cd8003
10 changed files with 529 additions and 0 deletions
|
|
@ -0,0 +1,81 @@
|
|||
namespace pgLabII.PgUtils.Tests.ConnectionStrings.Util;
|
||||
|
||||
public class UnitTestTokenizerTests
|
||||
{
|
||||
private readonly UnitTestTokenizer _sut = new();
|
||||
|
||||
[Fact]
|
||||
public void Eof_True()
|
||||
{
|
||||
Assert.True(_sut.Eof);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Eof_False()
|
||||
{
|
||||
_sut.AddString("a");
|
||||
Assert.False(_sut.Eof);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetKeyword_Success()
|
||||
{
|
||||
_sut.AddString("a");
|
||||
Assert.Equal("a", _sut.GetKeyword());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetKeyword_Unexpected_Throws()
|
||||
{
|
||||
_sut.AddEquals();
|
||||
Assert.Throws<Exception>(() => _sut.GetKeyword());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetKeyword_SimulatesException()
|
||||
{
|
||||
_sut.AddException(new ArgumentNullException());
|
||||
Assert.Throws<ArgumentNullException>(() => _sut.GetKeyword());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetValue_Success()
|
||||
{
|
||||
_sut.AddString("a");
|
||||
Assert.Equal("a", _sut.GetValue());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetValue_Unexpected_Throws()
|
||||
{
|
||||
_sut.AddEquals();
|
||||
Assert.Throws<Exception>(() => _sut.GetValue());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetValue_SimulatesException()
|
||||
{
|
||||
_sut.AddException(new ArgumentNullException());
|
||||
Assert.Throws<ArgumentNullException>(() => _sut.GetValue());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ConsumeEquals_Success()
|
||||
{
|
||||
_sut.AddEquals();
|
||||
_sut.ConsumeEquals();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ConsumeEquals_Unexpected_Throws1()
|
||||
{
|
||||
Assert.Throws<Exception>(() => _sut.ConsumeEquals());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ConsumeEquals_Unexpected_Throws2()
|
||||
{
|
||||
_sut.AddString("t");
|
||||
Assert.Throws<Exception>(() => _sut.ConsumeEquals());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue