Skip to content

Commit

Permalink
Update all dependencies to latest version, especially MudBlazor to 7.0
Browse files Browse the repository at this point in the history
Update dotnet, XUnit and MudBlazor, fix MudBlazor breaking changes
  • Loading branch information
b-straub committed Jul 1, 2024
1 parent db36b5b commit 7ccff79
Show file tree
Hide file tree
Showing 23 changed files with 142 additions and 155 deletions.
4 changes: 2 additions & 2 deletions RxBlazorLightCore/RxBlazorLightCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.2" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions RxBlazorLightCoreTests/RxBlazorLightCoreTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
35 changes: 18 additions & 17 deletions RxBlazorLightCoreTests/StateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public async Task TestStateObserver()
}

[Fact]
public async void TestStateObserverCancel()
public async Task TestStateObserverCancel()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
Expand Down Expand Up @@ -811,7 +811,7 @@ public async Task TestStateObserverComplex()
}

[Fact]
public async void TestStateObserverComplexCancel()
public async Task TestStateObserverComplexCancel()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
Expand Down Expand Up @@ -847,7 +847,7 @@ public async void TestStateObserverComplexCancel()
}

[Fact]
public async void TestStateObserverThrow()
public async Task TestStateObserverThrow()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
Expand Down Expand Up @@ -895,14 +895,27 @@ IDisposable subscribeTest()
}

[Fact]
public async void TestStateObserverHandleErrorThrow()
public async Task TestStateObserverHandleErrorThrow()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
bool exception = false;
bool done = false;

IDisposable subscribeTest()
var disposable = SubscribeTest();
fixture.ResetExceptions();
fixture.CancellableObserverHandleErrorAsync.ExecuteAsync(ServiceFixture.ObserveStateThrow);
while (!done)
{
await Task.Delay(5);
}
Assert.True(exception);
Assert.Equal(1, stateChangeCount);
Assert.Empty(fixture.Exceptions);
disposable.Dispose();
return;

IDisposable SubscribeTest()
{
done = false;
stateChangeCount = 0;
Expand All @@ -928,18 +941,6 @@ IDisposable subscribeTest()
}
});
}

