Skip to content

Commit f6c2b41

Browse files
committed
Fix coverage lapses that appear only in CI.
1 parent e44c2d3 commit f6c2b41

6 files changed

Lines changed: 24 additions & 2 deletions

File tree

PSql.Deploy.Tests/Internal/PrivateAssemblyLoadContextTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
// Copyright Subatomix Research Inc.
22
// SPDX-License-Identifier: MIT
33

4+
using System.Runtime.Loader;
5+
46
namespace PSql.Deploy.Internal;
57

68
[TestFixture]
79
public class PrivateAssemblyLoadContextTests
810
{
911
// This test class contains additional tests to achieve 100% code coverage.
1012

13+
[Test]
14+
public void HandleResolvingInDefaultLoadContext_NotPrivate()
15+
{
16+
PrivateAssemblyLoadContext
17+
.HandleResolvingInDefaultLoadContext(
18+
AssemblyLoadContext.Default,
19+
new("NotThePrivateAssembly")
20+
)
21+
.ShouldBeNull();
22+
}
23+
1124
[Test]
1225
public void Load_Empty()
1326
{

PSql.Deploy/Commands/InvokeSqlMigrationsCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ private bool ShouldProcess(SqlTargetDatabaseGroup group)
145145

146146
[Conditional("DEBUG")]
147147
[MemberNotNull(nameof(_session))]
148+
#if !DEBUG
149+
[ExcludeFromCodeCoverage(Justification = "Uninvokable due to ConditionalAttribute.")]
150+
#endif
148151
internal void AssumeBeginProcessingInvoked()
149152
{
150153
if (_session is null)

PSql.Deploy/Commands/InvokeSqlSeedCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ private bool ShouldProcess(SqlTargetDatabaseGroup group)
157157

158158
[Conditional("DEBUG")]
159159
[MemberNotNull(nameof(_session))]
160+
#if !DEBUG
161+
[ExcludeFromCodeCoverage(Justification = "Uninvokable due to ConditionalAttribute.")]
162+
#endif
160163
internal void AssumeBeginProcessingInvoked()
161164
{
162165
if (_session is null)

PSql.Deploy/Commands/TestAsyncPSCmdletCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private void InvokeTestCase(TestMoment currentMoment)
9797
case TestCase.StopProcessing: TestStopProcessing(); break;
9898
case TestCase.ThrowTerminatingError: TestThrowTerminatingError(); break;
9999
case TestCase.MultipleDispose: TestMultipleDispose(); break;
100-
case TestCase.UnmanagedDispose: TestUnmanagedDispose(); break;
100+
default: /* UnmanagedDispose: */ TestUnmanagedDispose(); break;
101101
}
102102
}
103103

PSql.Deploy/Commands/TestCmdletExtensionsCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected override void ProcessRecord()
4040
WriteObject(this.GetCurrentPath());
4141
break;
4242

43-
case TestCase.WriteHost:
43+
default: // case TestCase.WriteHost:
4444
this.WriteHost(Message);
4545
break;
4646
}

PSql.Deploy/Internal/PrivateAssemblyLoadContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
7474
return _loadedNative.GetOrAdd(unmanagedDllName, LoadUnmanagedDllCore);
7575
}
7676

77+
[ExcludeFromCodeCoverage(
78+
Justification = "This product ships no unmanaged library for non-Windows platforms."
79+
)]
7780
private IntPtr LoadUnmanagedDllCore(string name)
7881
{
7982
// Try to resolve and load

0 commit comments

Comments
 (0)