public void toJson_0_2() { var env = new Env(); Context context; using (TestWallet testWallet = new TestWallet(env.walletName, env.walletKey)) { try { JsonObject config = new JsonObject(); config.Add("walletName", env.walletName); config.Add("walletKey", env.walletKey); config.Add("verityUrl", env.verityUrl); config.Add("verityPublicDID", testWallet.getVerityPublicDID()); config.Add("verityPublicVerKey", testWallet.getVerityPublicVerkey()); config.Add("domainDID", testWallet.getVerityPairwiseDID()); config.Add("verityAgentVerKey", testWallet.getVerityPairwiseVerkey()); config.Add("sdkVerKeyId", testWallet.getSdkPairwiseVerkey()); config.Add("sdkVerKey", testWallet.getSdkPairwiseVerkey()); config.Add("endpointUrl", env.endpointUrl); config.Add("version", "0.2"); context = ContextBuilder.fromJson(config).build(); TestHelpers.assertEqualsJSONObject(withNewKeys(config), context.toJson()); context.CloseWallet(); } catch (Exception e) { Assert.Fail(e.Message); } } }
public void shouldCorrectlyParseConfig_0_2() { var env = new Env(); Context context; using (TestWallet testWallet = new TestWallet(env.walletName, env.walletKey)) { try { JsonObject config = new JsonObject(); config.Add("walletName", env.walletName); config.Add("walletKey", env.walletKey); config.Add("endpointUrl", env.endpointUrl); config.Add("verityUrl", env.verityUrl); config.Add("verityPublicDID", testWallet.getVerityPublicDID()); config.Add("verityPublicVerKey", testWallet.getVerityPublicVerkey()); config.Add("domainDID", testWallet.getVerityPairwiseDID()); config.Add("verityAgentVerKey", testWallet.getVerityPairwiseVerkey()); config.Add("sdkVerKeyId", testWallet.getSdkPairwiseVerkey()); config.Add("sdkVerKey", testWallet.getSdkPairwiseVerkey()); config.Add("version", ContextConstants.V_0_2); context = ContextBuilder.fromJson(config).build(); var cfg_s = "{\"id\":\"" + env.walletName + "\"}"; var cfg = context.WalletConfig().config().Replace(" ", ""); Assert.AreEqual(cfg_s, cfg); var cr_s = "{\"key\":\"" + env.walletKey + "\"}"; var cr = context.WalletConfig().credential().Replace(" ", ""); Assert.AreEqual(cr_s, cr); Assert.AreEqual(env.verityUrl, context.VerityUrl()); Assert.AreEqual(env.endpointUrl, context.EndpointUrl()); Assert.AreEqual(ContextConstants.V_0_2, context.Version()); Assert.AreEqual(testWallet.getVerityPublicVerkey(), context.VerityPublicVerKey()); Assert.AreEqual(testWallet.getVerityPairwiseVerkey(), context.VerityAgentVerKey()); Assert.AreEqual(testWallet.getVerityPairwiseDID(), context.DomainDID()); Assert.AreEqual(testWallet.getSdkPairwiseVerkey(), context.SdkVerKey()); Assert.IsNotNull(context.WalletHandle()); context.CloseWallet(); } catch (Exception e) { Assert.Fail(e.Message); } } }