File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
LinkDotNet.Blog.IntegrationTests/Web/Shared Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 11using System . Collections . Generic ;
2+ using AngleSharp . Dom ;
23using Bunit ;
34using FluentAssertions ;
45using LinkDotNet . Blog . TestUtilities ;
@@ -117,7 +118,22 @@ public void ShouldAddEntryWithCorrectSortOrder()
117118 [ Fact ]
118119 public void ShouldSetNewOrderWhenItemDragAndDropped ( )
119120 {
121+ var target = new ProfileInformationEntryBuilder ( ) . WithSortOrder ( 100 ) . Build ( ) ;
122+ var source = new ProfileInformationEntryBuilder ( ) . WithSortOrder ( 200 ) . Build ( ) ;
123+ var ( repo , calculator ) = RegisterServices ( ) ;
124+ var profileInformationEntries = new List < ProfileInformationEntry > { target , source } ;
125+ repo . Setup ( p => p . GetAllAsync ( ) ) . ReturnsAsync ( profileInformationEntries ) ;
126+ ProfileInformationEntry entryToDb = null ;
127+ repo . Setup ( p => p . StoreAsync ( It . IsAny < ProfileInformationEntry > ( ) ) )
128+ . Callback < ProfileInformationEntry > ( p => entryToDb = p ) ;
129+ var cut = RenderComponent < Profile > ( p => p . Add ( s => s . IsAuthenticated , true ) ) ;
130+ calculator . Setup ( s => s . GetSortOrder ( target , profileInformationEntries ) ) . Returns ( 150 ) ;
131+
132+ cut . FindAll ( "li" ) [ 1 ] . Drag ( ) ;
133+ cut . FindAll ( "li" ) [ 0 ] . Drop ( ) ;
120134
135+ source . SortOrder . Should ( ) . Be ( 150 ) ;
136+ entryToDb . Should ( ) . Be ( source ) ;
121137 }
122138
123139 private static AppConfiguration CreateEmptyConfiguration ( )
Original file line number Diff line number Diff line change 33
44namespace LinkDotNet . Domain
55{
6- [ DebuggerDisplay ( "{Content}" ) ]
6+ [ DebuggerDisplay ( "{Content} with sort order {SortOrder} " ) ]
77 public class ProfileInformationEntry
88 {
99 private ProfileInformationEntry ( )
You can’t perform that action at this time.
0 commit comments