Skip to content

Commit 904bbd3

Browse files
committed
Update to .NET 8
1 parent 8ef5ec8 commit 904bbd3

16 files changed

+347
-405
lines changed

.github/workflows/deploy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup .NET
2121
uses: actions/setup-dotnet@v3
2222
with:
23-
dotnet-version: 7.0.x
23+
dotnet-version: 8.0.x
2424
- name: Restore dependencies
2525
run: dotnet restore
2626
- name: Build
@@ -42,7 +42,7 @@ jobs:
4242
uses: azure/CLI@v1
4343
with:
4444
inlineScript: |
45-
az storage copy -s '${{ env.WEB_APP_NAME }}/bin/Release/net7.0/publish/wwwroot/*' --destination-account-name ${{ env.ACCOUNT_NAME }} --destination-container '$web' --recursive
45+
az storage copy -s '${{ env.WEB_APP_NAME }}/bin/Release/net8.0/publish/wwwroot/*' --destination-account-name ${{ env.ACCOUNT_NAME }} --destination-container '$web' --recursive
4646
- name: logout
4747
run: |
4848
az logout

StoicDreams.BlazorUI.BuildTests/Components/Layouts/BUIPageLayoutTests.cs

+41-41
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,45 @@ namespace StoicDreams.BlazorUI.Components.Layouts;
66

77
public class BUIPageLayoutTests : TestFrameworkBlazor
88
{
9-
[Theory]
10-
[InlineData("page-transitional", true, false)]
11-
public void Verify_Render_FirstRender(string expectedClass, bool intoView, bool isBackwards)
12-
{
13-
IRenderActions<BUIPageLayout> actions = ArrangeThisTest(intoView, isBackwards, true);
14-
15-
actions.Act(a => { });
16-
17-
actions.Assert(a =>
18-
{
19-
a.Render.Markup.Should().Contain("Mock Content");
20-
a.Render.Find(".page-transitional").ClassName.Should().BeEquivalentTo(expectedClass);
21-
});
22-
}
23-
24-
[Theory]
25-
[InlineData("animate__fadeInDown", true, false)]
26-
public void Verify_Render_SubsequentRenders(string expectedClass, bool intoView, bool isBackwards)
27-
{
28-
IRenderActions<BUIPageLayout> actions = ArrangeThisTest(intoView, isBackwards, false);
29-
30-
actions.Act(a => { });
31-
32-
actions.Assert(a =>
33-
{
34-
a.Render.Markup.Should().Contain("Mock Content");
35-
a.Render.Find(".page-transitional").ClassName.Should().Contain(expectedClass);
36-
});
37-
}
38-
39-
private IRenderActions<BUIPageLayout> ArrangeThisTest(bool intoView, bool isBackwards, bool isFirstRender)
40-
{
41-
return ArrangeRenderTest<BUIPageLayout>(options =>
42-
{
43-
Dictionary<string, object> map = new();
44-
IReadOnlyDictionary<string, object> roMap = new ReadOnlyDictionary<string, object>(map);
45-
RouteData routeData = new(typeof(Pages.BUIError), roMap);
46-
options.Parameters.Add("Transition", Transition.Create(routeData, routeData, intoView, isBackwards, isFirstRender));
47-
options.Parameters.Add("Body", MockRender("Mock Content"));
48-
}, this.StartupTestServices);
49-
}
9+
[Theory]
10+
[InlineData("page-transitional", true, false)]
11+
public void Verify_Render_FirstRender(string expectedClass, bool intoView, bool isBackwards)
12+
{
13+
IRenderActions<BUIPageLayout> actions = ArrangeThisTest(intoView, isBackwards, true);
14+
15+
actions.Act(a => { });
16+
17+
actions.Assert(a =>
18+
{
19+
a.Render.Markup.Should().Contain("Mock Content");
20+
a.Render.Find(".page-transitional").ClassName.Should().BeEquivalentTo(expectedClass);
21+
});
22+
}
23+
24+
[Theory]
25+
[InlineData("animate__fadeInDown", true, false)]
26+
public void Verify_Render_SubsequentRenders(string expectedClass, bool intoView, bool isBackwards)
27+
{
28+
IRenderActions<BUIPageLayout> actions = ArrangeThisTest(intoView, isBackwards, false);
29+
30+
actions.Act(a => { });
31+
32+
actions.Assert(a =>
33+
{
34+
a.Render.Markup.Should().Contain("Mock Content");
35+
a.Render.Find(".page-transitional").ClassName.Should().Contain(expectedClass);
36+
});
37+
}
38+
39+
private IRenderActions<BUIPageLayout> ArrangeThisTest(bool intoView, bool isBackwards, bool isFirstRender)
40+
{
41+
return ArrangeRenderTest<BUIPageLayout>(options =>
42+
{
43+
Dictionary<string, object?> map = [];
44+
IReadOnlyDictionary<string, object?> roMap = new ReadOnlyDictionary<string, object?>(map);
45+
RouteData routeData = new(typeof(Pages.BUIError), roMap);
46+
options.Parameters.Add("Transition", Transition.Create(routeData, routeData, intoView, isBackwards, isFirstRender));
47+
options.Parameters.Add("Body", MockRender("Mock Content"));
48+
}, this.StartupTestServices);
49+
}
5050
}

