Skip to content

Commit 910042c

Browse files
committed
[ksqlDB.RestApi.Client]: BugFix- C# decimal is mapped to STRUCT type unit test. #81
1 parent e6c1e1f commit 910042c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Tests/ksqlDB.RestApi.Client.Tests/KSql/RestApi/Statements/CreateInsertTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,29 @@ public void Generate_Enum()
977977
statement.Should().Be($"INSERT INTO {nameof(Port)}s ({nameof(Port.Id)}, {nameof(Port.PortType)}) VALUES (42, '{value.PortType}');");
978978
}
979979

980+
private record Amount
981+
{
982+
[JsonPropertyName("volume")]
983+
[Decimal(20, 8)]
984+
public decimal Volume { get; init; }
985+
}
986+
987+
[Test]
988+
public void Generate_Decimal_ShouldBePrinted()
989+
{
990+
//Arrange
991+
var amount = new Amount
992+
{
993+
Volume = 1.12345678912345M,
994+
};
995+
996+
//Act
997+
string statement = new CreateInsert(modelBuilder).Generate(amount);
998+
999+
//Assert
1000+
statement.Should().Be($"INSERT INTO {nameof(Amount)}s ({nameof(Amount.Volume).ToLower()}) VALUES ({amount.Volume});");
1001+
}
1002+
9801003
#region TODO insert with functions
9811004

9821005
readonly struct MovieBytes

0 commit comments

Comments
 (0)