public void AnimalComplexTest25() { var animal = this.Fixture.Get <Animal>() as Animal; CheckAnimalVersion(animal.Id, 1); Animal aniMemmory = GetAnimal(animal.Id); Assert.AreEqual(aniMemmory.AllAccessory.Eye.Description, "AllAccessoryAnimalEye"); // 修改 AnimalEye eye = new AnimalEye(21) { Description = "NewAllAccessoryAnimalEye", CreateDate = new DateTime(2017, 6, 1) }; animal.AllAccessory = new AnimalAccessory("NewAllAccessory", 5, new DateTime(2017, 6, 11), AnimalDoor.Empty, eye); Assert.AreEqual(true, animal.AllAccessory.IsDirty); Assert.AreEqual(true, animal.IsDirty); UpdateAnimal(animal); aniMemmory = GetAnimal(animal.Id); Assert.AreEqual("NewAllAccessoryAnimalEye", aniMemmory.AllAccessory.Eye.Description); CheckAnimalVersion(animal.Id, 2); }
public void AnimalComplexTest29() { var animal = this.Fixture.Get <Animal>() as Animal; CheckAnimalVersion(animal.Id, 1); Animal aniMemmory = GetAnimal(animal.Id); Assert.AreEqual(aniMemmory.AllBreak.Eye.Description, "AllAnimalBreakAnimalEye"); // 修改 AnimalEye eye = new AnimalEye(31) { Description = "NewAllAnimalBreakAnimalEye", CreateDate = new DateTime(2017, 6, 1) }; animal.AllBreak.Eye = eye; Assert.AreEqual(true, animal.AllBreak.IsDirty); Assert.AreEqual(true, animal.IsDirty); UpdateAnimal(animal); aniMemmory = GetAnimal(animal.Id); Assert.AreEqual("NewAllAnimalBreakAnimalEye", aniMemmory.AllBreak.Eye.Description); CheckAnimalVersion(animal.Id, 2); CheckAnimalBreakVersion(aniMemmory.AllBreak.Id, 2); CheckAnimalEyeVersion(aniMemmory.AllBreak.Eye.Id, 1); }
public AnimalAccessory(string name, short accessoryNum, Emptyable <DateTime> setupDate, AnimalDoor door, AnimalEye eye) { this.Name = name; this.AccessoryNum = accessoryNum; this.SetupDate = setupDate; this.Door = door; this.Eye = eye; this.OnConstructed(); }
private Animal CreateAnimal() { AnimalCategory category = InsertAnimalCategory(1, "爬行类", new DateTime(2017, 6, 1)); Animal animal = new Animal(Guid.NewGuid()); animal.Category = category; animal.Name = "一只动物"; animal.LiveTime = new DateTime(2017, 6, 1); AnimalEye eye1 = new AnimalEye(1) { Description = "AllWheelDoorEye", CreateDate = new DateTime(2017, 6, 1) }; AnimalWheel allWheel = new AnimalWheel(40) { OrderIndex = 1, Description = "the allWheel", TheColor = new AnimalColor("主色", 5, true, AnimalCategory.Empty, AnimalAccessory.Empty), Category = InsertAnimalCategory(90, "main Wheel动物类", new DateTime(2017, 6, 1)), Accessory = new AnimalAccessory("allWheel配饰", 5, new DateTime(2017, 6, 11), AnimalDoor.Empty, AnimalEye.Empty), Door = new AnimalDoor(2) { Name = "AllWheelDoor" }, Eye = eye1 }; animal.AllWheel = allWheel; AnimalCategory category0 = InsertAnimalCategory(10, "AllColor动物类", new DateTime(2017, 6, 1)); AnimalDoor door = new AnimalDoor(3) { Name = "AllColor配饰Door" }; animal.AllColor = new AnimalColor("颜色", 8, true, category0, new AnimalAccessory("AllColor配饰", 10, new DateTime(2017, 6, 10), door, AnimalEye.Empty)); AnimalDoor door2 = new AnimalDoor(4) { Name = "AllAccessoryDoor" }; AnimalEye eye2 = new AnimalEye(2) { Description = "AllAccessoryAnimalEye", CreateDate = new DateTime(2017, 6, 1) }; animal.AllAccessory = new AnimalAccessory("AllAccessory", 8, new DateTime(2017, 6, 10), door2, eye2); List <AnimalColor> colors = new List <AnimalColor>(); AnimalCategory category1 = InsertAnimalCategory(11, "红色动物类", new DateTime(2017, 6, 1)); AnimalCategory category2 = InsertAnimalCategory(12, "蓝色动物类", new DateTime(2017, 6, 1)); colors.Add(new AnimalColor("红色", 6, true, category1, AnimalAccessory.Empty)); colors.Add(new AnimalColor("蓝色", 7, true, category2, AnimalAccessory.Empty)); animal.SetMyColors(colors); AnimalWheel mainWheel = new AnimalWheel(30) { OrderIndex = 1, Description = "the main Wheel", TheColor = new AnimalColor("主色", 5, true, AnimalCategory.Empty, AnimalAccessory.Empty), Category = InsertAnimalCategory(20, "main Wheel动物类", new DateTime(2017, 6, 1)), Accessory = new AnimalAccessory("MainWheel配饰", 5, new DateTime(2017, 6, 11), AnimalDoor.Empty, AnimalEye.Empty), Door = new AnimalDoor(5) { Name = "MainWheelDoor" } }; animal.SetMainWheel(mainWheel); AnimalWheel wheel1 = new AnimalWheel(2) { OrderIndex = 11, Description = "theAnimalWheel1", TheColor = new AnimalColor("红色", 6, true, AnimalCategory.Empty, AnimalAccessory.Empty) }; AnimalWheel wheel2 = new AnimalWheel(3) { OrderIndex = 12, Description = "theAnimalWheel2", TheColor = new AnimalColor("蓝色", 7, true, AnimalCategory.Empty, AnimalAccessory.Empty) }; List <AnimalWheel> wheels = new List <AnimalWheel>(); wheels.Add(wheel1); wheels.Add(wheel2); animal.SetWheels(wheels); AnimalBreak mainBreak = new AnimalBreak(1) { Description = "MyAnimalBreak", CreateDate = new DateTime(2017, 6, 1), Category = InsertAnimalCategory(30, "MyAnimalBreak动物类", new DateTime(2017, 6, 30)), Accessory = new AnimalAccessory("MyAnimalBreak配饰", 6, new DateTime(2017, 6, 16), AnimalDoor.Empty, AnimalEye.Empty) }; animal.SetMainBreak(mainBreak); AnimalEye eye3 = new AnimalEye(3) { Description = "AllAnimalBreakAnimalEye", CreateDate = new DateTime(2017, 6, 1) }; AnimalBreak allBreak = new AnimalBreak(50) { Description = "AllAnimalBreak", CreateDate = new DateTime(2017, 6, 1), Category = InsertAnimalCategory(40, "AllAnimalBreak动物类", new DateTime(2017, 6, 30)), Door = new AnimalDoor(6) { Name = "AllAnimalBreakDoor" }, Eye = eye3 }; animal.AllBreak = allBreak; return(animal); }