Exemplo n.º 1
0
        public void FetchingDataTests()
        {
            PandorasServer TestServer = new PandorasServer(Path.Combine(Directory.GetCurrentDirectory(), "DBTEST"), "localhost", 20159);

            Assert.IsTrue(TestServer.Logon("*****@*****.**", "Dj", "test"));

            List <CurrencyItem> TestCurrencies = TestServer.FetchCurrencies();

            Assert.IsTrue(TestCurrencies[1].Name == "Litecoin");

            List <CurrencyStatusItem> TestStatus = TestServer.FetchCurrencyStatus(2);

            Assert.IsTrue(TestStatus[0].ExtendedInfo == "The coin is working fine with 3 servers running with consensus.");

            List <CurrencyStatusItem> TestStatus2 = TestServer.FetchCurrencyStatus(2);

            Assert.IsTrue(TestStatus2[0].ExtendedInfo == "The servers are under maintaince and should be back up soon.");

            List <CurrencyStatusItem> TestStatus3 = TestServer.FetchCurrencyStatus(3);

            Assert.IsTrue(TestStatus3[0].ExtendedInfo == "Coin may not come back up.");

            CurrencyTransaction TestCurr = new CurrencyTransaction();

            TestCurr.AddInput(10000000000, "zBvBMSEYstWetqTFn5Au4m4GFgaxJaNVN3");
            TestCurr.AddOutput(10000000000, "zJvBMSEYstWetqTFn5Au4m4GFgaxJaNVN3");
            TestCurr.AddInput(10000000000, "zBvBMSEYstWetqTFn5Au4m4GFgaxJaNVN3");
            TestCurr.AddOutput(10000000000, "zJvBMSEYstWetqTFn5Au4m4GFgaxJaNVN3");

            TestCurr.TxFee = 100;

            string jsonstring = JsonConvert.SerializeObject(TestCurr);
            PandoraJsonConverter lJsonConverter = new PandoraJsonConverter();
            var Response = Newtonsoft.Json.JsonConvert.DeserializeObject <CurrencyTransaction>(jsonstring, lJsonConverter);

            Assert.IsTrue(Response.TxFee == 100 && Response.Outputs[1].Address == "zJvBMSEYstWetqTFn5Au4m4GFgaxJaNVN3");
            TestServer.Logoff();
        }