31 lines
No EOL
807 B
C#
31 lines
No EOL
807 B
C#
using FluentAssertions;
|
|
using Website.Data.States;
|
|
using Website.Models;
|
|
using Website.ViewModels;
|
|
using Xunit;
|
|
|
|
namespace Website.Tests.VIewModels
|
|
{
|
|
public class BlogPostPreviewViewModelTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_WithContentOver1000Characters_LimitsContentTo1000Chars() {
|
|
var state = new BlogPostState {
|
|
Post_Content = new string('a', 1001)
|
|
};
|
|
var post = new BlogPost(state);
|
|
var vm = new BlogPostPreviewViewModel(post);
|
|
vm.Content.Length.Should().Be(1000);
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_WithContentUnder1000Characters_ContentIsIdenticalLength() {
|
|
var state = new BlogPostState {
|
|
Post_Content = new string('a', 900)
|
|
};
|
|
var post = new BlogPost(state);
|
|
var vm = new BlogPostPreviewViewModel(post);
|
|
vm.Content.Length.Should().Be(900);
|
|
}
|
|
}
|
|
} |