mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Matches Excel terminology, OpenXML spec, and industry convention (Aspose, Telerik, Syncfusion all use Worksheet). Property names on components remain Sheet for now; only the type name changes.
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Xunit;
|
|
|
|
using Radzen.Documents.Spreadsheet;
|
|
namespace Radzen.Blazor.Spreadsheet.Tests;
|
|
|
|
public class SecondFunctionTests
|
|
{
|
|
[Fact]
|
|
public void Second_FromDateTimeWithSeconds_ReturnsSeconds()
|
|
{
|
|
var sheet = new Worksheet(10, 10);
|
|
sheet.Cells["A1"].Data = CellData.FromDate(new System.DateTime(2020, 1, 1, 16, 48, 18));
|
|
sheet.Cells["B1"].Formula = "=SECOND(A1)";
|
|
Assert.Equal(18, sheet.Cells["B1"].Data.GetValueOrDefault<double>());
|
|
}
|
|
|
|
[Fact]
|
|
public void Second_FromDateTimeWithoutSeconds_ReturnsZero()
|
|
{
|
|
var sheet = new Worksheet(10, 10);
|
|
sheet.Cells["A2"].Data = CellData.FromDate(new System.DateTime(2020, 1, 1, 16, 48, 0));
|
|
sheet.Cells["B2"].Formula = "=SECOND(A2)";
|
|
Assert.Equal(0, sheet.Cells["B2"].Data.GetValueOrDefault<double>());
|
|
}
|
|
|
|
[Fact]
|
|
public void Second_FromDateOnly_ReturnsZero()
|
|
{
|
|
var sheet = new Worksheet(10, 10);
|
|
sheet.Cells["A3"].Data = CellData.FromDate(new System.DateTime(2020, 1, 1));
|
|
sheet.Cells["B3"].Formula = "=SECOND(A3)";
|
|
Assert.Equal(0, sheet.Cells["B3"].Data.GetValueOrDefault<double>());
|
|
}
|
|
} |