Exemplo n.º 1
0
        public void AnimalExtensionTest20()
        {
            var animal = this.Fixture.Get <Animal>() as Animal;

            CheckAnimalVersion(animal.Id, 1);

            Animal animalMemmory = GetAnimal(animal.Id);

            Assert.AreEqual(animalMemmory.GetWheels().Count, 2);

            // 修改
            AnimalWheel wheel3 = new AnimalWheel(4)
            {
                OrderIndex  = 13,
                Description = "theAnimalWheel3",
                TheColor    = new AnimalColor("绿色", 8, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            animal.GetWheels().Add(wheel3);
            UpdateAnimal(animal);

            animalMemmory = GetAnimal(animal.Id);

            Assert.AreEqual(animalMemmory.GetWheels().Count, 3);

            var animalNew = FindAnimal(animal.Id);

            CheckAnimalVersion(animal.Id, 2);
        }
Exemplo n.º 2
0
        public void AnimalInherited2Test14()
        {
            var goldenDog = this.Fixture.Get <GoldenDog>() as GoldenDog;

            CheckGoldenDogVersion(goldenDog.Id, 1);

            // 修改
            AnimalWheel wheel3 = new AnimalWheel(42)
            {
                OrderIndex  = 13,
                Description = "theGoldenWheel3",
                TheColor    = new AnimalColor("绿色", 8, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            goldenDog.AddGoldenWheel(wheel3);
            UpdateGoldenDog(goldenDog);

            GoldenDog dogMemmory = GetGoldenDog(goldenDog.Id);

            Assert.AreEqual(dogMemmory.GoldenWheels.Count(), 3);

            CheckGoldenDogVersion(goldenDog.Id, 2);
        }
Exemplo n.º 3
0
        public void AnimalInheritedTest12()
        {
            var dog = this.Fixture.Get <Dog>() as Dog;

            CheckDogVersion(dog.Id, 1);

            // 修改
            AnimalWheel wheel3 = new AnimalWheel(4)
            {
                OrderIndex  = 13,
                Description = "theAnimalWheel3",
                TheColor    = new AnimalColor("绿色", 8, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            dog.GetWheels().Add(wheel3);
            UpdateDog(dog);

            Dog dogMemmory = GetDog(dog.Id);

            Assert.AreEqual(dog.GetWheels().Count, 3);

            CheckDogVersion(dog.Id, 2);
        }
Exemplo n.º 4
0
        public void AnimalExtensionTest19()
        {
            var animal = this.Fixture.Get <Animal>() as Animal;

            CheckAnimalVersion(animal.Id, 1);

            Animal animalMemmory = GetAnimal(animal.Id);

            Assert.AreEqual(animalMemmory.GetWheels().Count, 2);

            // 修改
            AnimalWheel wheel = animal.GetWheels().ElementAt(0);

            animal.GetWheels().Remove(wheel);
            UpdateAnimal(animal);

            animalMemmory = GetAnimal(animal.Id);

            Assert.AreEqual(animalMemmory.GetWheels().Count, 1);

            var animalNew = FindAnimal(animal.Id);

            CheckAnimalVersion(animal.Id, 2);
        }
Exemplo n.º 5
0
        public void AnimalExtensionTest15()
        {
            var animal = this.Fixture.Get <Animal>() as Animal;

            CheckAnimalVersion(animal.Id, 1);

            // 修改
            AnimalWheel wheel = new AnimalWheel(31)
            {
                OrderIndex  = 1,
                Description = "modify Wheel",
                TheColor    = new AnimalColor("蓝色", 5, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            animal.SetMainWheel(wheel);

            UpdateAnimal(animal);

            var animalNew = FindAnimal(animal.Id);

            Assert.AreEqual(animal.GetMainWheel().Description, "modify Wheel");

            CheckAnimalVersion(animal.Id, 2);
        }
Exemplo n.º 6
0
        private Animal CreateAnimal()
        {
            Animal animal = new Animal(Guid.NewGuid());

            animal.Name     = "一只动物";
            animal.LiveTime = new DateTime(2017, 6, 1);

            List <AnimalColor> colors = new List <AnimalColor>();

            colors.Add(new AnimalColor("红色", 6, true, AnimalCategory.Empty, AnimalAccessory.Empty));
            colors.Add(new AnimalColor("蓝色", 7, true, AnimalCategory.Empty, 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)
            };

            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)
            };

            animal.SetMainBreak(mainBreak);

            AnimalBreak breaker1 = new AnimalBreak(11)
            {
                Description = "AnimalBreak1",
                CreateDate  = new DateTime(2017, 6, 1)
            };

            AnimalBreak breaker2 = new AnimalBreak(12)
            {
                Description = "AnimalBreak2",
                CreateDate  = new DateTime(2017, 6, 2)
            };

            List <AnimalBreak> breaks = new List <AnimalBreak>();

            AddAnimalBreak(breaker1, breaks);
            AddAnimalBreak(breaker2, breaks);

            animal.SetBreaks(breaks);

            return(animal);
        }
Exemplo n.º 7
0
        private GoldenDog CreateGoldenDog()
        {
            GoldenDog goldenDog = new GoldenDog(Guid.NewGuid());

            goldenDog.LegCounts.Add(1);
            goldenDog.LegCounts.Add(2);

            goldenDog.LegColor = new AnimalColor("Leg颜色", 8, true, AnimalCategory.Empty, AnimalAccessory.Empty);

            List <AnimalColor> colors = new List <AnimalColor>()
            {
                new AnimalColor("蓝色", 8, true, AnimalCategory.Empty, AnimalAccessory.Empty),
                new AnimalColor("红色", 9, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            goldenDog.HeadColors = colors;

            goldenDog.GoldenWheel = new AnimalWheel(100)
            {
                OrderIndex  = 1,
                Description = "the GoldenWheel",
                TheColor    = new AnimalColor("Golden", 5, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            goldenDog.GoldenBreak = new AnimalBreak(50)
            {
                Description = "GoldenBreak",
                CreateDate  = new DateTime(2017, 6, 1)
            };

            AnimalWheel wheel1 = new AnimalWheel(40)
            {
                OrderIndex  = 11,
                Description = "theGoldenWheel1",
                TheColor    = new AnimalColor("红色", 6, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            AnimalWheel wheel2 = new AnimalWheel(41)
            {
                OrderIndex  = 12,
                Description = "theGoldenWheel2",
                TheColor    = new AnimalColor("蓝色", 7, true, AnimalCategory.Empty, AnimalAccessory.Empty)
            };

            goldenDog.AddGoldenWheel(wheel1);
            goldenDog.AddGoldenWheel(wheel2);

            AnimalBreak breaker1 = new AnimalBreak(21)
            {
                Description = "goldenDogBreak1",
                CreateDate  = new DateTime(2017, 6, 1)
            };

            AnimalBreak breaker2 = new AnimalBreak(22)
            {
                Description = "goldenDogBreak2",
                CreateDate  = new DateTime(2017, 6, 2)
            };

            goldenDog.AddGoldenBreak(breaker1);
            goldenDog.AddGoldenBreak(breaker2);

            FillDog(goldenDog);
            FillAnimal(goldenDog);

            return(goldenDog);
        }
Exemplo n.º 8
0
 public void AddGoldenWheel(AnimalWheel wheel)
 {
     _GoldenWheels.Add(wheel);
 }
Exemplo n.º 9
0
 public static void SetMainWheel(this Animal animal, AnimalWheel wheel)
 {
     animal.SetValue(MainWheelProperty, wheel);
 }
Exemplo n.º 10
0
        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);
        }