Exemplo n.º 1
0
        public void ShouldConvertBackAndForth()
        {
            string str  = RandomString(1000);
            string back = TrytesConverter.TrytesToAscii(TrytesConverter.AsciiToTrytes(str));

            Assert.AreEqual(str, back);
        }
Exemplo n.º 2
0
        public void PublishPublicTest()
        {
            var iota = new IotaAPI
            {
                IotaClient = new IotaClient(Provider)
            };
            var mam = new Mam(iota);
            string seed = "CNHIRWBWVPDBGHKYZDJEZVIRDBSEDTCRBESFXOGRSWWDQVRNQATQUKIVDUDINJKKNCULQFCWWIG9LAEHQ";

            // ReSharper disable once RedundantArgumentDefaultValue
            var mamState = mam.InitMamState(seed, 2);
            
            // Create MAM Payload
            var mamMessage = mam.CreateMamMessage(mamState, TrytesConverter.AsciiToTrytes("POTATO"));

            Console.WriteLine($"Root: {mamMessage.Root}");
            Console.WriteLine($"Address: {mamMessage.Address}");

            // Attach the payload
            mam.Attach(mamMessage.Payload, mamMessage.Address);

            // Fetch Stream Async to Test
            var result = mam.Fetch(mamMessage.Root, MamMode.Public);

            Console.WriteLine("Fetch result:");
            foreach (var message in result.Item1)
            {
                Console.WriteLine(message);
            }

            Console.WriteLine($"NextRoot:{result.Item2}");

        }
Exemplo n.º 3
0
 public void ShouldConvertStringToTrytes()
 {
     Assert.AreEqual(TrytesConverter.AsciiToTrytes("Z"), "IC");
     Assert.AreEqual(TrytesConverter.AsciiToTrytes("IOTA SHARP"), "SBYBCCKBEABCRBKBACZB");
 }