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; }
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(); }
public void TestPriceMajorToCash() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(false, source.BuyCar(150000)); }
public void TestGetFullName() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual("PEDRO MIGUEL", source.FullName); }
public void TestGetAge() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(20, source.Age); }
public void Testdontbyacar() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(false, source.BuyCar(-150000)); }
public void TestCreateDefaultPersonIsNotNull() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.IsNotNull(source); }
public void TestCashBalance() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(100000, source.CashBalance); }
public void TestBuyaCarWithSamePriceThatCash() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(true, source.BuyCar(100000)); }
public void TestBuyaCarWithPricePositive() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(true, source.BuyCar(5000)); }
public void TestBuyaCarWithPriceNegative() { Person source = new Person("PEDRO", "MIGUEL", 20); Assert.AreEqual(false, source.BuyCar(-100)); }