Skip to content

Commit

Permalink
Make Message required to get rid of null bang
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang authored and ragnarstolsmark committed Oct 18, 2023
1 parent f9d4ebd commit 4c9eb43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Hangfire.Console/Serialization/ConsoleLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class ConsoleLine
/// Message text, or message reference, or progress bar id
/// </summary>
[JsonProperty("s", Required = Required.Always)]
public string Message { get; set; } = null!;
public required string Message { get; set; }

/// <summary>
/// Text color for this message
Expand Down
4 changes: 2 additions & 2 deletions tests/Hangfire.Console.Tests/Storage/ConsoleStorageFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void AddLine_ThrowsException_IfConsoleIdIsNull()
{
var storage = new ConsoleStorage(_connection.Object);

Assert.Throws<ArgumentNullException>("consoleId", () => storage.AddLine(null!, new ConsoleLine()));
Assert.Throws<ArgumentNullException>("consoleId", () => storage.AddLine(null!, new ConsoleLine{ Message = "" }));
}

[Fact]
Expand All @@ -109,7 +109,7 @@ public void AddLine_ThrowsException_IfLineIsReference()
{
var storage = new ConsoleStorage(_connection.Object);

Assert.Throws<ArgumentException>("line", () => storage.AddLine(_consoleId, new ConsoleLine { IsReference = true }));
Assert.Throws<ArgumentException>("line", () => storage.AddLine(_consoleId, new ConsoleLine { Message = "", IsReference = true }));
}

[Fact]
Expand Down

0 comments on commit 4c9eb43

Please sign in to comment.