fix the serialization names (#299)
This commit is contained in:
Родитель
5180c1b20a
Коммит
74f6ffbf4e
|
@ -21,6 +21,16 @@ namespace ElectionGuard.Encrypt.Tests
|
|||
Assert.True(deviceCreatedFromJson.ToJson().Contains("Brazil"));
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Test_Device_Serialization_From_JSON_Succeeds()
|
||||
{
|
||||
string deviceJson = "{ \"device_id\": 91755434160, \"session_id\": 12345, \"launch_code\": 45678, \"location\": \"polling-place\" }";
|
||||
var device = new EncryptionDevice(deviceJson);
|
||||
|
||||
var json = device.ToJson();
|
||||
|
||||
Assert.True(json.Contains("polling-place"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_Encrypt_Ballot_Simple_Succeeds()
|
||||
|
|
|
@ -937,9 +937,9 @@ namespace electionguard
|
|||
{
|
||||
|
||||
json j = {
|
||||
{"deviceUuid", serializable.getDeviceUuid()},
|
||||
{"sessionUuid", serializable.getSessionUuid()},
|
||||
{"launchCode", serializable.getLaunchCode()},
|
||||
{"device_id", serializable.getDeviceUuid()},
|
||||
{"session_id", serializable.getSessionUuid()},
|
||||
{"launch_code", serializable.getLaunchCode()},
|
||||
{"location", serializable.getLocation()},
|
||||
};
|
||||
|
||||
|
@ -948,9 +948,9 @@ namespace electionguard
|
|||
|
||||
static unique_ptr<electionguard::EncryptionDevice> toObject(json j)
|
||||
{
|
||||
auto deviceUuid = j["deviceUuid"].get<uint64_t>();
|
||||
auto sessionUuid = j["sessionUuid"].get<uint64_t>();
|
||||
auto launchCode = j["launchCode"].get<uint64_t>();
|
||||
auto deviceUuid = j["device_id"].get<uint64_t>();
|
||||
auto sessionUuid = j["session_id"].get<uint64_t>();
|
||||
auto launchCode = j["launch_code"].get<uint64_t>();
|
||||
auto location = j["location"].get<string>();
|
||||
|
||||
return make_unique<electionguard::EncryptionDevice>(deviceUuid, sessionUuid,
|
||||
|
|
Загрузка…
Ссылка в новой задаче