diff --git a/SpreadCheetah.Test/Tests/SpreadsheetNoteTests.cs b/SpreadCheetah.Test/Tests/SpreadsheetNoteTests.cs index ad04c50d..37a06325 100644 --- a/SpreadCheetah.Test/Tests/SpreadsheetNoteTests.cs +++ b/SpreadCheetah.Test/Tests/SpreadsheetNoteTests.cs @@ -156,6 +156,25 @@ public async Task Spreadsheet_AddNote_ThrowsOnTooLongText(int textLength, bool e Assert.Equal(exceptionExpected, exception is ArgumentException); } + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" ")] + [InlineData("A")] + [InlineData("A0")] + [InlineData("A1:A2")] + [InlineData("$A$1")] + public async Task Spreadsheet_AddNote_InvalidReference(string reference) + { + // Arrange + using var stream = new MemoryStream(); + await using var spreadsheet = await Spreadsheet.CreateNewAsync(stream); + await spreadsheet.StartWorksheetAsync("Sheet"); + + // Act & Assert + Assert.ThrowsAny(() => spreadsheet.AddNote(reference, "My note")); + } + [Theory] [InlineData("A1", "1.2pt")] [InlineData("A2", "8.4pt")]