-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e2f829
commit 8bc38b3
Showing
2 changed files
with
30 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using Npgsql.Internal.Postgres; | ||
using NUnit.Framework; | ||
|
||
namespace Npgsql.Tests; | ||
|
||
public class DataTypeNameTests | ||
{ | ||
[Test] | ||
public void MaxLengthDataTypeName() | ||
{ | ||
var name = new string('a', DataTypeName.NAMEDATALEN); | ||
var fullyQualifiedDataTypeName= $"public.{name}"; | ||
Assert.DoesNotThrow(() => new DataTypeName(fullyQualifiedDataTypeName)); | ||
Assert.AreEqual(new DataTypeName(fullyQualifiedDataTypeName).Value, fullyQualifiedDataTypeName); | ||
} | ||
|
||
[Test] | ||
public void TooLongDataTypeName() | ||
{ | ||
var name = new string('a', DataTypeName.NAMEDATALEN + 1); | ||
var fullyQualifiedDataTypeName= $"public.{name}"; | ||
var exception = Assert.Throws<ArgumentException>(() => new DataTypeName(fullyQualifiedDataTypeName)); | ||
Assert.That(exception!.Message, Does.EndWith($": public.{new string('a', DataTypeName.NAMEDATALEN)}")); | ||
} | ||
} |