Files
Thom Lamb 2cd6df6481 Initial commit of the ClosedXML library
Establishes the foundational structure, core Excel functionality, and tooling.

- Implements base components for cells, ranges, columns, and rows.
- Integrates a custom calculation engine with a wide range of Excel functions.
- Adds comprehensive support for styling, conditional formatting, data validation, comments, pictures, and charts.
- Configures build setup, project metadata (NuGet), and developer guidelines.
- Includes editor and Git attributes for consistent code style and line endings.
2026-06-23 11:02:53 -05:00

83 lines
2.0 KiB
C#

using ClosedXML.Excel;
using NUnit.Framework;
namespace ClosedXML_Tests.Excel.Ranges
{
public class RangeShiftingTests
{
[Test]
public void CellReferenceRemainAfterColumnDeleted()
{
using (var wb = new XLWorkbook())
{
var ws = wb.AddWorksheet();
var d4 = ws.Cell("D4");
ws.Column("C").Delete();
Assert.AreSame(d4, ws.Cell("C4"));
}
}
[Test]
public void CellReferenceRemainAfterRowDeleted()
{
using (var wb = new XLWorkbook())
{
var ws = wb.AddWorksheet();
var d4 = ws.Cell("D4");
ws.Row(3).Delete();
Assert.AreSame(d4, ws.Cell("D3"));
}
}
[Test]
public void CellReferenceRemainAfterColumnInserted()
{
using (var wb = new XLWorkbook())
{
var ws = wb.AddWorksheet();
var d4 = ws.Cell("D4");
ws.Column("C").InsertColumnsBefore(1);
Assert.AreSame(d4, ws.Cell("E4"));
}
}
[Test]
public void CellReferenceRemainAfterRowInserted()
{
using (var wb = new XLWorkbook())
{
var ws = wb.AddWorksheet();
var d4 = ws.Cell("D4");
ws.Row(3).InsertRowsAbove(1);
Assert.AreSame(d4, ws.Cell("D5"));
}
}
[Test]
public void CellReferenceRemainAfterRangeDeleted()
{
using (var wb = new XLWorkbook())
{
var ws = wb.AddWorksheet();
var d4 = ws.Cell("D4");
var f8 = ws.Cell("F8");
ws.Range("B2:C5").Delete(XLShiftDeletedCells.ShiftCellsLeft);
ws.Range("E5:F7").Delete(XLShiftDeletedCells.ShiftCellsUp);
Assert.AreSame(d4, ws.Cell("B4"));
Assert.AreSame(f8, ws.Cell("F5"));
}
}
}
}