website/Website.Tests/Models/BlogPostTests.cs

31 lines
No EOL
724 B
C#

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