Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/example-basic/Program.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using System;
using QuestDB;

using var sender = Sender.New("http::addr=localhost:9000;");
using var sender = Sender.New("http::addr=localhost:9000;protocol_version=3");
await sender.Table("trades")
.Symbol("symbol", "ETH-USD")
.Symbol("side", "sell")
.Column("price", 2615.54)
.Column("amount", 0.00044)
.AtAsync(DateTime.UtcNow);
.Symbol("symbol", "ETH-USD")
.Symbol("side", "sell")
.Column("price", 2615.54)
.Column("amount", 0.00044)
.AtAsync(DateTime.UtcNow);

await sender.Table("trades")
.Symbol("symbol", "BTC-USD")
.Symbol("side", "sell")
.Column("price", 39269.98)
.Column("amount", 0.001)
.AtAsync(DateTime.UtcNow);
.Symbol("symbol", "BTC-USD")
.Symbol("side", "sell")
.Column("price", 39269.98)
.Column("amount", 0.001)
.AtAsync(DateTime.UtcNow);

await sender.SendAsync();
await sender.SendAsync();
3 changes: 1 addition & 2 deletions src/net-questdb-client-tests/HttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ await sender.Table("metrics")
.Symbol("tag", "value")
.Column("dec_pos", 123.45m)
.Column("dec_neg", -123.45m)
.Column("dec_null", (decimal?)null)
.NullableColumn("dec_null", (decimal?)null)
.Column("dec_max", decimal.MaxValue)
.Column("dec_min", decimal.MinValue)
.AtAsync(new DateTime(1970, 01, 01, 0, 0, 1));
Expand Down Expand Up @@ -1233,7 +1233,6 @@ public async Task CancelLineAfterError()
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}


[Test]
public async Task CannotConnect()
{
Expand Down
23 changes: 16 additions & 7 deletions src/net-questdb-client-tests/JsonSpecTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class JsonSpecTestRunner
private static readonly TestCase[]? TestCases = ReadTestCases();

/// <summary>
/// Populate the provided sender with the test case's table, symbols, and columns, then send the prepared row.
/// Populate the provided sender with the test case's table, symbols, and columns, then send the prepared row.
/// </summary>
/// <param name="sender">The ISender to configure and use for sending the test case row.</param>
/// <param name="testCase">The test case containing table name, symbols, and typed columns to write.</param>
Expand Down Expand Up @@ -82,13 +82,14 @@ private static async Task ExecuteTestCase(ISender sender, TestCase testCase)
var value = ((JsonElement)column.Value).GetString();
if (value is null)
{
sender.Column(column.Name, (decimal?)null);
sender.NullableColumn(column.Name, (decimal?)null);
}
else
{
var d = decimal.Parse(value, NumberStyles.Number, CultureInfo.InvariantCulture);
sender.Column(column.Name, d);
}

break;

default:
Expand All @@ -103,9 +104,13 @@ private static async Task ExecuteTestCase(ISender sender, TestCase testCase)
}

/// <summary>
/// Executes the provided test case by sending its configured table, symbols, and columns to a local TCP listener and asserting the listener's received output against the test case's expected result.
/// Executes the provided test case by sending its configured table, symbols, and columns to a local TCP listener and
/// asserting the listener's received output against the test case's expected result.
/// </summary>
/// <param name="testCase">The test case to run; provides table, symbols, columns to send and a Result describing the expected validation (Status, Line, AnyLines, or BinaryBase64).</param>
/// <param name="testCase">
/// The test case to run; provides table, symbols, columns to send and a Result describing the
/// expected validation (Status, Line, AnyLines, or BinaryBase64).
/// </param>
[TestCaseSource(nameof(TestCases))]
public async Task RunTcp(TestCase testCase)
{
Expand Down Expand Up @@ -162,9 +167,13 @@ public async Task RunTcp(TestCase testCase)
}

/// <summary>
/// Executes the provided test case by sending data over HTTP to a dummy server using a QuestDB sender and validates the server's response according to the test case result.
/// Executes the provided test case by sending data over HTTP to a dummy server using a QuestDB sender and validates
/// the server's response according to the test case result.
/// </summary>
/// <param name="testCase">The test case describing table, symbols, columns, and expected result (status, line(s), or base64 binary) to execute and validate.</param>
/// <param name="testCase">
/// The test case describing table, symbols, columns, and expected result (status, line(s), or
/// base64 binary) to execute and validate.
/// </param>
[TestCaseSource(nameof(TestCases))]
public async Task RunHttp(TestCase testCase)
{
Expand Down Expand Up @@ -293,7 +302,7 @@ public class TestCase
[JsonPropertyName("result")] public TestCaseResult Result { get; set; } = null!;

/// <summary>
/// Provides the test case name for display and logging.
/// Provides the test case name for display and logging.
/// </summary>
/// <returns>The TestName of the test case.</returns>
public override string ToString()
Expand Down
Loading