var disposable = subscribeTest();
fixture.ResetExceptions();
fixture.CancellableObserverHandleErrorAsync.ExecuteAsync(ServiceFixture.ObserveStateThrow);
while (!done)
{
await Task.Delay(5);
}
Assert.True(exception);
Assert.Equal(1, stateChangeCount);
Assert.Empty(fixture.Exceptions);
disposable.Dispose();
}
}
}
10 changes: 1 addition & 9 deletions RxMudBlazorLight/ButtonBase/ButtonRx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace RxMudBlazorLight.ButtonBase
internal class ButtonRx : ButtonBaseRx
{
public EventCallback<MouseEventArgs>? OnClick { get; private set; }
public EventCallback<TouchEventArgs>? OnTouch { get; private set; }

private readonly Func<Task<bool>>? _confirmExecutionAsync;

Expand All @@ -27,7 +26,6 @@ public static ButtonRx Create(MBButtonType type, Func<Task<bool>>? confirmExecut
}

[MemberNotNull(nameof(OnClick))]
[MemberNotNull(nameof(OnTouch))]
public void SetParameter(IStateCommand stateCommand, Action executeCallback, Func<bool>? canChangeCallback)
{
VerifyButtonParameters();
Expand All @@ -38,7 +36,6 @@ public void SetParameter(IStateCommand stateCommand, Action executeCallback, Fun
}

OnClick = EventCallback.Factory.Create<MouseEventArgs>(this, () => ExecuteStateCommand(stateCommand, executeCallback));
OnTouch = EventCallback.Factory.Create<TouchEventArgs>(this, () => ExecuteStateCommand(stateCommand, executeCallback));
Disabled = stateCommand.Disabled || (canChangeCallback is not null && !canChangeCallback());
}

Expand All @@ -51,7 +48,6 @@ private async Task ExecuteStateCommand(IStateCommand stateCommand, Action execut
}

[MemberNotNull(nameof(OnClick))]
[MemberNotNull(nameof(OnTouch))]
public void SetParameter(IStateCommandAsync stateCommand, Func<IStateCommandAsync, Task> executeAsyncCallback, Func<bool>? canChangeCallback, bool deferredNotification)
{
VerifyButtonParametersAsync(stateCommand);
Expand All @@ -70,7 +66,6 @@ public void SetParameter(IStateCommandAsync stateCommand, Func<IStateCommandAsyn
}

OnClick = EventCallback.Factory.Create<MouseEventArgs>(this, stateCommand.Cancel);
OnTouch = EventCallback.Factory.Create<TouchEventArgs>(this, stateCommand.Cancel);

if (_buttonType is MBButtonType.ICON)
{
Expand Down Expand Up @@ -107,14 +102,11 @@ public void SetParameter(IStateCommandAsync stateCommand, Func<IStateCommandAsyn

OnClick = EventCallback.Factory.Create<MouseEventArgs>(this, () =>
ExecuteStateCommandAsync(stateCommand, executeAsyncCallback, deferredNotification));
OnTouch = EventCallback.Factory.Create<TouchEventArgs>(this, () =>
ExecuteStateCommandAsync(stateCommand, executeAsyncCallback, deferredNotification));


Disabled = stateCommand.Disabled || (canChangeCallback is not null && !canChangeCallback());
}

OnClick ??= EventCallback.Factory.Create<MouseEventArgs>(this, _ => { });
OnTouch ??= EventCallback.Factory.Create<TouchEventArgs>(this, _ => { });
}

private async Task ExecuteStateCommandAsync(IStateCommandAsync stateCommand, Func<IStateCommandAsync, Task> executeAsyncCallback, bool deferredNotification)
Expand Down
9 changes: 2 additions & 7 deletions RxMudBlazorLight/Dialogs/DialogAsyncORx.razor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using MudBlazor;
using RxBlazorLightCore;
using RxMudBlazorLight.Extensions;

namespace RxMudBlazorLight.Dialogs
{
Expand Down Expand Up @@ -57,13 +58,7 @@ public static async Task<bool> Show(IDialogService dialogService,
var dialog = await dialogService.ShowAsync<DialogAsyncORx<T>>(title, parameters);

var res = await dialog.Result;

if (res.Canceled)
{
return false;
}

return true;
return res.OK();
}

private bool CanNotCancel()
Expand Down
11 changes: 3 additions & 8 deletions RxMudBlazorLight/Dialogs/DialogAsyncRx.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using MudBlazor;
using RxBlazorLightCore;
using RxMudBlazorLight.Buttons;
using RxMudBlazorLight.Extensions;

namespace RxMudBlazorLight.Dialogs
{
Expand Down Expand Up @@ -63,16 +64,10 @@ public static async Task<bool> Show(IDialogService dialogService,
["SuccessOnConfirm"] = successOnConfirm
};

var dialog = dialogService.Show<DialogAsyncRx<T>>(title, parameters);
var dialog = await dialogService.ShowAsync<DialogAsyncRx<T>>(title, parameters);

var res = await dialog.Result;

if (res.Canceled)
{
return false;
}

return true;
return res.OK();
}

private bool CanNotCancel()
Expand Down
11 changes: 3 additions & 8 deletions RxMudBlazorLight/Dialogs/DialogRx.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using MudBlazor;
using RxBlazorLightCore;
using RxMudBlazorLight.Buttons;
using RxMudBlazorLight.Extensions;

namespace RxMudBlazorLight.Dialogs
{
Expand Down Expand Up @@ -50,16 +51,10 @@ public static async Task<bool> Show(IDialogService dialogService,
["SuccessOnConfirm"] = successOnConfirm
};

var dialog = dialogService.Show<DialogRx<T>>(title, parameters);
var dialog = await dialogService.ShowAsync<DialogRx<T>>(title, parameters);

var res = await dialog.Result;

if (res.Canceled)
{
return false;
}

return true;
return res.OK();
}

private bool CanNotCancel()
Expand Down
12 changes: 12 additions & 0 deletions RxMudBlazorLight/Extensions/RxMudBlazorLightExtensionsExtern.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using MudBlazor;

namespace RxMudBlazorLight.Extensions
{
public static class RxMudBlazorLightExtensionsExtern
{
public static bool OK(this DialogResult? result)
{
return result is not null && !result.Canceled;
}
}
}
2 changes: 1 addition & 1 deletion RxMudBlazorLight/Inputs/MudSliderRx.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@inherits MudSlider<T>
@typeparam T
@typeparam T where T : struct, INumber<T>

@RenderBase()

Expand Down
1 change: 0 additions & 1 deletion RxMudBlazorLight/Menus/MudMenuItemAsyncRx.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
_buttonRx.SetParameter(StateCommand, ExecuteAsyncCallback, CanChangeCallback, false);

OnClick = (EventCallback<MouseEventArgs>)_buttonRx.OnClick;
OnTouch = (EventCallback<TouchEventArgs>)_buttonRx.OnTouch;
Disabled = _buttonRx.Disabled;

base.OnParametersSet();
Expand Down
1 change: 0 additions & 1 deletion RxMudBlazorLight/Menus/MudMenuItemRx.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
_buttonRx.SetParameter(StateCommand, ExecuteCallback, CanChangeCallback);

OnClick = (EventCallback<MouseEventArgs>)_buttonRx.OnClick;
OnTouch = (EventCallback<TouchEventArgs>)_buttonRx.OnTouch;
Disabled = _buttonRx.Disabled;

base.OnParametersSet();
Expand Down
102 changes: 53 additions & 49 deletions RxMudBlazorLight/RxMudBlazorLight.csproj
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<Title>RxMudBlazorLight</Title>
<Description>A simple reactive wrapper around MudBlazor components.</Description>
<Authors>Bernhard Straub</Authors>
<Copyright>Bernhard Straub</Copyright>
<PackageProjectUrl>https://github.com/b-straub/RxMudBlazorLight</PackageProjectUrl>
<RepositoryUrl>https://github.com/b-straub/RxMudBlazorLight</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>Blazor,MudBlazor,Rx,Reactive</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\Nuget</PackageOutputPath>
<PackageVersion>0.9.2</PackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.2" />
<PackageReference Include="MudBlazor" Version="6.16.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RxBlazorLightCore\RxBlazorLightCore.csproj" PrivateAssets="All" Pack="false" />
</ItemGroup>

<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddCoreToOutput</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<Target Name="_AddCoreToOutput">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\RxBlazorLightCore.dll" PackagePath="lib\$(TargetFramework)" />
</ItemGroup>
</Target>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<MudIllegalParameters>V7CaseSensitive</MudIllegalParameters>
<MudAllowedAttributePattern>LowerCase</MudAllowedAttributePattern>
</PropertyGroup>

<PropertyGroup>
<Title>RxMudBlazorLight</Title>
<Description>A simple reactive wrapper around MudBlazor components.</Description>
<Authors>Bernhard Straub</Authors>
<Copyright>Bernhard Straub</Copyright>
<PackageProjectUrl>https://github.com/b-straub/RxMudBlazorLight</PackageProjectUrl>
<RepositoryUrl>https://github.com/b-straub/RxMudBlazorLight</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>Blazor,MudBlazor,Rx,Reactive</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\Nuget</PackageOutputPath>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<SupportedPlatform Include="browser"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6"/>
<PackageReference Include="MudBlazor" Version="7.0.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RxBlazorLightCore\RxBlazorLightCore.csproj" PrivateAssets="All" Pack="false"/>
</ItemGroup>

<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddCoreToOutput</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<Target Name="_AddCoreToOutput">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)\RxBlazorLightCore.dll" PackagePath="lib\$(TargetFramework)"/>
</ItemGroup>
</Target>

</Project>
1 change: 1 addition & 0 deletions RxMudBlazorLight/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.Extensions.DependencyInjection;
@using System.Diagnostics.CodeAnalysis
@using System.Numerics
@using MudBlazor
@using RxBlazorLightCore
@using RxMudBlazorLight.Buttons
Expand Down
4 changes: 2 additions & 2 deletions RxMudBlazorLightSample/RxMudBlazorLightSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 7ccff79

Please sign in to comment.