Skip to content

Commit 0e0dfb6

Browse files
committed
1.1.5 - Updated mudblazor 9.3, refactoring
1 parent 6943e2d commit 0e0dfb6

24 files changed

Lines changed: 119 additions & 89 deletions

File tree

src/Directory.Build.props

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Company>Hedin IT</Company>
8+
<Authors>Hedin IT</Authors>
9+
<NeutralLanguage>en-001</NeutralLanguage>
10+
<AnalysisLevel>latest</AnalysisLevel>
11+
</PropertyGroup>
12+
13+
</Project>

src/Directory.Packages.props

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageVersion Include="AspNetCore.SassCompiler" Version="1.99.0" />
9+
<PackageVersion Include="Azure.AI.OpenAI" Version="2.9.0-beta.1" />
10+
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.5.0" />
11+
<PackageVersion Include="Azure.Identity" Version="1.21.0" />
12+
<PackageVersion Include="Azure.Search.Documents" Version="11.7.0" />
13+
<PackageVersion Include="Blazor-ApexCharts" Version="6.1.0" />
14+
<PackageVersion Include="Blazored.LocalStorage" Version="4.5.0" />
15+
<PackageVersion Include="Brism" Version="1.0.1" />
16+
<PackageVersion Include="bunit" Version="2.7.2" />
17+
<PackageVersion Include="ClosedXML" Version="0.105.0" />
18+
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
19+
<PackageVersion Include="FluentValidation" Version="12.1.1" />
20+
<PackageVersion Include="Microsoft.AspNetCore.Components.Authorization" Version="10.0.6" />
21+
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="10.0.6" />
22+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.6" />
23+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
24+
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.74.0" />
25+
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.AzureOpenAI" Version="1.74.0" />
26+
<PackageVersion Include="ModelContextProtocol" Version="1.2.0" />
27+
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="1.2.0" />
28+
<PackageVersion Include="MudBlazor" Version="9.3.0" />
29+
<PackageVersion Include="MudBlazor.Markdown" Version="9.0.0" />
30+
<PackageVersion Include="MudX.MudBlazor.Extension" Version="9.0.0" />
31+
<PackageVersion Include="Shouldly" Version="4.3.0" />
32+
<PackageVersion Include="xunit" Version="2.9.3" />
33+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
34+
</ItemGroup>
35+
36+
</Project>

src/Hedin.UI.Demo/Hedin.UI.Demo.csproj

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net10.0</TargetFramework>
54
<OutputType>Exe</OutputType>
6-
<Nullable>enable</Nullable>
7-
<ImplicitUsings>enable</ImplicitUsings>
85
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
96
<ContainerRegistry>hedinit.azurecr.io</ContainerRegistry>
107
<ContainerRepository>ims/hedin-ui-admin-demo</ContainerRepository>
@@ -37,19 +34,19 @@
3734
</ItemGroup>
3835

3936
<ItemGroup>
40-
<PackageReference Include="AspNetCore.SassCompiler" Version="1.97.1" />
41-
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0"/>
42-
<PackageReference Include="Azure.Identity" Version="1.17.1" />
43-
<PackageReference Include="Brism" Version="1.0.1"/>
44-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.3" />
45-
<PackageReference Include="MudBlazor.Markdown" Version="9.0.0" />
46-
<PackageReference Include="Azure.AI.OpenAI" Version="2.8.0-beta.1" />
47-
<PackageReference Include="Azure.Search.Documents" Version="11.7.0" />
48-
<PackageReference Include="ModelContextProtocol" Version="1.0.0"/>
49-
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="1.0.0"/>
50-
<PackageReference Include="Microsoft.SemanticKernel" Version="1.72.0" />
51-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.AzureOpenAI" Version="1.72.0" />
52-
<PackageReference Include="MudX.MudBlazor.Extension" Version="9.0.0" />
37+
<PackageReference Include="AspNetCore.SassCompiler" />
38+
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" />
39+
<PackageReference Include="Azure.Identity" />
40+
<PackageReference Include="Brism" />
41+
<PackageReference Include="Microsoft.Extensions.Configuration" />
42+
<PackageReference Include="MudBlazor.Markdown" />
43+
<PackageReference Include="Azure.AI.OpenAI" />
44+
<PackageReference Include="Azure.Search.Documents" />
45+
<PackageReference Include="ModelContextProtocol" />
46+
<PackageReference Include="ModelContextProtocol.AspNetCore" />
47+
<PackageReference Include="Microsoft.SemanticKernel" />
48+
<PackageReference Include="Microsoft.SemanticKernel.Connectors.AzureOpenAI" />
49+
<PackageReference Include="MudX.MudBlazor.Extension" />
5350
</ItemGroup>
5451

