Skip to content

Commit

Permalink
Test for invalid note references
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinungf committed Nov 4, 2023
1 parent 95aec86 commit 39772a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions SpreadCheetah.Test/Tests/SpreadsheetNoteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ArgumentException>(() => spreadsheet.AddNote(reference, "My note"));
}

[Theory]
[InlineData("A1", "1.2pt")]
[InlineData("A2", "8.4pt")]
Expand Down

0 comments on commit 39772a9

Please sign in to comment.