From a08ab661a18c378d512593ecf0d60c7485c8fc9b Mon Sep 17 00:00:00 2001 From: PeterN <79838809+peter-quix@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:54:49 +0100 Subject: [PATCH] Fix broken unit tests introduced in 0.5.6 (#187) --- src/CsharpClient/QuixStreams.State/ScalarState.cs | 4 +++- .../Models/Telemetry/CodecRegistryShould.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/CsharpClient/QuixStreams.State/ScalarState.cs b/src/CsharpClient/QuixStreams.State/ScalarState.cs index e488e771..7a91aa56 100644 --- a/src/CsharpClient/QuixStreams.State/ScalarState.cs +++ b/src/CsharpClient/QuixStreams.State/ScalarState.cs @@ -328,7 +328,9 @@ public void Clear() /// Returns the value public T Value { - get => genericConverter(this.inMemoryValue); + get => this.inMemoryValue == null + ? default + : genericConverter(this.inMemoryValue); set => this.inMemoryValue = stateValueConverter(value); } diff --git a/src/CsharpClient/QuixStreams.Telemetry.UnitTests/Models/Telemetry/CodecRegistryShould.cs b/src/CsharpClient/QuixStreams.Telemetry.UnitTests/Models/Telemetry/CodecRegistryShould.cs index 5efba789..1735a2ba 100644 --- a/src/CsharpClient/QuixStreams.Telemetry.UnitTests/Models/Telemetry/CodecRegistryShould.cs +++ b/src/CsharpClient/QuixStreams.Telemetry.UnitTests/Models/Telemetry/CodecRegistryShould.cs @@ -42,7 +42,7 @@ public void Register_CompactJsonForBetterPerformance_ShouldRegisterAsExpected() var codecs = Transport.Registry.CodecRegistry.RetrieveCodecs(new ModelKey("TimeseriesData")); codecs.Count().Should().Be(3); codecs.Should().Contain(x => x is TimeseriesDataReadableCodec); // for reading - codecs.Should().Contain(x => x is TimeseriesDataJsonCodec); // for reading + codecs.Should().Contain(x => x is DefaultJsonCodec); // for reading codecs.Should().Contain(x => x is TimeseriesDataProtobufCodec); // for reading codecs.First().GetType().Should().Be(typeof(TimeseriesDataReadableCodec)); // for writing } @@ -57,9 +57,9 @@ public void Register_JsonTimeseriesData_ShouldRegisterAsExpected() var codecs = Transport.Registry.CodecRegistry.RetrieveCodecs(new ModelKey("TimeseriesData")); codecs.Count().Should().Be(3); codecs.Should().Contain(x => x is TimeseriesDataReadableCodec); // for reading - codecs.Should().Contain(x => x is TimeseriesDataJsonCodec); // for reading + codecs.Should().Contain(x => x is DefaultJsonCodec); // for reading codecs.Should().Contain(x => x is TimeseriesDataProtobufCodec); // for reading - codecs.First().GetType().Should().Be(typeof(TimeseriesDataJsonCodec)); // for writing + codecs.First().GetType().Should().Be(typeof(DefaultJsonCodec)); // for writing } [Fact]