1+ using Blazored . LocalStorage ;
2+ using Microsoft . Extensions . Caching . Memory ;
3+
4+ namespace Drogecode . Blazor . ExpireStorage . Tests . Mocks ;
5+
6+ public class LocalStorageServiceMock : ILocalStorageService
7+ {
8+ private readonly IMemoryCache _memoryCache ;
9+ public LocalStorageServiceMock ( IMemoryCache memoryCache )
10+ {
11+ _memoryCache = memoryCache ;
12+ }
13+
14+ public async ValueTask ClearAsync ( CancellationToken cancellationToken = new CancellationToken ( ) )
15+ {
16+ throw new NotImplementedException ( ) ;
17+ }
18+
19+ public async ValueTask < T ? > GetItemAsync < T > ( string key , CancellationToken cancellationToken = new CancellationToken ( ) )
20+ {
21+ throw new NotImplementedException ( ) ;
22+ }
23+
24+ public async ValueTask < string ? > GetItemAsStringAsync ( string key , CancellationToken cancellationToken = new CancellationToken ( ) )
25+ {
26+ throw new NotImplementedException ( ) ;
27+ }
28+
29+ public async ValueTask < string ? > KeyAsync ( int index , CancellationToken cancellationToken = new CancellationToken ( ) )
30+ {
31+ throw new NotImplementedException ( ) ;
32+ }
33+
34+ public async ValueTask < IEnumerable < string > > KeysAsync ( CancellationToken cancellationToken = new CancellationToken ( ) )
35+ {
36+ throw new NotImplementedException ( ) ;
37+ }
38+
39+ public async ValueTask < bool > ContainKeyAsync ( string key , CancellationToken cancellationToken = new CancellationToken ( ) )
40+ {
41+ throw new NotImplementedException ( ) ;
42+ }
43+
44+ public async ValueTask < int > LengthAsync ( CancellationToken cancellationToken = new CancellationToken ( ) )
45+ {
46+ throw new NotImplementedException ( ) ;
47+ }
48+
49+ public async ValueTask RemoveItemAsync ( string key , CancellationToken cancellationToken = new CancellationToken ( ) )
50+ {
51+ throw new NotImplementedException ( ) ;
52+ }
53+
54+ public async ValueTask RemoveItemsAsync ( IEnumerable < string > keys , CancellationToken cancellationToken = new CancellationToken ( ) )
55+ {
56+ throw new NotImplementedException ( ) ;
57+ }
58+
59+ public async ValueTask SetItemAsync < T > ( string key , T data , CancellationToken cancellationToken = new CancellationToken ( ) )
60+ {
61+ _memoryCache . Set ( key , data ) ;
62+ }
63+
64+ public async ValueTask SetItemAsStringAsync ( string key , string data , CancellationToken cancellationToken = new CancellationToken ( ) )
65+ {
66+ throw new NotImplementedException ( ) ;
67+ }
68+
69+ public event EventHandler < ChangingEventArgs > ? Changing ;
70+ public event EventHandler < ChangedEventArgs > ? Changed ;
71+ }
0 commit comments