Пример #1
0
        public void NewSequenct()
        {
            // 首先测试默认的构造函数. 结果应当等价于 001。
            Assert.AreEqual("001", sequence.ToString());

            // 再测试 几种不同的构造函数的方式,能否得出相同的序列号.
            sequence = new MySequence('0', 1);
            Assert.AreEqual("001", sequence.ToString());
        }
Пример #2
0
        static void Main(string[] args)
        {
            MySequence mySeq = new MySequence();

            Console.WriteLine(mySeq.ToString());

            Console.WriteLine("不变模式暂无太多例子可供演示......");

            Console.ReadLine();
        }
Пример #3
0
        public void MinusMinus()
        {
            // Z99-- = Z98
            sequence = new MySequence("Z99");
            sequence--;
            Assert.AreEqual("Z98", sequence.ToString());

            // P00-- = N99 ( 因为字母 O 被排除掉了)
            sequence = new MySequence("P00");
            sequence--;
            Assert.AreEqual("N99", sequence.ToString());

            // 001-- = 000
            sequence = new MySequence("001");
            sequence--;
            Assert.AreEqual("000", sequence.ToString());
        }
Пример #4
0
        public void PlusPlus()
        {
            // 001++ = 002
            sequence++;
            // 001++ 后,结果为 002
            Assert.AreEqual("002", sequence.ToString());

            // 测试 999++ = A00
            sequence = new MySequence("999");
            sequence++;
            Assert.AreEqual("A00", sequence.ToString());

            // 测试 N99++ = P00 ( 因为字母 O 被排除掉了)
            sequence = new MySequence("N99");
            sequence++;
            Assert.AreEqual("P00", sequence.ToString());
        }
Пример #5
0
        public void Plus()
        {
            // 001 + 100 = 101
            sequence = new MySequence("001");
            sequence = sequence + 100;
            Assert.AreEqual("101", sequence.ToString());


            // A01 + 200 = C01
            sequence = new MySequence("A01");
            sequence = sequence + 200;
            Assert.AreEqual("C01", sequence.ToString());


            // N01 + 123 = P24
            sequence = new MySequence("N01");
            sequence = sequence + 123;
            Assert.AreEqual("P24", sequence.ToString());
        }