Set friendly date for blog posts
This commit is contained in:
parent
fa143f5ab4
commit
035f442ba0
5 changed files with 61 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using FluentAssertions;
|
||||
using NSubstitute;
|
||||
using Website.Data.States;
|
||||
|
@ -18,5 +19,38 @@ namespace Website.Tests.VIewModels
|
|||
var vm = new BlogPostViewModel(post);
|
||||
vm.Content.Should().Be("<h1>header</h1>");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timestamp_OnThe1st_IsFriendlyString() {
|
||||
var state = new BlogPostState {
|
||||
Post_Content = "",
|
||||
Post_Timestamp = new DateTime(2018, 10, 01, 15, 1, 25)
|
||||
};
|
||||
var post = new BlogPost(state);
|
||||
var vm = new BlogPostViewModel(post);
|
||||
vm.Timestamp.Should().Be("Monday the 1st of October 2018");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timestamp_OnThe2nd_IsFriendlyString() {
|
||||
var state = new BlogPostState {
|
||||
Post_Content = "",
|
||||
Post_Timestamp = new DateTime(2018, 10, 02, 15, 1, 25)
|
||||
};
|
||||
var post = new BlogPost(state);
|
||||
var vm = new BlogPostViewModel(post);
|
||||
vm.Timestamp.Should().Be("Tuesday the 2nd of October 2018");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Timestamp_OnThe3rd_IsFriendlyString() {
|
||||
var state = new BlogPostState {
|
||||
Post_Content = "",
|
||||
Post_Timestamp = new DateTime(2018, 10, 03, 15, 1, 25)
|
||||
};
|
||||
var post = new BlogPost(state);
|
||||
var vm = new BlogPostViewModel(post);
|
||||
vm.Timestamp.Should().Be("Wednesday the 3rd of October 2018");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue