@@ -19,7 +19,7 @@ public void ShouldRenderAllItemsSortedByOrder()
19
19
{
20
20
var entry1 = new ProfileInformationEntryBuilder ( ) . WithContent ( "key 1" ) . WithSortOrder ( 1 ) . Build ( ) ;
21
21
var entry2 = new ProfileInformationEntryBuilder ( ) . WithContent ( "key 2" ) . WithSortOrder ( 2 ) . Build ( ) ;
22
- var repoMock = RegisterServices ( ) ;
22
+ var ( repoMock , _ ) = RegisterServices ( ) ;
23
23
repoMock . Setup ( r => r . GetAllAsync ( ) )
24
24
. ReturnsAsync ( new List < ProfileInformationEntry > { entry1 , entry2 } ) ;
25
25
var cut = RenderComponent < Profile > ( ) ;
@@ -49,7 +49,7 @@ public void ShouldShowAdminActionsWhenLoggedIn()
49
49
[ Fact ]
50
50
public void ShouldAddEntry ( )
51
51
{
52
- var repo = RegisterServices ( ) ;
52
+ var ( repo , _ ) = RegisterServices ( ) ;
53
53
ProfileInformationEntry entryToDb = null ;
54
54
repo . Setup ( p => p . StoreAsync ( It . IsAny < ProfileInformationEntry > ( ) ) )
55
55
. Callback < ProfileInformationEntry > ( p => entryToDb = p ) ;
@@ -69,7 +69,7 @@ public void ShouldDeleteEntryWhenConfirmed()
69
69
{
70
70
var entryToDelete = new ProfileInformationEntryBuilder ( ) . WithContent ( "key 2" ) . Build ( ) ;
71
71
entryToDelete . Id = "SomeId" ;
72
- var repoMock = RegisterServices ( ) ;
72
+ var ( repoMock , _ ) = RegisterServices ( ) ;
73
73
repoMock . Setup ( r => r . GetAllAsync ( ) ) . ReturnsAsync ( new [ ] { entryToDelete } ) ;
74
74
var cut = RenderComponent < Profile > ( p => p . Add ( s => s . IsAuthenticated , true ) ) ;
75
75
cut . Find ( ".profile-keypoints li button" ) . Click ( ) ;
@@ -84,7 +84,7 @@ public void ShouldNotDeleteEntryWhenNotConfirmed()
84
84
{
85
85
var entryToDelete = new ProfileInformationEntryBuilder ( ) . WithContent ( "key 2" ) . Build ( ) ;
86
86
entryToDelete . Id = "SomeId" ;
87
- var repoMock = RegisterServices ( ) ;
87
+ var ( repoMock , _ ) = RegisterServices ( ) ;
88
88
repoMock . Setup ( r => r . GetAllAsync ( ) ) . ReturnsAsync ( new [ ] { entryToDelete } ) ;
89
89
var cut = RenderComponent < Profile > ( p => p . Add ( s => s . IsAuthenticated , true ) ) ;
90
90
cut . Find ( ".profile-keypoints li button" ) . Click ( ) ;
@@ -97,7 +97,7 @@ public void ShouldNotDeleteEntryWhenNotConfirmed()
97
97
[ Fact ]
98
98
public void ShouldAddEntryWithCorrectSortOrder ( )
99
99
{
100
- var repo = RegisterServices ( ) ;
100
+ var ( repo , _ ) = RegisterServices ( ) ;
101
101
var entry = new ProfileInformationEntryBuilder ( ) . WithSortOrder ( 1 ) . Build ( ) ;
102
102
repo . Setup ( p => p . GetAllAsync ( ) ) . ReturnsAsync ( new [ ] { entry } ) ;
103
103
ProfileInformationEntry entryToDb = null ;
@@ -114,6 +114,12 @@ public void ShouldAddEntryWithCorrectSortOrder()
114
114
entryToDb . SortOrder . Should ( ) . Be ( 1001 ) ;
115
115
}
116
116
117
+ [ Fact ]
118
+ public void ShouldSetNewOrderWhenItemDragAndDropped ( )
119
+ {
120
+
121
+ }
122
+
117
123
private static AppConfiguration CreateEmptyConfiguration ( )
118
124
{
119
125
return new ( )
@@ -122,13 +128,15 @@ private static AppConfiguration CreateEmptyConfiguration()
122
128
} ;
123
129
}
124
130
125
- private Mock < IProfileRepository > RegisterServices ( )
131
+ private ( Mock < IProfileRepository > repoMock , Mock < ISortOrderCalculator > calcMock ) RegisterServices ( )
126
132
{
127
133
var repoMock = new Mock < IProfileRepository > ( ) ;
134
+ var calcMock = new Mock < ISortOrderCalculator > ( ) ;
128
135
Services . AddScoped ( _ => CreateEmptyConfiguration ( ) ) ;
129
136
Services . AddScoped ( _ => repoMock . Object ) ;
137
+ Services . AddScoped ( _ => calcMock . Object ) ;
130
138
repoMock . Setup ( r => r . GetAllAsync ( ) ) . ReturnsAsync ( new List < ProfileInformationEntry > ( ) ) ;
131
- return repoMock ;
139
+ return ( repoMock , calcMock ) ;
132
140
}
133
141
}
134
142
}
0 commit comments