Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

re enable Nullable on the test project #1753

Merged
merged 1 commit into from
Apr 6, 2022
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
11 changes: 6 additions & 5 deletions src/ApiService/Tests/OrmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Expand Down Expand Up @@ -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<string>());
Assert.Equal("the_two", theEnum.GetValue<string>());
Assert.Equal("flag_one,flag_two", theFlag.GetValue<string>());
Assert.Equal(entity1.TheObject.TheName, theName?.GetValue<string>());
Assert.Equal("the_two", theEnum?.GetValue<string>());
Assert.Equal("flag_one,flag_two", theFlag?.GetValue<string>());

}

Expand Down
1 change: 1 addition & 0 deletions src/ApiService/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down