48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
using FluentAssertions;
|
|
using Website.Models;
|
|
using Website.ViewModels;
|
|
using Xunit;
|
|
|
|
namespace Website.Tests.VIewModels {
|
|
public class BlogPostViewModelTests {
|
|
[Fact]
|
|
public void ContentHtml_WithMarkdownContent_ReturnsHtml() {
|
|
var post = new BlogPost {
|
|
Content = "# header"
|
|
};
|
|
var vm = new BlogPostViewModel(post, false);
|
|
vm.ContentHtml.Should().Be("<h1>header</h1>");
|
|
}
|
|
|
|
[Fact]
|
|
public void Timestamp_OnThe1st_IsFriendlyString() {
|
|
var post = new BlogPost {
|
|
Content = "",
|
|
Timestamp = new DateTime(2018, 10, 01, 15, 1, 25)
|
|
};
|
|
var vm = new BlogPostViewModel(post, false);
|
|
vm.Timestamp.Should().Be("Monday the 1st of October 2018");
|
|
}
|
|
|
|
[Fact]
|
|
public void Timestamp_OnThe2nd_IsFriendlyString() {
|
|
var post = new BlogPost {
|
|
Content = "",
|
|
Timestamp = new DateTime(2018, 10, 02, 15, 1, 25)
|
|
};
|
|
var vm = new BlogPostViewModel(post, false);
|
|
vm.Timestamp.Should().Be("Tuesday the 2nd of October 2018");
|
|
}
|
|
|
|
[Fact]
|
|
public void Timestamp_OnThe3rd_IsFriendlyString() {
|
|
var post = new BlogPost {
|
|
Content = "",
|
|
Timestamp = new DateTime(2018, 10, 03, 15, 1, 25)
|
|
};
|
|
var vm = new BlogPostViewModel(post, false);
|
|
vm.Timestamp.Should().Be("Wednesday the 3rd of October 2018");
|
|
}
|
|
}
|
|
}
|