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 1
1
using System . Collections . Generic ;
2
+ using AngleSharp . Dom ;
2
3
using Bunit ;
3
4
using FluentAssertions ;
4
5
using LinkDotNet . Blog . TestUtilities ;
@@ -117,7 +118,22 @@ public void ShouldAddEntryWithCorrectSortOrder()
117
118
[ Fact ]
118
119
public void ShouldSetNewOrderWhenItemDragAndDropped ( )
119
120
{
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 ( ) ;
120
134
135
+ source . SortOrder . Should ( ) . Be ( 150 ) ;
136
+ entryToDb . Should ( ) . Be ( source ) ;
121
137
}
122
138
123
139
private static AppConfiguration CreateEmptyConfiguration ( )
Original file line number Diff line number Diff line change 3
3
4
4
namespace LinkDotNet . Domain
5
5
{
6
- [ DebuggerDisplay ( "{Content}" ) ]
6
+ [ DebuggerDisplay ( "{Content} with sort order {SortOrder} " ) ]
7
7
public class ProfileInformationEntry
8
8
{
9
9
private ProfileInformationEntry ( )
You can’t perform that action at this time.
0 commit comments