public void CarBrandDoorTest3() { CarBrand brand = CreateCarBrand(100); BrandDoor door = new BrandDoor(1) { Name = "BrandDoor", OrderIndex = 10 }; brand.OneDoor = door; brand.OtherDoor = door; AddCarBrand(brand); CheckDoorAssociatedCount(door.Id, 2); brand.OneDoor = BrandDoor.Empty; UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 1); CheckExist(door.Id, true); brand.OtherDoor = BrandDoor.Empty; UpdateCarBrand(brand); CheckExist(door.Id, false); }
public WholeColor(string name, int colorNum, bool isPainted, CarBrand brand = null, CarAccessory accessory = null) { this.Name = name; this.ColorNum = colorNum; this.IsPainted = isPainted; if (brand == null) { this.Brand = CarBrand.Empty; } else { this.Brand = brand; } if (accessory == null) { this.Accessory = CarAccessory.Empty; } else { this.Accessory = accessory; } this.OnConstructed(); }
public void CarBrandDoorTest11() { CarBrand brand = CreateCarBrand(100); BrandDoor door = new BrandDoor(1) { Name = "BrandDoor", OrderIndex = 10 }; brand.AddMyDoor(door); brand.AddOtherDoor(door); AddCarBrand(brand); CheckDoorAssociatedCount(door.Id, 2); brand.AddOtherDoor(door); UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 3); brand.RemoveOtherDoor(door); UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 2); CheckExist(door.Id, true); }
public void CarBrandDoorTest13() { CarBrand brand = CreateCarBrand(100); BrandDoor door = new BrandDoor(1) { Name = "BrandDoor", OrderIndex = 10 }; brand.OneDoor = door; AddCarBrand(brand); CheckDoorAssociatedCount(door.Id, 1); brand.AddOtherDoor(door); UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 2); brand.AddMyDoor(door); UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 3); brand.OtherDoor = door; UpdateCarBrand(brand); CheckDoorAssociatedCount(door.Id, 4); }
public void CarBrandTest13() { CarBrand brand = CreateCarBrand(100); BrandAccessory acc = new BrandAccessory("CarBrand配饰", 10, new DateTime(2017, 6, 1)); brand.BrandAccessory = acc; AddCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 1); brand.AddYouAccessory(acc); UpdateCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 2); brand.AddMyAccessory(acc); UpdateCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 3); brand.OtherAccessory = acc; UpdateCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 4); }
private CarBrand CreateCarBrand(int id) { CarBrand brand = new CarBrand(id); brand.Name = "著名品牌"; brand.CreateDate = new DateTime(2016, 5, 1); return(brand); }
private void UpdateCarBrand(CarBrand brand) { this.BeginTransaction(); var repository = Repository.Create <ICarBrandRepository>(); repository.Update(brand); this.Commit(); }
public void CarBrandTest1() { CarBrand brand = CreateCarBrand(100); BrandAccessory acc = new BrandAccessory("CarBrand配饰", 10, new DateTime(2017, 6, 1)); brand.BrandAccessory = acc; AddCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 1); brand.BrandAccessory = BrandAccessory.Empty; UpdateCarBrand(brand); CheckExist(acc.Id, false); }
public void CarBrandTest6() { CarBrand brand = CreateCarBrand(100); BrandAccessory acc = new BrandAccessory("CarBrand配饰", 10, new DateTime(2017, 6, 1)); brand.AddMyAccessory(acc); AddCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 1); brand.RemoveMyAccessory(acc); UpdateCarBrand(brand); CheckExist(acc.Id, false); }
public void CarBrandTest15() { BrandAccessory acc = new BrandAccessory("CarBrand1配饰", 10, new DateTime(2017, 6, 1)); CarBrand brand1 = CreateCarBrand(100); brand1.BrandAccessory = acc; AddCarBrand(brand1); CheckAccessoryAssociatedCount(acc.Id, 1); CarBrand brand2 = CreateCarBrand(101); brand2.BrandAccessory = acc; AddCarBrand(brand2); //CheckAccessoryAssociatedCount(acc.Id, 2); }
public void CarBrandTest5() { CarBrand brand = CreateCarBrand(100); BrandAccessory acc = new BrandAccessory("CarBrand配饰", 10, new DateTime(2017, 6, 1)); brand.BrandAccessory = acc; AddCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 1); brand.OtherAccessory = acc; UpdateCarBrand(brand); CheckAccessoryAssociatedCount(acc.Id, 2); CheckExist(acc.Id, true); }