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(); }
public void PandoraServerTest() { TestServer = new PandorasServer(Path.Combine(Directory.GetCurrentDirectory(), "DBTEST"), "localhost", 20159); Assert.IsTrue(TestServer.Logon("*****@*****.**", "quality", "quality")); TestServer.OnTransactions += NewTransactionTestHandler; var TestUserStatus = (TestServer.GetUserStatus()); Assert.IsTrue(TestUserStatus.Active && TestUserStatus.ExtendedInfo == "Quality Testing User"); CurrencyItem[] Currencies = TestServer.GetCurrencyList(); Assert.IsTrue(Currencies.Count() > 0 && Currencies[0].Name == "Bitcoin"); CurrencyStatusItem Result2 = TestServer.GetCurrencyStatus(1); Assert.IsTrue(Result2.Status == CurrencyStatus.Active && Result2.ExtendedInfo == "The coin is working fine with 3 servers running with consensus."); CurrencyAccount[] Accounts = TestServer.MonitoredAccounts.GetById(1); Assert.AreEqual(Accounts[0].Address, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5"); TestServer.StartTxUpdatingTask(); while (!Records.Any()) { Records = TestServer.GetTransactions(1); System.Threading.Thread.Sleep(1000); } TransactionRecord Record = Records.FirstOrDefault(); Assert.IsTrue(Record.TxId == "30c8e2f7f5cf8b00f8b8bff127a8ceb726e30ab354dda361199fc435c22275b9"); Assert.IsTrue(Record.Block == 1355565); Assert.IsTrue(Record.Outputs.Count() == 2); var Outputs = Record.Outputs.ToList(); Assert.IsTrue(Outputs.Exists(x => x.Address == "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5" && x.Amount == 150000000)); Assert.IsTrue(Outputs.Exists(x => x.Address == "2MwqZdwPUrmBACjacg8uwEZ8rVoCUX7GD2h" && x.Amount == 111418554)); var Transaction = new CurrencyTransaction(); Transaction.AddInput(150000000, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5", 10151); Transaction.AddOutput(100000000, "mtCFoNLWbgHnB1SG7R7VqiDizGUP8K2uae"); Transaction.AddOutput(50000000, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5"); Transaction.TxFee = 250000; Transaction.CurrencyId = 1; //var Response = TestServer.CreateTransaction(1, Transaction); //Assert.IsTrue(Response == "0100000001b97522c235c49f1961a3dd54b30ae326b7cea827f1bfb8f8008bcff5f7e2c830010000001976a91431ca57b301db0088e2d5912cff743210364b126c88acffffffff0200e1f505000000001976a9148b10583ecc2a455ab21342b3b34943ec711e694888ac80f0fa02000000001976a91431ca57b301db0088e2d5912cff743210364b126c88ac00000000"); TestServer.Logoff(); }
public bool Close() { FUserSettings.SaveSettings(); return(FWalletPandoraServer.Logoff()); }