Skip to content

Commit

Permalink
[ksqlDB.RestApi.Client]: BugFix- C# decimal is mapped to STRUCT type …
Browse files Browse the repository at this point in the history
…unit test. #81
  • Loading branch information
tomasfabian committed May 29, 2024
1 parent e6c1e1f commit 910042c
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,29 @@ public void Generate_Enum()
statement.Should().Be($"INSERT INTO {nameof(Port)}s ({nameof(Port.Id)}, {nameof(Port.PortType)}) VALUES (42, '{value.PortType}');");
}

private record Amount
{
[JsonPropertyName("volume")]
[Decimal(20, 8)]
public decimal Volume { get; init; }
}

[Test]
public void Generate_Decimal_ShouldBePrinted()
{
//Arrange
var amount = new Amount
{
Volume = 1.12345678912345M,
};

//Act
string statement = new CreateInsert(modelBuilder).Generate(amount);

//Assert
statement.Should().Be($"INSERT INTO {nameof(Amount)}s ({nameof(Amount.Volume).ToLower()}) VALUES ({amount.Volume});");
}

#region TODO insert with functions

readonly struct MovieBytes
Expand Down

0 comments on commit 910042c

Please sign in to comment.