Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions .claude/settings.local.json

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/csharp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
needs: [code-quality, security-scan]
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:

strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']

services:
postgres:
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
needs: [code-quality]
strategy:
matrix:
dotnet-version: ['8.x']
dotnet-version: ['10.x']
defaults:
run:
working-directory: src/csharp
Expand Down
4 changes: 2 additions & 2 deletions scripts/hooks/csharp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ echo "[pre-commit] Restoring C# dependencies"
dotnet restore --locked-mode

echo "[pre-commit] Running C# format auto-fix"
dotnet format
dotnet format whitespace

cd "$ROOT"
restage_and_fail_if_changed "src/csharp"

cd "$ROOT/src/csharp"
echo "[pre-commit] Running C# lint checks"
dotnet format --verify-no-changes --verbosity diagnostic
dotnet build --verbosity minimal --configuration Release --no-restore
dotnet format whitespace --verify-no-changes
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void Lamps_ShouldBeDbSet()

// Assert
Assert.IsNotNull(context.Lamps);
Assert.IsInstanceOfType(context.Lamps, typeof(DbSet<LampDbEntity>));
Assert.IsInstanceOfType<DbSet<LampDbEntity>>(context.Lamps);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public class PostgresLampRepositoryUnitTests
public void Initialize()
{
this.mockLogger = new Mock<ILogger<PostgresLampRepository>>();

// [LoggerMessage] source-generated methods call IsEnabled() before Log().
// Return true so the log call is not short-circuited by the mock.
this.mockLogger.Setup(l => l.IsEnabled(LogLevel.Debug)).Returns(true);
}

/// <summary>
Expand Down Expand Up @@ -147,6 +151,7 @@ public async Task Operations_ShouldLogDebugMessages()
await repository.DeleteAsync(lamp.Id);

// Assert - Verify debug logging was called
#pragma warning disable CA1873 // Moq.Verify lambda is not a real log call; false positive
this.mockLogger.Verify(
logger => logger.Log(
LogLevel.Debug,
Expand All @@ -155,6 +160,7 @@ public async Task Operations_ShouldLogDebugMessages()
It.IsAny<Exception>(),
It.IsAny<Func<It.IsAnyType, Exception?, string>>()),
Times.AtLeast(5));
#pragma warning restore CA1873
}

/// <summary>
Expand Down
7 changes: 4 additions & 3 deletions src/csharp/LampControlApi.Tests/LampControlApi.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.11" ExcludeAssets="build" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" ExcludeAssets="build" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Testcontainers.PostgreSql" Version="3.7.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public async Task DeleteLampAsync_WhenLampExists_ShouldDeleteSuccessfully()
var actionResult = await _controller.DeleteLampAsync(lampId.ToString());

// Assert - No exception should be thrown and check for NoContentResult
Assert.IsInstanceOfType(actionResult, typeof(Microsoft.AspNetCore.Mvc.NoContentResult));
Assert.IsInstanceOfType<Microsoft.AspNetCore.Mvc.NoContentResult>(actionResult);
_mockRepository.Verify(r => r.DeleteAsync(lampId, It.IsAny<CancellationToken>()), Times.Once);
}
}
Expand Down
Loading
Loading