Use new API for blog
This commit is contained in:
parent
e389b2404a
commit
25c320bf6b
17 changed files with 356 additions and 314 deletions
|
@ -1,42 +0,0 @@
|
|||
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");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("new:title", "new-title")]
|
||||
[InlineData("new: title", "new-title")]
|
||||
[InlineData("new$title", "new-title")]
|
||||
[InlineData("new TITle", "new-title")]
|
||||
public void UpdateTitle_WithUnsafeCharsInTitle_RegeneratesSafeUrl(string title, string url) {
|
||||
var post = new BlogPost();
|
||||
post.UpdateTitle(title);
|
||||
post.Url.Should().Be(url);
|
||||
}
|
||||
|
||||
[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