Unit Tests

This commit is contained in:
Ivan Paulovich
2018-01-25 17:19:31 -02:00
parent 4b5800e3fb
commit 9334511f78
4 changed files with 99 additions and 0 deletions

View 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);
}
}
}

View File

@@ -0,0 +1,11 @@
namespace Jambo.Domain.Model.Posts
{
using Jambo.Domain.Exceptions;
public class CommentShouldNotBeEmptyException : DomainException
{
public CommentShouldNotBeEmptyException(string message)
: base(message)
{ }
}
}

View File

@@ -0,0 +1,11 @@
namespace Jambo.Domain.Model.Posts
{
using Jambo.Domain.Exceptions;
public class ContentShouldNotBeEmptyException : DomainException
{
public ContentShouldNotBeEmptyException(string message)
: base(message)
{ }
}
}

View File

@@ -0,0 +1,11 @@
namespace Jambo.Domain.Model.Posts
{
using Jambo.Domain.Exceptions;
public class TitleShouldNotBeEmptyException : DomainException
{
public TitleShouldNotBeEmptyException(string message)
: base(message)
{ }
}
}