StoicDreams.BlazorUI.BuildTests/Data/AppOptionsTests.cs

+49-49
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,53 @@ namespace StoicDreams.BlazorUI.Data;
44

55
public class AppOptionsTests : TestFramework
66
{
7-
[Fact]
8-
public void Verify_Usage()
9-
{
10-
bool applyStateOnStartup = false;
11-
IActions<AppOptions> actions = ArrangeUnitTest<AppOptions>(options =>
12-
{
13-
14-
});
15-
16-
actions.Act(a =>
17-
{
18-
a.Service.ApplyOnStartup<MockGenericComponent>();
19-
a.Service.ApplyStateOnStartup(_ => { applyStateOnStartup = true; });
20-
a.Service.SetLayout<MockLayout>();
21-
a.Service.SetPageNotFound<MockPageNotFound>();
22-
a.Service.SetTitleBarContent<MockGenericComponent>();
23-
});
24-
25-
actions.Assert(a =>
26-
{
27-
applyStateOnStartup.Should().BeFalse();
28-
a.Service.AppStartupComponent.Should().Be(typeof(MockGenericComponent));
29-
a.Service.MainLayout.Should().Be(typeof(MockLayout));
30-
a.Service.PageNotFound.Should().Be(typeof(MockPageNotFound));
31-
a.Service.TitleBarContent.Should().Be(typeof(MockGenericComponent));
32-
});
33-
34-
actions.Act(a =>
35-
{
36-
a.Service.ApplyStartupState?.Invoke(Mock<IAppState>().Object);
37-
});
38-
39-
actions.Assert(a =>
40-
{
41-
applyStateOnStartup.Should().BeTrue();
42-
});
43-
}
44-
45-
public class MockLayout : LayoutComponentBase
46-
{
47-
}
48-
49-
public class MockPageNotFound : ComponentBase
50-
{
51-
}
52-
53-
public class MockGenericComponent : ComponentBase
54-
{
55-
}
7+
[Fact]
8+
public void Verify_Usage()
9+
{
10+
bool applyStateOnStartup = false;
11+
IActions<AppOptions> actions = ArrangeUnitTest<AppOptions>(options =>
12+
{
13+
14+
});
15+
16+
actions.Act(a =>
17+
{
18+
a.Service.ApplyOnStartup<MockGenericComponent>();
19+
a.Service.ApplyStateOnStartup(_ => { applyStateOnStartup = true; });
20+
a.Service.SetLayout<MockLayout>();
21+
a.Service.SetPageNotFound<MockPageNotFound>();
22+
a.Service.SetTitleBarContent<MockGenericComponent>();
23+
});
24+
25+
actions.Assert(a =>
26+
{
27+
applyStateOnStartup.Should().BeFalse();
28+
a.Service.AppStartupComponent.Should().Be(typeof(MockGenericComponent));
29+
a.Service.MainLayout.Should().Be(typeof(MockLayout));
30+
a.Service.PageNotFound.Should().Be(typeof(MockPageNotFound));
31+
a.Service.TitleBarContent.Should().Be(typeof(MockGenericComponent));
32+
});
33+
34+
actions.Act(a =>
35+
{
36+
a.Service.ApplyStartupState?.Invoke(Sub<IAppState>());
37+
});
38+
39+
actions.Assert(a =>
40+
{
41+
applyStateOnStartup.Should().BeTrue();
42+
});
43+
}
44+
45+
public class MockLayout : LayoutComponentBase
46+
{
47+
}
48+
49+
public class MockPageNotFound : ComponentBase
50+
{
51+
}
52+
53+
public class MockGenericComponent : ComponentBase
54+
{
55+
}
5656
}

