File tree 2 files changed +18
-2
lines changed
src/LinkDotNet.Blog.Domain
tests/LinkDotNet.Blog.UnitTests/Domain
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ public static BlogPost Create(
51
51
52
52
public void Update ( BlogPost from )
53
53
{
54
+ if ( from == this )
55
+ {
56
+ return ;
57
+ }
58
+
54
59
Title = from . Title ;
55
60
ShortDescription = from . ShortDescription ;
56
61
Content = from . Content ;
@@ -75,4 +80,4 @@ private void ReplaceTags(IEnumerable<Tag> tags)
75
80
}
76
81
}
77
82
}
78
- }
83
+ }
Original file line number Diff line number Diff line change @@ -59,4 +59,15 @@ public void ShouldSetDateWhenGiven()
59
59
60
60
blog . UpdatedDate . Should ( ) . Be ( somewhen ) ;
61
61
}
62
- }
62
+
63
+ [ Fact ]
64
+ public void ShouldNotDeleteTagsWhenSameReference ( )
65
+ {
66
+ var bp = new BlogPostBuilder ( ) . WithTags ( "tag 1" ) . Build ( ) ;
67
+
68
+ bp . Update ( bp ) ;
69
+
70
+ bp . Tags . Should ( ) . HaveCount ( 1 ) ;
71
+ bp . Tags . Single ( ) . Content . Should ( ) . Be ( "tag 1" ) ;
72
+ }
73
+ }
You can’t perform that action at this time.
0 commit comments