5552
<ItemGroup>

src/Hedin.UI.FlagGenerator/Hedin.UI.FlagGenerator.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net10.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<Nullable>enable</Nullable>
85
</PropertyGroup>
96

107
<ItemGroup>

src/Hedin.UI.Template.Server/Hedin.UI.Template.Server.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
33
<IsPackable>true</IsPackable>
4-
<TargetFramework>net10.0</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
<ImplicitUsings>enable</ImplicitUsings>
4+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
75
</PropertyGroup>
86
<ItemGroup>
97
<None Include=".template.config\**\*" Pack="true" PackagePath=".template.config\" />

src/Hedin.UI.Tests/Base/TestBase.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
using System.Collections.Generic;
2-
using System.Security.Claims;
3-
using System.Threading.Tasks;
1+
using System.Security.Claims;
42
using Bunit;
53
using Microsoft.Extensions.Configuration;
64
using Microsoft.Extensions.DependencyInjection;
7-
using MudBlazor.Services;
8-
using MudBlazor;
95
using Microsoft.AspNetCore.Components;
106
using Microsoft.Extensions.Localization;
117
using Microsoft.AspNetCore.Authorization;
@@ -14,13 +10,23 @@
1410
namespace Hedin.UI.Tests.Base;
1511
/// <summary>
1612
/// Base class for Blazor component tests.
17-
/// Provides a TestContext with Hedin.UI services configured
13+
/// Provides a BunitContext with Hedin.UI services configured
1814
/// and a minimal IConfiguration.
1915
/// </summary>
20-
public abstract class UiTestBase : TestContext
16+
public abstract class UiTestBase : BunitContext, IAsyncLifetime
2117
{
2218
protected IConfiguration Configuration { get; }
2319

20+
// MudBlazor registers services that are IAsyncDisposable-only (e.g. KeyInterceptorService,
21+
// PointerEventsNoneService). xUnit 2.9 calls IDisposable.Dispose on test classes, which
22+
// triggers a synchronous ServiceProvider.Dispose and throws. Route disposal through
23+
// IAsyncLifetime.DisposeAsync and no-op the sync path.
24+
protected override void Dispose(bool disposing) { }
25+
26+
Task IAsyncLifetime.InitializeAsync() => Task.CompletedTask;
27+
28+
async Task IAsyncLifetime.DisposeAsync() => await ((IAsyncDisposable)this).DisposeAsync();
29+
2430
protected UiTestBase(IDictionary<string, string?>? seedConfig = null)
2531
{
2632
// Build a minimal in-memory configuration; seed values if needed.
@@ -55,26 +61,19 @@ protected IRenderedComponent<TComponent> RenderComponentWithMudProviders<TCompon
5561
Action<ComponentParameterCollectionBuilder<TComponent>> parameterBuilder)
5662
where TComponent : class, IComponent
5763
{
58-
// Build params -> fragment that renders <TComponent ... />
59-
var fragment = new ComponentParameterCollectionBuilder<TComponent>(parameterBuilder)
60-
.Build()
61-
.ToRenderFragment<TComponent>();
62-
63-
var shell = RenderComponent<MudTestHost>(host => host.Add(h => h.ChildContent, fragment));
64+
var shell = Render<MudTestHost>(host => host.Add<TComponent>(h => h.ChildContent, parameterBuilder));
6465
return shell.FindComponent<TComponent>();
6566
}
6667

6768
protected IRenderedComponent<TComponent> RenderComponentWithMudProviders<TComponent>(
6869
params (string Name, object? Value)[] parameters)
6970
where TComponent : class, IComponent
7071
{
71-
var builder = new ComponentParameterCollectionBuilder<TComponent>();
72-
foreach (var (name, value) in parameters)
73-
builder.TryAdd(name, value); // name/value fallback
74-
75-
var fragment = builder.Build().ToRenderFragment<TComponent>();
76-
77-
var shell = RenderComponent<MudTestHost>(host => host.Add(h => h.ChildContent, fragment));
72+
var shell = Render<MudTestHost>(host => host.Add<TComponent>(h => h.ChildContent, child =>
73+
{
74+
foreach (var (name, value) in parameters)
75+
child.TryAdd(name, value);
76+
}));
7877
return shell.FindComponent<TComponent>();
7978
}
8079

@@ -137,7 +136,7 @@ public override Task<AuthenticationState> GetAuthenticationStateAsync()
137136

138137
public event AuthenticationStateChangedHandler? AuthenticationStateChanged;
139138

140-
public void NotifyAuthenticationStateChanged(Task<AuthenticationState> task)
139+
public new void NotifyAuthenticationStateChanged(Task<AuthenticationState> task)
141140
{
142141
AuthenticationStateChanged?.Invoke(task);
143142
}

src/Hedin.UI.Tests/Components/HUIAppBarTests/HUIAppBarTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// Services.AddSingleton<NavigationManager>(new TestNavigationManager());
3030
// Services.AddSingleton<IJSRuntime>(new TestJSRuntime());
3131

32-
// return RenderComponent<HUIAppBar>(parameters => parameters
32+
// return Render<HUIAppBar>(parameters => parameters
3333
// .Add(p => p.ChildContent, childContent)
3434
// .Add(p => p.MenuButtonVisibilityChanged, menuButtonVisibilityChanged ?? EventCallback.Factory.Create<bool>(this, _ => { }))
3535
// .Add(p => p.MenuButtonClicked, menuButtonClicked ?? EventCallback.Factory.Create(this, () => { }))

src/Hedin.UI.Tests/Components/HUIAttachmentCardTests/HUIAttachmentCardTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private IRenderedComponent<HUIAttachmentCard> RenderComponentWithParams(
1414
EventCallback? onViewClick = null,
1515
EventCallback? onRemoveClick = null)
1616
{
17-
return RenderComponent<HUIAttachmentCard>(parameters => parameters
17+
return Render<HUIAttachmentCard>(parameters => parameters
1818
.Add(p => p.Buttons, buttons)
1919
.Add(p => p.FileInformation, fileInformation)
2020
.Add(p => p.ImgSrc, imgSrc)

src/Hedin.UI.Tests/Components/HUIBlogPostTests/HUIBlogPostTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private IRenderedComponent<HUIBlogPost> RenderComponentWithParams(
1919
bool imgLazyLoad = false,
2020
int maxBodyLength = 300)
2121
{
22-
return RenderComponent<HUIBlogPost>(parameters => parameters
22+
return Render<HUIBlogPost>(parameters => parameters
2323
.Add(p => p.Header, header)
2424
.Add(p => p.SubHeader, subHeader)
2525
.Add(p => p.BodyText, bodyText)

src/Hedin.UI.Tests/Components/HUIBreadcrumbsTests/HUIBreadcrumbsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private IRenderedComponent<HUIBreadcrumbs> RenderComponentWithParams(
1717
Services.AddSingleton<NavigationManager>(new TestNavigationManager());
1818
Services.AddSingleton<IJSRuntime>(new TestJSRuntime());
1919

20-
return RenderComponent<HUIBreadcrumbs>(parameters => parameters
20+
return Render<HUIBreadcrumbs>(parameters => parameters
2121
.Add(p => p.Breadcrumbs, breadcrumbs ?? new List<BreadcrumbItem>())
2222
);
2323
}

0 commit comments

Comments
 (0)