Skip to content

Commit

Permalink
Update dependencies for .NET 8 (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalyIsaac authored Aug 4, 2024
1 parent a286e32 commit ea8719b
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 63 deletions.
36 changes: 18 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="DotNext" Version="4.15.2" />
<PackageVersion Include="Markdig" Version="0.33.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Scripting" Version="4.8.0" />
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="7.0.0" />
<PackageVersion Include="DotNext" Version="5.11.0" />
<PackageVersion Include="Markdig" Version="0.37.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Scripting" Version="4.10.0" />
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.106" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageVersion Include="Octokit" Version="9.0.0" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<PackageVersion Include="Octokit" Version="13.0.1" />
<PackageVersion Include="Serilog" Version="4.0.1" />
<PackageVersion Include="Serilog.Sinks.Async" Version="2.0.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.7" />
</ItemGroup>
<!-- Test dependencies -->
<ItemGroup>
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.16" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.analyzers" Version="1.11.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit.analyzers" Version="1.15.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion src/Whim.Bar.Tests/Whim.Bar.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" />
<PackageReference Include="NSubstitute.Analyzers.CSharp">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
5 changes: 4 additions & 1 deletion src/Whim.Tests/Whim.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
<PackageReference Include="NSubstitute" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.analyzers" />
<PackageReference Include="xunit.analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
62 changes: 31 additions & 31 deletions src/Whim.Tests/Window/WindowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class WindowTests
internal void Handle(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
HWND handle = window.Handle;
Expand All @@ -65,7 +65,7 @@ internal void Title(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.GetWindowText(Arg.Any<HWND>()).Returns("title");

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
string title = window.Title;
Expand All @@ -80,7 +80,7 @@ internal void WindowClass(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.GetClassName(Arg.Any<HWND>()).Returns("windowClass");

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
string windowClass = window.WindowClass;
Expand All @@ -93,7 +93,7 @@ internal void WindowClass(IContext ctx, IInternalContext internalCtx)
internal void Rectangle(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
IRectangle<int> rect = window.Rectangle;
Expand All @@ -109,7 +109,7 @@ internal void Rectangle(IContext ctx, IInternalContext internalCtx)
internal void ProcessId(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
int processId = window.ProcessId;
Expand All @@ -122,7 +122,7 @@ internal void ProcessId(IContext ctx, IInternalContext internalCtx)
internal void ProcessFileName(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
string? processFileName = window.ProcessFileName;
Expand All @@ -140,7 +140,7 @@ internal void ProcessFileName_NA(IContext ctx, IInternalContext internalCtx)
// However, I can't be bothered to mock that out.
internalCtx.CoreNativeManager.GetProcessNameAndPath(Arg.Any<int>()).Returns((string.Empty, null));

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
string? processFileName = window.ProcessFileName;
Expand All @@ -155,7 +155,7 @@ internal void IsFocused(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.GetForegroundWindow().Returns(new HWND(123));

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool isFocused = window.IsFocused;
Expand All @@ -170,7 +170,7 @@ internal void IsMinimized(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.IsWindowMinimized(Arg.Any<HWND>()).Returns((BOOL)true);

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool isMinimized = window.IsMinimized;
Expand All @@ -185,7 +185,7 @@ internal void IsMaximized(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.IsWindowMaximized(Arg.Any<HWND>()).Returns((BOOL)true);

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool isMaximized = window.IsMaximized;
Expand All @@ -200,7 +200,7 @@ internal void BringToTop(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.BringWindowToTop(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.BringToTop();
Expand All @@ -215,7 +215,7 @@ internal void Close(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.QuitWindow(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.Close();
Expand All @@ -230,7 +230,7 @@ internal void Focus(IContext ctx, IInternalContext internalCtx)
// Given
internalCtx.CoreNativeManager.SetForegroundWindow(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.Focus();
Expand All @@ -247,7 +247,7 @@ internal void Hide(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.HideWindow(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.Hide();
Expand All @@ -262,7 +262,7 @@ internal void ShowMaximized(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.ShowWindowMaximized(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.ShowMaximized();
Expand All @@ -277,7 +277,7 @@ internal void ShowMinimized(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.ShowWindowMinimized(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.ShowMinimized();
Expand All @@ -292,7 +292,7 @@ internal void ShowNormal(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.ShowWindowNoActivate(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.ShowNormal();
Expand All @@ -307,7 +307,7 @@ internal void Restore(IContext ctx, IInternalContext internalCtx)
// Given
ctx.NativeManager.RestoreWindow(Arg.Any<HWND>());

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
window.Restore();
Expand All @@ -325,7 +325,7 @@ internal void CreateWindow_Null(IContext ctx, IInternalContext internalCtx)
.Do(x => throw new Win32Exception());

// When
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// Then
Assert.Null(window);
Expand All @@ -335,7 +335,7 @@ internal void CreateWindow_Null(IContext ctx, IInternalContext internalCtx)
internal void Equals_Null(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool equals = window.Equals(null);
Expand All @@ -348,7 +348,7 @@ internal void Equals_Null(IContext ctx, IInternalContext internalCtx)
internal void Equals_WrongType(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool equals = window.Equals(new object());
Expand All @@ -361,7 +361,7 @@ internal void Equals_WrongType(IContext ctx, IInternalContext internalCtx)
internal void Equals_NotWindow(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool equals = window.Equals(Substitute.For<IWindow>());
Expand All @@ -374,8 +374,8 @@ internal void Equals_NotWindow(IContext ctx, IInternalContext internalCtx)
internal void Equals_Success(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;
IWindow? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool equals = window.Equals(window2);
Expand All @@ -388,8 +388,8 @@ internal void Equals_Success(IContext ctx, IInternalContext internalCtx)
internal void Equals_Operator_Success(IContext ctx, IInternalContext internalCtx)
{
// Given
Window? window = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.OrDefault()! as Window;
Window? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.OrDefault()! as Window;
Window? window = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.ValueOrDefault! as Window;
Window? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.ValueOrDefault! as Window;

// When
bool equals = window == window2;
Expand All @@ -402,8 +402,8 @@ internal void Equals_Operator_Success(IContext ctx, IInternalContext internalCtx
internal void NotEquals_Operator_Success(IContext ctx, IInternalContext internalCtx)
{
// Given
Window? window = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.OrDefault()! as Window;
Window? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(1234))!.OrDefault()! as Window;
Window? window = Window.CreateWindow(ctx, internalCtx, new HWND(123))!.ValueOrDefault! as Window;
Window? window2 = Window.CreateWindow(ctx, internalCtx, new HWND(1234))!.ValueOrDefault! as Window;

// When
bool equals = window != window2;
Expand All @@ -416,7 +416,7 @@ internal void NotEquals_Operator_Success(IContext ctx, IInternalContext internal
internal void GetHashCode_Success(IContext ctx, IInternalContext internalCtx)
{
// Given
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow? window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
int hashCode = window.GetHashCode();
Expand All @@ -434,7 +434,7 @@ internal void IsUwp_True(IContext ctx, IInternalContext internalCtx)
.CoreNativeManager.GetProcessNameAndPath(Arg.Any<int>())
.Returns(("processName", "app/ApplicationFrameHost.exe"));

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool isUwp = window.IsUwp;
Expand All @@ -451,7 +451,7 @@ internal void IsUwp_False(IContext ctx, IInternalContext internalCtx)
.CoreNativeManager.GetProcessNameAndPath(Arg.Any<int>())
.Returns(("processName", "processFileName"));

IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).OrDefault()!;
IWindow window = Window.CreateWindow(ctx, internalCtx, new HWND(123)).ValueOrDefault!;

// When
bool isUwp = window.IsUwp;
Expand Down
10 changes: 5 additions & 5 deletions src/Whim/Butler/ButlerPantry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ public ButlerPantry(IContext context)
}

public IWorkspace? GetAdjacentWorkspace(IWorkspace workspace, bool reverse = false, bool skipActive = false) =>
_ctx.Store.Pick(PickAdjacentWorkspace(workspace.Id, reverse, skipActive)).OrDefault();
_ctx.Store.Pick(PickAdjacentWorkspace(workspace.Id, reverse, skipActive)).ValueOrDefault;

public IEnumerable<IWorkspace> GetAllActiveWorkspaces() => _ctx.Store.Pick(PickAllActiveWorkspaces());

public IMonitor? GetMonitorForWindow(IWindow window) =>
_ctx.Store.Pick(PickMonitorByWindow(window.Handle)).OrDefault();
_ctx.Store.Pick(PickMonitorByWindow(window.Handle)).ValueOrDefault;

public IMonitor? GetMonitorForWorkspace(IWorkspace workspace) =>
_ctx.Store.Pick(PickMonitorByWorkspace(workspace.Id)).OrDefault();
_ctx.Store.Pick(PickMonitorByWorkspace(workspace.Id)).ValueOrDefault;

public IWorkspace? GetWorkspaceForMonitor(IMonitor monitor) =>
_ctx.Store.Pick(PickWorkspaceByMonitor(monitor.Handle)).OrDefault();
_ctx.Store.Pick(PickWorkspaceByMonitor(monitor.Handle)).ValueOrDefault;

public IWorkspace? GetWorkspaceForWindow(IWindow window) =>
_ctx.Store.Pick(PickWorkspaceByWindow(window.Handle)).OrDefault();
_ctx.Store.Pick(PickWorkspaceByWindow(window.Handle)).ValueOrDefault;
}
2 changes: 1 addition & 1 deletion src/Whim/Monitor/MonitorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IMonitor GetNextMonitor(IMonitor monitor) =>
_context.Store.Pick(PickAdjacentMonitor(monitor.Handle, reverse: false, getFirst: true)).Value;

public IMonitor? GetMonitorByHandle(HMONITOR hmonitor) =>
_context.Store.Pick(PickMonitorByHandle(hmonitor)).OrDefault();
_context.Store.Pick(PickMonitorByHandle(hmonitor)).ValueOrDefault;

protected virtual void Dispose(bool disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ internal override Result<Unit> Execute(IContext ctx, IInternalContext internalCt
}

// Get the old workspace for the event.
IWorkspace? oldWorkspace = ctx.Store.Pick(PickWorkspaceByMonitor(targetMonitorHandle)).OrDefault();
IWorkspace? oldWorkspace = ctx.Store.Pick(PickWorkspaceByMonitor(targetMonitorHandle)).ValueOrDefault;

// Find the monitor which just lost `workspace`.
IMonitor? loserMonitor = ctx.Store.Pick(PickMonitorByWorkspace(WorkspaceId)).OrDefault();
IMonitor? loserMonitor = ctx.Store.Pick(PickMonitorByWorkspace(WorkspaceId)).ValueOrDefault;

if (targetMonitorHandle == loserMonitor?.Handle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ IWindow window
MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST
);

return ctx.Store.Pick(PickWorkspaceByMonitor(hmonitor)).OrDefault();
return ctx.Store.Pick(PickWorkspaceByMonitor(hmonitor)).ValueOrDefault;
}
}
2 changes: 1 addition & 1 deletion src/Whim/Window/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Result<IWindow> CreateWindow(HWND hwnd)
return Window.CreateWindow(_context, _internalContext, hwnd);
}

public IWindow? AddWindow(HWND hwnd) => _context.Store.Dispatch(new WindowAddedTransform(hwnd)).OrDefault();
public IWindow? AddWindow(HWND hwnd) => _context.Store.Dispatch(new WindowAddedTransform(hwnd)).ValueOrDefault;

public void OnWindowFocused(IWindow? window) => _context.Store.Dispatch(new WindowFocusedTransform(window));

Expand Down
Loading

0 comments on commit ea8719b

Please sign in to comment.