// "fromWallet()" returns a well-formed "CommercioDoc" object.
        public async Task WellFormedCommercioDocFromWallet()
        {
            //This is the comparison class
            CompareLogic compareLogic = new CompareLogic();

            NetworkInfo   networkInfo    = new NetworkInfo(bech32Hrp: "did:com:", lcdUrl: "http://localhost:1317");
            String        mnemonicString = "gorilla soldier device force cupboard transfer lake series cement another bachelor fatigue royal lens juice game sentence right invite trade perfect town heavy what";
            List <String> mnemonic       = new List <String>(mnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));
            Wallet        wallet         = Wallet.derive(mnemonic, networkInfo);

            String        senderDid     = wallet.bech32Address;
            List <String> recipientDids = new List <String>()
            {
                "recipient1", "recipient2"
            };
            String uuid = System.Guid.NewGuid().ToString();
            CommercioDocMetadata metadata = new CommercioDocMetadata(
                contentUri: "https://example.com/document/metadata",
                schema: new CommercioDocMetadataSchema(
                    uri: "https://example.com/custom/metadata/schema",
                    version: "7.0.0'"
                    )
                );

            CommercioDoc expectedCommercioDoc = new CommercioDoc(
                senderDid: senderDid,
                recipientDids: recipientDids,
                uuid: uuid,
                metadata: metadata
                );


            CommercioDoc commercioDoc = await CommercioDocHelper.fromWallet(
                wallet : wallet,
                recipients : recipientDids,
                id : uuid,
                metadata : metadata
                );

            Assert.AreEqual(compareLogic.Compare(commercioDoc.toJson(), expectedCommercioDoc.toJson()).AreEqual, true);

            //Per visualizzare json della classe
            var dataString = JsonConvert.SerializeObject(commercioDoc);
        }
Beispiel #2
0
        // "fromWallet()" returns a well-formed "CommercioDoc" object.
        public async Task WellFormedCommercioDocFromWallet()
        {
            //This is the comparison class
            CompareLogic compareLogic = new CompareLogic();

            NetworkInfo   networkInfo    = new NetworkInfo(bech32Hrp: "did:com:", lcdUrl: "");
            String        mnemonicString = "dash ordinary anxiety zone slot rail flavor tortoise guilt divert pet sound ostrich increase resist short ship lift town ice split payment round apology";
            List <String> mnemonic       = new List <String>(mnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));
            Wallet        wallet         = Wallet.derive(mnemonic, networkInfo);

            String        senderDid     = wallet.bech32Address;
            List <String> recipientDids = new List <String>()
            {
                "recipient1", "recipient2"
            };
            String uuid = System.Guid.NewGuid().ToString();
            CommercioDocMetadata metadata = new CommercioDocMetadata(
                contentUri: "https://example.com/document/metadata",
                schema: new CommercioDocMetadataSchema(
                    uri: "https://example.com/custom/metadata/schema",
                    version: "7.0.0'"
                    )
                );

            CommercioDoc expectedCommercioDoc = new CommercioDoc(
                senderDid: senderDid,
                recipientDids: recipientDids,
                uuid: uuid,
                metadata: metadata
                );


            CommercioDoc commercioDoc = await CommercioDocHelper.fromWallet(
                wallet : wallet,
                recipients : recipientDids,
                id : uuid,
                metadata : metadata
                );

            Assert.AreEqual(compareLogic.Compare(commercioDoc.toJson(), expectedCommercioDoc.toJson()).AreEqual, true);
        }