1
- using Microsoft . AspNetCore . Mvc ;
2
- using Microsoft . AspNetCore . Mvc . Rendering ;
3
- using Microsoft . Extensions . Caching . Memory ;
4
- using MusicStore . Areas . Admin . Controllers ;
5
- using MusicStore . Models ;
6
- using MyTested . AspNetCore . Mvc ;
7
- using System ;
8
- using System . Collections . Generic ;
9
- using System . Linq ;
10
- using System . Threading ;
11
- using Xunit ;
12
-
13
- namespace MusicStore . Test . Controllers
1
+ namespace MusicStore . Test . Controllers
14
2
{
3
+ using System ;
4
+ using System . Collections . Generic ;
5
+ using System . Linq ;
6
+ using System . Threading ;
7
+ using Microsoft . AspNetCore . Mvc ;
8
+ using Microsoft . AspNetCore . Mvc . Rendering ;
9
+ using Microsoft . Extensions . Caching . Memory ;
10
+ using MusicStore . Areas . Admin . Controllers ;
11
+ using MusicStore . Models ;
12
+ using MyTested . AspNetCore . Mvc ;
13
+ using Xunit ;
14
+
15
15
public class StoreManagerControllerTest
16
16
{
17
17
[ Fact ]
@@ -102,7 +102,10 @@ public void CreatePostShouldHaveValidateAntiForgeryTokenAndPostAttributes()
102
102
{
103
103
MyMvc
104
104
. Controller < StoreManagerController > ( )
105
- . Calling ( x => x . Create ( new Album ( ) , From . Services < IMemoryCache > ( ) , CancellationToken . None ) )
105
+ . Calling ( x => x . Create (
106
+ new Album ( ) ,
107
+ From . Services < IMemoryCache > ( ) ,
108
+ CancellationToken . None ) )
106
109
. ShouldHave ( )
107
110
. ActionAttributes ( attr => attr
108
111
. ValidatingAntiForgeryToken ( )
@@ -139,7 +142,10 @@ public void CreatePostShouldHaveInvalidModelStateAndReturnDefaultViewWhenPassedE
139
142
{
140
143
MyMvc
141
144
. Controller < StoreManagerController > ( )
142
- . Calling ( x => x . Create ( new Album ( ) , From . Services < IMemoryCache > ( ) , CancellationToken . None ) )
145
+ . Calling ( x => x . Create (
146
+ new Album ( ) ,
147
+ From . Services < IMemoryCache > ( ) ,
148
+ CancellationToken . None ) )
143
149
. ShouldHave ( )
144
150
. InvalidModelState ( )
145
151
. AndAlso ( )
@@ -206,7 +212,10 @@ public void RemoveAlbumConfirmedShouldDeleteAlbum()
206
212
{
207
213
entities . AddRange ( albums ) ;
208
214
} ) )
209
- . Calling ( x => x . RemoveAlbumConfirmed ( From . Services < IMemoryCache > ( ) , albumId , CancellationToken . None ) )
215
+ . Calling ( x => x . RemoveAlbumConfirmed (
216
+ From . Services < IMemoryCache > ( ) ,
217
+ albumId ,
218
+ CancellationToken . None ) )
210
219
. ShouldHave ( )
211
220
. Data ( data => data . WithEntities ( context =>
212
221
{
@@ -232,7 +241,10 @@ public void RemoveAlbumConfirmedShouldReturnNotFoundCalledWithNotExistingAlbumId
232
241
{
233
242
entities . AddRange ( albums ) ;
234
243
} ) )
235
- . Calling ( x => x . RemoveAlbumConfirmed ( From . Services < IMemoryCache > ( ) , albumId , CancellationToken . None ) )
244
+ . Calling ( x => x . RemoveAlbumConfirmed (
245
+ From . Services < IMemoryCache > ( ) ,
246
+ albumId ,
247
+ CancellationToken . None ) )
236
248
. ShouldReturn ( )
237
249
. NotFound ( ) ;
238
250
}
@@ -242,7 +254,10 @@ public void EditPostShouldHaveValidateAntiForgeryTokenAndPostAttributes()
242
254
{
243
255
MyMvc
244
256
. Controller < StoreManagerController > ( )
245
- . Calling ( x => x . Edit ( From . Services < IMemoryCache > ( ) , new Album ( ) , CancellationToken . None ) )
257
+ . Calling ( x => x . Edit (
258
+ From . Services < IMemoryCache > ( ) ,
259
+ new Album ( ) ,
260
+ CancellationToken . None ) )
246
261
. ShouldHave ( )
247
262
. ActionAttributes ( attr => attr
248
263
. ValidatingAntiForgeryToken ( )
0 commit comments