Initial curated itworx-knowledge-hub source from 3b1751d0d9dee551aa6994eee0093704dc334817
This commit is contained in:
commit
ad8ad252a9
825 files changed
+124216
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using ItWorx.KnowledgeHub.Domain.Identity;
|
||||
|
||||
namespace ItWorx.KnowledgeHub.Domain.Tests;
|
||||
|
||||
public sealed class EmailAddressTests
|
||||
{
|
||||
[Fact]
|
||||
public void Create_normalizes_case_and_whitespace()
|
||||
{
|
||||
var email = EmailAddress.Create(" Owner@ItWorx.Example ");
|
||||
|
||||
Assert.Equal("owner@itworx.example", email.Value);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData("not-an-email")]
|
||||
[InlineData("missing-domain@")]
|
||||
[InlineData("@missing-local.example")]
|
||||
public void Create_rejects_invalid_shapes(string value)
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => EmailAddress.Create(value));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryCreate_returns_false_instead_of_throwing()
|
||||
{
|
||||
var succeeded = EmailAddress.TryCreate("not-an-email", out var emailAddress);
|
||||
|
||||
Assert.False(succeeded);
|
||||
Assert.Null(emailAddress);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user