Unit Tests
This commit is contained in:
66
source/Shared/Jambo.Domain.UnitTests/ValueObjectsTests.cs
Normal file
66
source/Shared/Jambo.Domain.UnitTests/ValueObjectsTests.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
namespace Jambo.Domain.UnitTests
|
||||
{
|
||||
using Jambo.Domain.Model.Posts;
|
||||
using Xunit;
|
||||
|
||||
public class ValueObjectsTests
|
||||
{
|
||||
[Fact]
|
||||
public void Empty_Title()
|
||||
{
|
||||
//
|
||||
// Arrange
|
||||
string empty = string.Empty;
|
||||
|
||||
//
|
||||
// Act and Assert
|
||||
Assert.Throws<TitleShouldNotBeEmptyException>(
|
||||
() => Title.Create(empty));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Valid_Title()
|
||||
{
|
||||
//
|
||||
// Arrange
|
||||
string valid = "An Good Title";
|
||||
|
||||
//
|
||||
// Act
|
||||
Title title = Title.Create(valid);
|
||||
|
||||
//
|
||||
// Assert
|
||||
Assert.Equal(valid, title.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Empty_Content()
|
||||
{
|
||||
//
|
||||
// Arrange
|
||||
string empty = string.Empty;
|
||||
|
||||
//
|
||||
// Act and Assert
|
||||
Assert.Throws<ContentShouldNotBeEmptyException>(
|
||||
() => Content.Create(empty));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Valid_Content()
|
||||
{
|
||||
//
|
||||
// Arrange
|
||||
string valid = "An Good Title";
|
||||
|
||||
//
|
||||
// Act
|
||||
Content content = Content.Create(valid);
|
||||
|
||||
//
|
||||
// Assert
|
||||
Assert.Equal(valid, content.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Jambo.Domain.Model.Posts
|
||||
{
|
||||
using Jambo.Domain.Exceptions;
|
||||
|
||||
public class CommentShouldNotBeEmptyException : DomainException
|
||||
{
|
||||
public CommentShouldNotBeEmptyException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Jambo.Domain.Model.Posts
|
||||
{
|
||||
using Jambo.Domain.Exceptions;
|
||||
|
||||
public class ContentShouldNotBeEmptyException : DomainException
|
||||
{
|
||||
public ContentShouldNotBeEmptyException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Jambo.Domain.Model.Posts
|
||||
{
|
||||
using Jambo.Domain.Exceptions;
|
||||
|
||||
public class TitleShouldNotBeEmptyException : DomainException
|
||||
{
|
||||
public TitleShouldNotBeEmptyException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user