Edit and create blog posts
This commit is contained in:
parent
47431d4650
commit
44875a6a45
6 changed files with 126 additions and 1 deletions
31
Website.Tests/Models/BlogPostTests.cs
Normal file
31
Website.Tests/Models/BlogPostTests.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using FluentAssertions;
|
||||
using Website.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace Website.Tests.Models {
|
||||
public class BlogPostTests {
|
||||
[Fact]
|
||||
public void UpdateTitle_WithNewTitle_UpdatesTitlePropertyAndRegeneratesUrl() {
|
||||
var post = new BlogPost();
|
||||
post.UpdateTitle("new title");
|
||||
|
||||
post.Title.Should().Be("new title");
|
||||
post.Url.Should().Be("new-title");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UpdateDraft_WithContent_UpdatesDraftProperty() {
|
||||
var post = new BlogPost();
|
||||
post.UpdateDraft("content");
|
||||
post.Draft.Should().Be("content");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Publish_SetsContentToDraft() {
|
||||
var post = new BlogPost();
|
||||
post.UpdateDraft("content");
|
||||
post.Publish();
|
||||
post.Content.Should().Be("content");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue