Skip to content

Commit 6a26dab

Browse files
committed
Added Test for updating BlogPosts
1 parent ffd25f2 commit 6a26dab

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using FluentAssertions;
2+
using LinkDotNet.Blog.TestUtilities;
3+
using LinkDotNet.Domain;
4+
using Xunit;
5+
6+
namespace LinkDotNet.Blog.UnitTests.Domain
7+
{
8+
public class BlogPostTests
9+
{
10+
[Fact]
11+
public void ShouldUpdateBlogPost()
12+
{
13+
var blogPostToUpdate = new BlogPostBuilder().Build();
14+
blogPostToUpdate.Id = "random-id";
15+
var blogPost = BlogPost.Create("Title", "Desc", "Content", "Url");
16+
blogPost.Id = "something else";
17+
18+
blogPostToUpdate.Update(blogPost);
19+
20+
blogPostToUpdate.Title.Should().Be("Title");
21+
blogPostToUpdate.ShortDescription.Should().Be("Desc");
22+
blogPostToUpdate.Content.Should().Be("Content");
23+
blogPostToUpdate.PreviewImageUrl.Should().Be("Url");
24+
blogPostToUpdate.Tags.Should().BeNullOrEmpty();
25+
}
26+
}
27+
}

LinkDotNet.Domain/BlogPost.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void Update(BlogPost from)
4545
ShortDescription = from.ShortDescription;
4646
Content = from.Content;
4747
UpdatedDate = from.UpdatedDate;
48+
PreviewImageUrl = from.PreviewImageUrl;
4849
Tags = from.Tags;
4950
}
5051
}

0 commit comments

Comments
 (0)