24 lines
673 B
C#
24 lines
673 B
C#
using FluentAssertions;
|
|
using Website.Models;
|
|
using Website.ViewModels;
|
|
using Xunit;
|
|
|
|
namespace Website.Tests.VIewModels
|
|
{
|
|
public class BlogPostPreviewViewModelTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_WithContentOver1000Characters_LimitsContentTo1000Chars() {
|
|
var post = new BlogPost {Content = new string('a', 1001)};
|
|
var vm = new BlogPostSnippetViewModel(post);
|
|
vm.Content.Length.Should().Be(1000);
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_WithContentUnder1000Characters_ContentIsIdenticalLength() {
|
|
var post = new BlogPost{Content = new string('a', 900)};
|
|
var vm = new BlogPostSnippetViewModel(post);
|
|
vm.Content.Length.Should().Be(900);
|
|
}
|
|
}
|
|
}
|