コード例 #1
0
ファイル: XmlPersistenceTest.cs プロジェクト: haleox/mortar
        public void Rollback()
        {
            xmlFileFullPath = "d:/test.xml"; //ToDo:use appropriate filepath

            if (File.Exists(xmlFileFullPath))
            {
                File.Delete(xmlFileFullPath);
            }

            marie = new Person();
            marie.Name = "Marie";
            marie.Age = 63;
            marie.Alive = true;
            marie.Income = 33500.45d;
            marie.Cash = 75.3f;
            marie.Gender = Gener.Female;

            hans = new Person();
            hans.Name = "Hans";
            hans.Age = 33;
            hans.Alive = true;
            hans.Income = 50000.45d;
            hans.Cash = 25.3f;
            hans.Gender = Gener.Male;
            hans.Mother = marie;
        }
コード例 #2
0
 public void Test()
 {
     int count = 1000;
     for (var i = 0; i < count; i++)
     {
         persons.Enqueue(new Person() {Age = i, Name = "Name" + i});
     }
     var p=new Person();
     while (!persons.IsEmpty)
     {
         if (persons.TryDequeue(out p))
             Console.WriteLine("年龄:{0},姓名:{1}", p.Age,p.Name);
     }
     Console.ReadKey();
 }
コード例 #3
0
 public void TestPriceMajorToCash()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(false, source.BuyCar(150000));
 }
コード例 #4
0
 public void TestGetFullName()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual("PEDRO MIGUEL", source.FullName);
 }
コード例 #5
0
 public void TestGetAge()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(20, source.Age);
 }
コード例 #6
0
 public void Testdontbyacar()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(false, source.BuyCar(-150000));
 }
コード例 #7
0
 public void TestCreateDefaultPersonIsNotNull()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.IsNotNull(source);
 }
コード例 #8
0
 public void TestCashBalance()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(100000, source.CashBalance);
 }
コード例 #9
0
 public void TestBuyaCarWithSamePriceThatCash()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(true, source.BuyCar(100000));
 }
コード例 #10
0
 public void TestBuyaCarWithPricePositive()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(true, source.BuyCar(5000));
 }
コード例 #11
0
 public void TestBuyaCarWithPriceNegative()
 {
     Person source = new Person("PEDRO", "MIGUEL", 20);
     Assert.AreEqual(false, source.BuyCar(-100));
 }