Skip to content

Commit 4ffa218

Browse files
committed
Added tests
1 parent 4349719 commit 4ffa218

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

LinkDotNet.Blog.IntegrationTests/Web/Pages/Admin/CreateNewBlogPostPageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public async Task ShouldSaveBlogPostOnSave()
3535
toastService.Verify(t => t.ShowInfo("Created BlogPost My Title", string.Empty), Times.Once);
3636
}
3737

38-
private void TriggerNewBlogPost(IRenderedComponent<CreateNewBlogPost> cut)
38+
private static void TriggerNewBlogPost(IRenderedComponent<CreateNewBlogPost> cut)
3939
{
4040
cut.Find("#title").Change("My Title");
4141
cut.Find("#short").Change("My short Description");

LinkDotNet.Blog.UnitTests/Infrastructure/Persistence/InMemory/BlogPostRepositoryTests.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq;
1+
using System;
2+
using System.Linq;
23
using System.Threading.Tasks;
34
using FluentAssertions;
45
using LinkDotNet.Blog.TestUtilities;
@@ -63,6 +64,20 @@ public async Task ShouldFilterAndOrder()
6364
retrievedPosts[1].Id.Should().Be(newerPost.Id);
6465
}
6566

67+
[Fact]
68+
public async Task ShouldOrderDescending()
69+
{
70+
var olderPost = new BlogPostBuilder().WithUpdatedDate(DateTime.MinValue).Build();
71+
var newerPost = new BlogPostBuilder().WithUpdatedDate(DateTime.MaxValue).Build();
72+
await sut.StoreAsync(olderPost);
73+
await sut.StoreAsync(newerPost);
74+
75+
var blogPosts = await sut.GetAllAsync(orderBy: bp => bp.UpdatedDate, descending: true);
76+
77+
blogPosts[0].Should().Be(newerPost);
78+
blogPosts[1].Should().Be(olderPost);
79+
}
80+
6681
[Fact]
6782
public async Task ShouldDelete()
6883
{

0 commit comments

Comments
 (0)