Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Sep 11, 2021
1 parent 4349719 commit 4ffa218
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task ShouldSaveBlogPostOnSave()
toastService.Verify(t => t.ShowInfo("Created BlogPost My Title", string.Empty), Times.Once);
}

private void TriggerNewBlogPost(IRenderedComponent<CreateNewBlogPost> cut)
private static void TriggerNewBlogPost(IRenderedComponent<CreateNewBlogPost> cut)
{
cut.Find("#title").Change("My Title");
cut.Find("#short").Change("My short Description");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using LinkDotNet.Blog.TestUtilities;
Expand Down Expand Up @@ -63,6 +64,20 @@ public async Task ShouldFilterAndOrder()
retrievedPosts[1].Id.Should().Be(newerPost.Id);
}

[Fact]
public async Task ShouldOrderDescending()
{
var olderPost = new BlogPostBuilder().WithUpdatedDate(DateTime.MinValue).Build();
var newerPost = new BlogPostBuilder().WithUpdatedDate(DateTime.MaxValue).Build();
await sut.StoreAsync(olderPost);
await sut.StoreAsync(newerPost);

var blogPosts = await sut.GetAllAsync(orderBy: bp => bp.UpdatedDate, descending: true);

blogPosts[0].Should().Be(newerPost);
blogPosts[1].Should().Be(olderPost);
}

[Fact]
public async Task ShouldDelete()
{
Expand Down

0 comments on commit 4ffa218

Please sign in to comment.