Skip to content

Commit 07cdc67

Browse files
committed
Add minimal test project
1 parent ff6b8c2 commit 07cdc67

12 files changed

Lines changed: 281 additions & 16 deletions

Drogecode.Blazor.ExpireStorage.sln

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssertionChain_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F37a113a44daab51aaac3fcfb29d692de75becb4cf1726974647a962249aedf_003FAssertionChain_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGenericCache_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc5dcebce14cd57559452348c3c747aa6c961a8437dd464d765f9aea0d28391_003FGenericCache_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
4+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIJSRuntime_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F21e7e36a5419c3dbaae13e12a7c6b9726b289fcbe33c79ce238feef72f5c1c_003FIJSRuntime_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
5+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILocalStorageService_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fdfa35791a1dc812b2ccbd8019f39c2d5f39acfaed29f27c75446ab5fea9ec_003FILocalStorageService_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
6+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANotImplementedException_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ffbcfa522c97815dbbc420ad351b42e6ad55d0d37a9a282d8945a68a707eb_003FNotImplementedException_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
7+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F9a6b1457cbcf17db31a383ba49ef9bcc786cf3ef77146d997eee499b27a46d_003FObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
8+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOptionsServiceCollectionExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F24baa99dd8f67b797750aa9e414d3aa0bddac232f5e0cf511c68cb9d1ad1558_003FOptionsServiceCollectionExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
9+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeHelpers_002ECoreCLR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fb8d753e12338b313a0baa29e5b7010f685edfd61c8eab6f759541034cc83387_003FRuntimeHelpers_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
10+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASR_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F14939830a97c9496242b1664edddd9c7645548bce544534665f26358cfa660_003FSR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
11+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F4d431e535966d3e8d58aed86698f4938fdfbde11da876f5c3a222aa8c29b1_003FTask_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
12+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestContext_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fec7777a7fc7c8bea65cca4b05a79bcb24defadab0b5b477a71c1b23745dbe9_003FTestContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
13+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVirtualDispatchHelpers_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1fe4a1c5fe745590314b4ad86db8c4bc75c255d6ba296a572ee9ddc1a79a6999_003FVirtualDispatchHelpers_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
14+
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=aa718253_002Dbe67_002D4e35_002Dbab4_002D5fdf23f57873/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="MinimalRequestTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
15+
&lt;TestAncestor&gt;&#xD;
16+
&lt;TestId&gt;xUnit::1C862E6B-9B19-0CA3-857C-1CDFA247321F::net10.0::Drogecode.Blazor.ExpireStorage.Tests.Tests.Services.ExpireStorageServiceTests&lt;/TestId&gt;&#xD;
17+
&lt;/TestAncestor&gt;&#xD;
18+
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Solution>
2+
<Project Path="Src/Drogecode.Blazor.ExpireStorage/Drogecode.Blazor.ExpireStorage.csproj" />
3+
<Project Path="Tests/Drogecode.Blazor.ExpireStorage.Tests/Drogecode.Blazor.ExpireStorage.Tests.csproj" />
4+
</Solution>

Src/Drogecode.Blazor.ExpireStorage/Drogecode.Blazor.ExpireStorage.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
<Pack>false</Pack>
4747
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
4848
</Content>
49+
<Content Include="..\..\README.md">
50+
<Link>README.md</Link>
51+
</Content>
4952
</ItemGroup>
5053

5154
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
12+
<PackageReference Include="coverlet.collector" Version="8.0.1">
13+
<PrivateAssets>all</PrivateAssets>
14+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
15+
</PackageReference>
16+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.5" />
17+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
19+
<PackageReference Include="Xunit.DependencyInjection" Version="11.2.1" />
20+
<PackageReference Include="Xunit.DependencyInjection.Logging" Version="11.0.0" />
21+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
22+
<PrivateAssets>all</PrivateAssets>
23+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
24+
</PackageReference>
25+
<PackageReference Include="xunit.v3" Version="3.2.2" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Using Include="Xunit"/>
30+
</ItemGroup>
31+
32+
<ItemGroup>
33+
<ProjectReference Include="..\..\Src\Drogecode.Blazor.ExpireStorage\Drogecode.Blazor.ExpireStorage.csproj" />
34+
</ItemGroup>
35+
36+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
global using AwesomeAssertions;
2+
global using Xunit;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.JSInterop;
2+
3+
namespace Drogecode.Blazor.ExpireStorage.Tests.Mocks;
4+
5+
public class JSRuntimeMock : IJSRuntime
6+
{
7+
public async ValueTask<TValue> InvokeAsync<TValue>(string identifier, object?[]? args)
8+
{
9+
throw new NotImplementedException();
10+
}
11+
12+
public async ValueTask<TValue> InvokeAsync<TValue>(string identifier, CancellationToken cancellationToken, object?[]? args)
13+
{
14+
throw new NotImplementedException();
15+
}
16+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using Blazored.SessionStorage;
2+
3+
namespace Drogecode.Blazor.ExpireStorage.Tests.Mocks;
4+
5+
public class SessionStorageServiceMock : ISessionStorageService
6+
{
7+
public async ValueTask ClearAsync(CancellationToken cancellationToken = new CancellationToken())
8+
{
9+
throw new NotImplementedException();
10+
}
11+
12+
public async ValueTask<T> GetItemAsync<T>(string key, CancellationToken cancellationToken = new CancellationToken())
13+
{
14+
throw new NotImplementedException();
15+
}
16+
17+
public async ValueTask<string> GetItemAsStringAsync(string key, CancellationToken cancellationToken = new CancellationToken())
18+
{
19+
throw new NotImplementedException();
20+
}
21+
22+
public async ValueTask<string> KeyAsync(int index, CancellationToken cancellationToken = new CancellationToken())
23+
{
24+
throw new NotImplementedException();
25+
}
26+
27+
public async ValueTask<IEnumerable<string>> KeysAsync(CancellationToken cancellationToken = new CancellationToken())
28+
{
29+
throw new NotImplementedException();
30+
}
31+
32+
public async ValueTask<bool> ContainKeyAsync(string key, CancellationToken cancellationToken = new CancellationToken())
33+
{
34+
throw new NotImplementedException();
35+
}
36+
37+
public async ValueTask<int> LengthAsync(CancellationToken cancellationToken = new CancellationToken())
38+
{
39+
throw new NotImplementedException();
40+
}
41+
42+
public async ValueTask RemoveItemAsync(string key, CancellationToken cancellationToken = new CancellationToken())
43+
{
44+
throw new NotImplementedException();
45+
}
46+
47+
public async ValueTask RemoveItemsAsync(IEnumerable<string> keys, CancellationToken cancellationToken = new CancellationToken())
48+
{
49+
throw new NotImplementedException();
50+
}
51+
52+
public async ValueTask SetItemAsync<T>(string key, T data, CancellationToken cancellationToken = new CancellationToken())
53+
{
54+
throw new NotImplementedException();
55+
}
56+
57+
public async ValueTask SetItemAsStringAsync(string key, string data, CancellationToken cancellationToken = new CancellationToken())
58+
{
59+
throw new NotImplementedException();
60+
}
61+
62+
public event EventHandler<ChangingEventArgs>? Changing;
63+
public event EventHandler<ChangedEventArgs>? Changed;
64+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Drogecode.Blazor.ExpireStorage.Tests.Models;
2+
3+
public class TestStringResponse : ICacheableResponse
4+
{
5+
public HandledBy HandledBy { get; set; }
6+
public string? Data { get; set; }
7+
}

0 commit comments

Comments
 (0)