-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathBunitSignOutSessionStateManager.cs
More file actions
42 lines (37 loc) · 1.17 KB
/
BunitSignOutSessionStateManager.cs
File metadata and controls
42 lines (37 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#if !NET11_0_OR_GREATER
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
namespace Bunit.TestDoubles;
/// <summary>
/// Represents bUnit's own <see cref="SignOutSessionStateManager"/> that captures calls to <see cref="SetSignOutState"/>
/// that will help later to assert if the user was logged out
/// </summary>
#pragma warning disable CS0618
[RemovedInFutureVersion("SignOutSessionStateManager is obsolete")]
public class BunitSignOutSessionStateManager : SignOutSessionStateManager
#pragma warning restore CS0618
{
/// <summary>
/// Returns true when <see cref="SetSignOutState"/> was called, otherwise false
/// </summary>
public bool IsSignedOut { get; set; }
/// <summary>
/// Initializes a new instance of <see cref="BunitSignOutSessionStateManager"/>
/// </summary>
public BunitSignOutSessionStateManager(IJSRuntime jsRuntime) : base(jsRuntime)
{
}
/// <inheritdoc />
public override ValueTask SetSignOutState()
{
IsSignedOut = true;
return new ValueTask();
}
/// <inheritdoc />
public override Task<bool> ValidateSignOutState()
{
var wasSignedOut = IsSignedOut;
IsSignedOut = false;
return Task.FromResult(wasSignedOut);
}
}
#endif