Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 502e74d

Browse files
committed
Avoid passing null literal to non-nullable reference type
1 parent ef42d61 commit 502e74d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

tests/ServiceLayer.Mesh.Tests/Functions/FileDiscoveryFunctionTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Moq;
1+
using Microsoft.Azure.Functions.Worker;
2+
using Moq;
23
using NHS.MESH.Client.Contracts.Services;
34
using NHS.MESH.Client.Models;
45
using ServiceLayer.Data.Models;
@@ -44,7 +45,7 @@ public async Task Run_AddsNewMessageToDbAndQueue()
4445
});
4546

4647
// Act
47-
await _function.Run(null);
48+
await _function.Run(new TimerInfo());
4849

4950
// Assert
5051
var meshFile = AssertFileUpdated(testMessageId, MeshFileStatus.Discovered);
@@ -67,7 +68,7 @@ public async Task Run_DoesNotAddDuplicateMessageOrQueueIt()
6768
});
6869

6970
// Act
70-
await _function.Run(null);
71+
await _function.Run(new TimerInfo());
7172

7273
// Assert
7374
var count = DbContext.MeshFiles.Count(f => f.FileId == existingFile.FileId);
@@ -87,7 +88,7 @@ public async Task Run_NoMessagesInInbox_DoesNothing()
8788
});
8889

8990
// Act
90-
await _function.Run(null);
91+
await _function.Run(new TimerInfo());
9192

9293
// Assert
9394
Assert.Empty(DbContext.MeshFiles);
@@ -107,7 +108,7 @@ public async Task Run_MultipleMessagesInInbox_AllAreProcessed()
107108
});
108109

109110
// Act
110-
await _function.Run(null);
111+
await _function.Run(new TimerInfo());
111112

112113
// Assert
113114
foreach (var id in messageIds)

tests/ServiceLayer.Mesh.Tests/Functions/FileRetryFunctionTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Microsoft.Azure.Functions.Worker;
12
using Moq;
23
using ServiceLayer.Data.Models;
34
using ServiceLayer.Mesh.Functions;
@@ -38,7 +39,7 @@ public async Task Run_EnqueuesDiscoveredOrExtractingFilesOlderThan12Hours(MeshFi
3839
var file = SaveMeshFile(testStatus, 13);
3940

4041
// Act
41-
await _function.Run(null);
42+
await _function.Run(new TimerInfo());
4243

4344
// Assert
4445
_fileExtractQueueClientMock.Verify(q => q.EnqueueFileExtractAsync(It.Is<MeshFile>(f => f.FileId == file.FileId)), Times.Once);
@@ -56,7 +57,7 @@ public async Task Run_EnqueuesExtractedOrTransformingFilesOlderThan12Hours(MeshF
5657
var file = SaveMeshFile(testStatus, 13);
5758

5859
// Act
59-
await _function.Run(null);
60+
await _function.Run(new TimerInfo());
6061

6162
// Assert
6263
_fileTransformQueueClientMock.Verify(q => q.EnqueueFileTransformAsync(It.Is<MeshFile>(f => f.FileId == file.FileId)), Times.Once);
@@ -76,7 +77,7 @@ public async Task Run_SkipsFreshFiles(MeshFileStatus testStatus)
7677
var file = SaveMeshFile(testStatus);
7778

7879
// Act
79-
await _function.Run(null);
80+
await _function.Run(new TimerInfo());
8081

8182
// Assert
8283
_fileExtractQueueClientMock.Verify(q => q.EnqueueFileExtractAsync(It.IsAny<MeshFile>()), Times.Never);
@@ -95,7 +96,7 @@ public async Task Run_IgnoresFilesInOtherStatuses(MeshFileStatus ignoredStatus)
9596
SaveMeshFile(ignoredStatus, 20);
9697

9798
// Act
98-
await _function.Run(null);
99+
await _function.Run(new TimerInfo());
99100

100101
// Assert
101102
_fileTransformQueueClientMock.Verify(q => q.EnqueueFileTransformAsync(It.IsAny<MeshFile>()), Times.Never);
@@ -106,7 +107,7 @@ public async Task Run_IgnoresFilesInOtherStatuses(MeshFileStatus ignoredStatus)
106107
public async Task Run_IfNoFilesFoundDoNothing()
107108
{
108109
// Act
109-
await _function.Run(null);
110+
await _function.Run(new TimerInfo());
110111

111112
// Assert
112113
_fileExtractQueueClientMock.Verify(q => q.EnqueueFileExtractAsync(It.IsAny<MeshFile>()), Times.Never);
@@ -122,7 +123,7 @@ public async Task Run_ProcessesMultipleEligibleFiles()
122123
var file3 = SaveMeshFile(MeshFileStatus.Transforming, 13);
123124

124125
// Act
125-
await _function.Run(null);
126+
await _function.Run(new TimerInfo());
126127

127128
// Assert
128129
_fileExtractQueueClientMock.Verify(q => q.EnqueueFileExtractAsync(It.Is<MeshFile>(f => f.FileId == file1.FileId)), Times.Once);

0 commit comments

Comments
 (0)