StoicDreams.BlazorUI.BuildTests/Data/JsInteropTests.cs

-87
This file was deleted.

StoicDreams.BlazorUI.BuildTests/ExtendTestFrameworkBlazor.cs

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ namespace StoicDreams.BlazorUI;
55

66
public static class ExtendTestFrameworkBlazor
77
{
8-
public static IServiceCollection StartupTestServices(this TestFrameworkBlazor test, IServiceCollection services)
9-
{
10-
ExtendIServiceCollection.AddStoicDreamsBlazorUI(services);
11-
services.AddMock<IJsInterop>();
12-
services.AddMock<IJSRuntime>();
13-
AppOptions options = new();
14-
options.CssFiles.Add("mockcss");
15-
options.JavascriptFiles.Add("mockjs");
16-
options.HeadElements.Add(ElementDetail.Create("script"));
17-
options.BodyElements.Add(ElementDetail.Create("script"));
18-
services.AddSingleton<IAppOptions>(options);
19-
services.AddSingleton<IAppState, AppState>();
20-
return services;
21-
}
8+
public static IServiceCollection StartupTestServices(this TestFrameworkBlazor test, IServiceCollection services)
9+
{
10+
ExtendIServiceCollection.AddStoicDreamsBlazorUI(services);
11+
services.AddSub<IJsInterop>();
12+
services.AddSub<IJSRuntime>();
13+
AppOptions options = new();
14+
options.CssFiles.Add("mockcss");
15+
options.JavascriptFiles.Add("mockjs");
16+
options.HeadElements.Add(ElementDetail.Create("script"));
17+
options.BodyElements.Add(ElementDetail.Create("script"));
18+
services.AddSingleton<IAppOptions>(options);
19+
services.AddSingleton<IAppState, AppState>();
20+
return services;
21+
}
2222
}

StoicDreams.BlazorUI.BuildTests/StoicDreams.BlazorUI.BuildTests.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -12,10 +12,10 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="bunit" Version="1.24.10" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
17-
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.5.15" />
18-
<PackageReference Include="xunit" Version="2.5.3" />
15+
<PackageReference Include="bunit" Version="1.25.3" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17+
<PackageReference Include="StoicDreams.TestFramework.Blazor" Version="1.6.1" />
18+
<PackageReference Include="xunit" Version="2.6.1" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>
@@ -29,7 +29,7 @@
2929
<ItemGroup>
3030
<ProjectReference Include="..\StoicDreams.BlazorUI\StoicDreams.BlazorUI.csproj" />
3131
</ItemGroup>
32-
32+
3333
<ItemGroup>
3434
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
3535
</ItemGroup>
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
global using Bunit;
22
global using FluentAssertions;
3-
global using Moq;
43
global using MudBlazor;
4+
global using NSubstitute;
55
global using StoicDreams.BlazorUI.Data;
66
global using StoicDreams.BlazorUI.DataTypes;
77
global using StoicDreams.BlazorUI.Extensions;
88
global using StoicDreams.Core.Constants;
99
global using StoicDreams.Core.State;
10-
1110
global using Xunit;

0 commit comments

Comments
 (0)