Skip to content

Commit

Permalink
adding notation unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveWinward committed Nov 26, 2023
1 parent f3ccd59 commit cb4e244
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet-test-explorer.testProjectPath": "**/*Tests.csproj"
}
56 changes: 56 additions & 0 deletions src/GoogleSheetsWrapper.Tests/SheetRangeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,62 @@ public void SheetRangeWithTabNameA1NotationFormattedCorrectly()
Assert.IsTrue(range.Equals(newRange));
}

[Test]
public void SheetRangeWithTabNameNotationIncrememtStartColumnIsCorrect()
{
var range = new SheetRange("MyCustomTabName", 3, 1, 5, 6);

Assert.AreEqual("MyCustomTabName!C1:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R6C5", range.R1C1Notation);

range.StartColumn = 4;

Assert.AreEqual("MyCustomTabName!D1:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C4:R6C5", range.R1C1Notation);
}

[Test]
public void SheetRangeWithTabNameNotationIncrememtStartRowIsCorrect()
{
var range = new SheetRange("MyCustomTabName", 3, 1, 5, 6);

Assert.AreEqual("MyCustomTabName!C1:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R6C5", range.R1C1Notation);

range.StartRow = 2;

Assert.AreEqual("MyCustomTabName!C2:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R2C3:R6C5", range.R1C1Notation);
}

[Test]
public void SheetRangeWithTabNameNotationIncrememtEndColumnIsCorrect()
{
var range = new SheetRange("MyCustomTabName", 3, 1, 5, 6);

Assert.AreEqual("MyCustomTabName!C1:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R6C5", range.R1C1Notation);

range.EndColumn = 6;

Assert.AreEqual("MyCustomTabName!C1:F6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R6C6", range.R1C1Notation);
}

[Test]
public void SheetRangeWithTabNameNotationIncrememtEndRowIsCorrect()
{
var range = new SheetRange("MyCustomTabName", 3, 1, 5, 6);

Assert.AreEqual("MyCustomTabName!C1:E6", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R6C5", range.R1C1Notation);

range.EndRow = 7;

Assert.AreEqual("MyCustomTabName!C1:E7", range.A1Notation);
Assert.AreEqual("MyCustomTab!R1C3:R7C5", range.R1C1Notation);
}

[Test]
public void SheetRangeNoTabNameSingleCellA1NotationIsNull()
{
Expand Down

0 comments on commit cb4e244

Please sign in to comment.