Esempio n. 1
0
        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();
        }
 private void FWalletPandoraServer_OnCurrencyStatusFullListExpired()
 {
     FWalletPandoraServer.GetCurrencyStatus(true);
 }