File tree Expand file tree Collapse file tree 3 files changed +49
-3
lines changed
LinkDotNet.Blog.UnitTests/Web/Pages
LinkDotNet.Blog.Web/Pages Expand file tree Collapse file tree 3 files changed +49
-3
lines changed Original file line number Diff line number Diff line change
1
+ using System . Threading . Tasks ;
2
+ using LinkDotNet . Blog . Web . Authentication ;
3
+ using LinkDotNet . Blog . Web . Pages ;
4
+ using Moq ;
5
+ using Xunit ;
6
+
7
+ namespace LinkDotNet . Blog . UnitTests . Web . Pages
8
+ {
9
+ public class LoginModelTests
10
+ {
11
+ [ Fact ]
12
+ public async Task ShouldLogin ( )
13
+ {
14
+ var loginManager = new Mock < ILoginManager > ( ) ;
15
+ var sut = new LoginModel ( loginManager . Object ) ;
16
+ const string redirectUrl = "newUrl" ;
17
+
18
+ await sut . OnGet ( redirectUrl ) ;
19
+
20
+ loginManager . Verify ( l => l . SignInAsync ( redirectUrl ) , Times . Once ) ;
21
+ }
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ using System . Threading . Tasks ;
2
+ using LinkDotNet . Blog . Web . Authentication ;
3
+ using LinkDotNet . Blog . Web . Pages ;
4
+ using Moq ;
5
+ using Xunit ;
6
+
7
+ namespace LinkDotNet . Blog . UnitTests . Web . Pages
8
+ {
9
+ public class LogoutModelTests
10
+ {
11
+ [ Fact ]
12
+ public async Task ShouldLogout ( )
13
+ {
14
+ var loginManager = new Mock < ILoginManager > ( ) ;
15
+ var sut = new LogoutModel ( loginManager . Object ) ;
16
+ const string redirectUrl = "newUrl" ;
17
+
18
+ await sut . OnGet ( redirectUrl ) ;
19
+
20
+ loginManager . Verify ( l => l . SignOutAsync ( redirectUrl ) , Times . Once ) ;
21
+ }
22
+ }
23
+ }
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ public LogoutModel(ILoginManager loginManager)
13
13
this . loginManager = loginManager ;
14
14
}
15
15
16
- public async Task OnGet ( )
16
+ public async Task OnGet ( string redirectUri )
17
17
{
18
- await loginManager . SignOutAsync ( ) ;
18
+ await loginManager . SignOutAsync ( redirectUri ) ;
19
19
}
20
20
}
21
- }
21
+ }
You can’t perform that action at this time.
0 commit comments