Skip to content

Commit d92a866

Browse files
Fixed party name serialization (#309)
Added unit test to verify serialization
1 parent 62d1d03 commit d92a866

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestManifest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ public void Test_Can_Create_Manifest_With_Name()
148148
new InternationalizedText(new[] { language }),
149149
new ContactInformation("na"));
150150

151-
Assert.That(result.IsValid());
151+
var json = result.ToJson();
152+
153+
Assert.IsTrue(result.IsValid());
154+
Assert.IsFalse(json.Contains("\"name\":{\"text\":null")); // check to make sure the party name serialized correctly
152155
}
153156

154157
}

bindings/netstandard/ElectionGuard/ElectionGuard.Encryption/ElectionGuard.Encryption.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
<!-- Project -->
88
<RootNamespace>ElectionGuard</RootNamespace>
99
<AssemblyName>ElectionGuard.Encryption</AssemblyName>
10-
<Version>0.1.14</Version>
11-
<AssemblyVersion>0.1.14.0</AssemblyVersion>
12-
<AssemblyFileVersion>0.1.14.0</AssemblyFileVersion>
10+
<Version>0.1.15</Version>
11+
<AssemblyVersion>0.1.15.0</AssemblyVersion>
12+
<AssemblyFileVersion>0.1.15.0</AssemblyFileVersion>
1313
</PropertyGroup>
1414

1515
<PropertyGroup>
@@ -19,7 +19,7 @@
1919
<Title>ElectionGuard Encryption</Title>
2020
<Description>Open source implementation of ElectionGuard's ballot encryption.</Description>
2121
<Authors>Microsoft</Authors>
22-
<PackageVersion>0.1.14</PackageVersion>
22+
<PackageVersion>0.1.15</PackageVersion>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2424
<PackageProjectUrl>https://github.com/microsoft/electionguard-cpp</PackageProjectUrl>
2525
<RepositoryUrl>https://github.com/microsoft/electionguard-cpp</RepositoryUrl>

src/electionguard/serialize.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace electionguard
5959

6060
static json internationalizedTextToJson(const InternationalizedText &serializable)
6161
{
62-
json serialized;
62+
json serialized = json::array();
6363
for (const auto &element : serializable.getText()) {
6464
serialized.push_back(languageToJson(element.get()));
6565
}

0 commit comments

Comments
 (0)