From 6b49f110d22d140e72182d854f77b05161cca233 Mon Sep 17 00:00:00 2001 From: Cheick Keita Date: Tue, 5 Apr 2022 18:01:32 -0700 Subject: [PATCH] re enable Nullable on the test project --- src/ApiService/Tests/OrmTest.cs | 11 ++++++----- src/ApiService/Tests/Tests.csproj | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ApiService/Tests/OrmTest.cs b/src/ApiService/Tests/OrmTest.cs index 4a24bb9624..a00632ad46 100644 --- a/src/ApiService/Tests/OrmTest.cs +++ b/src/ApiService/Tests/OrmTest.cs @@ -13,7 +13,7 @@ public class OrmTest class TestObject { - public String TheName { get; set; } + public String? TheName { get; set; } public TestEnum TheEnum { get; set; } public TestFlagEnum TheFlag { get; set; } } @@ -72,14 +72,15 @@ public void TestConvertToTableEntity() Assert.Equal("flag_one,flag_two", tableEntity.GetString("the_flag")); Assert.Equal("renamed", tableEntity.GetString("a__special__name")); - var json = JsonNode.Parse(tableEntity.GetString("the_object"))?.AsObject(); + var json = JsonNode.Parse(tableEntity.GetString("the_object"))?.AsObject() ?? throw new InvalidOperationException("Could not parse objec"); + json.TryGetPropertyValue("the_name", out var theName); json.TryGetPropertyValue("the_enum", out var theEnum); json.TryGetPropertyValue("the_flag", out var theFlag); - Assert.Equal(entity1.TheObject.TheName, theName.GetValue()); - Assert.Equal("the_two", theEnum.GetValue()); - Assert.Equal("flag_one,flag_two", theFlag.GetValue()); + Assert.Equal(entity1.TheObject.TheName, theName?.GetValue()); + Assert.Equal("the_two", theEnum?.GetValue()); + Assert.Equal("flag_one,flag_two", theFlag?.GetValue()); } diff --git a/src/ApiService/Tests/Tests.csproj b/src/ApiService/Tests/Tests.csproj index 1df22b2a54..18726c808c 100644 --- a/src/ApiService/Tests/Tests.csproj +++ b/src/ApiService/Tests/Tests.csproj @@ -2,6 +2,7 @@ net6.0 + enable false