示例#1
0
        public void PopReceipt_ToStringTests()
        {
            PopReceipt pr1 = new PopReceipt(sEmptyPopReceipt);
            PopReceipt pr2 = new PopReceipt(sTestPopReceipt1);

            Assert.AreEqual(sTestPopReceipt1, pr2.ToString(null));
            Assert.AreEqual(sTestPopReceipt1, pr2.ToString(null, null));
            Assert.AreEqual(sTestPopReceipt1.ToUpperInvariant(), pr2.ToString("G"));

            Console.WriteLine(pr2.ToString());
            Console.WriteLine(pr2.ToString("G"));
        }
示例#2
0
        public void PopReceipt_NewPopReceiptTests()
        {
            const string spr1 = "0000000000000000000000000000000000000000000000000000000000000000";
            const string spr2 = "00000000000000fe000000000000000000000000000000000000000000000000";
            const string spr3 = "7fffffffffffffff000000000000000000000000000000000000000000000000";

            PopReceipt pr = PopReceipt.NewPopReceipt(0);

            Assert.AreEqual(0, pr.Partition);
            Assert.AreNotEqual(spr1, pr.ToString());
            Console.WriteLine(pr);

            pr = PopReceipt.NewPopReceipt(254);
            Assert.AreEqual(254, pr.Partition);
            Assert.AreNotEqual(spr2, pr.ToString());
            Console.WriteLine(pr);

            pr = PopReceipt.NewPopReceipt(long.MaxValue);
            Assert.AreEqual(long.MaxValue, pr.Partition);
            Assert.AreNotEqual(spr3, pr.ToString());
            Console.WriteLine(pr);
        }
示例#3
0
        public void PopReceipt_ConstructorTests()
        {
            // Create default PopReceipt and ensure it is the empty one.
            PopReceipt pr0 = new PopReceipt();

            Assert.AreEqual(PopReceipt.Empty, pr0);
            Assert.AreEqual(sEmptyPopReceipt, pr0.ToString());

            // Create a PopReceipt based on a string and round trip it to ensure they are the same.
            PopReceipt testPR2 = new PopReceipt(sTestPopReceipt1);
            string     sPR2    = testPR2.ToString("g");

            Assert.AreEqual(sTestPopReceipt1, sPR2);

            // Convert into a byte array.
            byte[]     bPR2 = testPR2.ToByteArray();
            PopReceipt pr1  = new PopReceipt(bPR2);

            Assert.AreEqual(testPR2, pr1);
            Assert.AreEqual(sTestPopReceipt1, pr1.ToString());
        }
示例#4
0
        public void PopReceipt_ToStringException()
        {
            PopReceipt pr = new PopReceipt(sTestPopReceipt1);

            pr.ToString("u");
        }