示例#1
0
        public void balanceAccessorModifierTest()
        {
            Trader t = new Trader();
            t.setBalance(1050);
            Assert.AreEqual(t.getBalance(), 1050);

        }
示例#2
0
        public void constructorTest()
        {          
            Trader t2 = new Trader("Player2", 1500);

            Assert.AreEqual(t2.getName(), "Player2");
            Assert.AreEqual(t2.getBalance(), 1500);
        }
示例#3
0
 public void nameAccessorModifierTest()
 {
     Trader t = new Trader();
     t.setName("Banker");
     Assert.AreEqual(t.getName(), "Banker");
   
 }
示例#4
0
        public void payTest()
        {
            Trader t = new Trader("Player1", 1500);

            t.pay(111);

            Assert.AreEqual(t.getBalance(), 1500 - 111);
        }
示例#5
0
        public void receiveTest()
        {
            Trader t = new Trader("Player1", 1500);

            t.receive(55);

            Assert.AreEqual(t.getBalance(), 1555);
        }
示例#6
0
        public void checkBankruptZero()
        {
            Trader t = new Trader("Player1", 0);

            try
            {
                t.checkBankrupt();//exception should be thrown so should not run follwing line
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Console.Write("Exception Thrown: " + ex.Message);
            }
        }
示例#7
0
        public void checkBankrupt()
        {
            Trader t = new Trader("Player1", 1500);

            try
            {
                t.checkBankrupt();//nothing should happen (no exception thrown)
                
            }
            catch (Exception ex)
            {
                Console.Write("Exception Thrown: " + ex.Message);
                Assert.Fail();
            }

        }
示例#8
0
 public Property(string sName, ref Trader owner)
 {
     this.sName = sName;
     this.owner = owner;
 }
示例#9
0
 public Property(string sName)
 {
     this.sName = sName;
     this.owner = Banker.access();
 }
示例#10
0
        public void outputToString()
        {
            Trader t = new Trader();

            Console.Write(t);
        }
示例#11
0
 public Property(string sName, ref Trader owner)
 {
     this.sName = sName;
     this.owner = owner;
 }
示例#12
0
        public void propetyTest()
        {
            Trader t = new Trader();
            Property p = new Property("Queen Street");
            t.obtainProperty(ref p);
            Assert.Contains(p, t.getPropertiesOwned());

        }
示例#13
0
        public void outputToString()
        {
            Trader t = new Trader();

            Console.Write(t);
        }
示例#14
0
 public void setOwner(ref Player newOwner)
 {
     this.owner = newOwner;
 }
示例#15
0
 public void setOwner(ref Banker newOwner)
 {
     this.owner = newOwner;
 }
示例#16
0
 public void setOwner(ref Banker newOwner)
 {
     this.owner = newOwner;
 }
示例#17
0
 public void setOwner(ref Player newOwner)
 {
     this.owner = newOwner;
 }
示例#18
0
 public Property(string sName)
 {
     this.sName = sName;
     this.owner = Banker.access();
 }