public void CarTest13()
        {
            var car = this.Fixture.Get <Car>() as Car;

            CheckCarDataVersion(car.Id, 1);

            // 修改
            CarWheel wheel = new CarWheel(4)
            {
                OrderIndex  = 13,
                Description = "theCarWheel3",
                TheColor    = new WholeColor("绿色", 9, false)
            };

            car.AddCarWheel(wheel);

            UpdateCar(car);

            Car carMemmory = GetCar(car.Id);

            Assert.AreEqual(carMemmory.Wheels.Count(), 3);

            Assert.AreEqual(carMemmory.Wheels.ElementAt(2).TheColor.Name, "绿色");

            var carNew = FindCar(car.Id);

            CheckCarDataVersion(car.Id, 2);
        }
        public void CarTest10()
        {
            var car = this.Fixture.Get <Car>() as Car;

            CheckCarDataVersion(car.Id, 1);

            // 修改
            CarWheel wheel = new CarWheel(10)
            {
                OrderIndex  = 1,
                Description = "modefy main CarWheel",
                TheColor    = new WholeColor("蓝色", 6, false)
            };

            car.MainWheel = wheel;

            UpdateCar(car);

            Car carMemmory = GetCar(car.Id);

            Assert.AreEqual(carMemmory.MainWheel.Id, 10);

            Assert.AreEqual(carMemmory.MainWheel.OrderIndex, 1);
            Assert.AreEqual(carMemmory.MainWheel.Description, "modefy main CarWheel");
            Assert.AreEqual(carMemmory.MainWheel.TheColor.Name, "蓝色");

            var carNew = FindCar(car.Id);

            CheckCarDataVersion(car.Id, 2);
        }
Exemple #3
0
 public void AddCarWheel(CarWheel wheel)
 {
     _Wheels.Add(wheel);
 }
        private Car CreateCar()
        {
            Car car = new Car(Guid.NewGuid());

            car.Name     = "宝马i7";
            car.IsNewCar = true;

            car.LightCounts.Add(1);
            car.LightCounts.Add(2);

            car.ErrorMessages = new List <string> {
                "error1", "error2"
            };

            car.DeliveryDates = new List <Emptyable <DateTime> > {
                new DateTime(2016, 6, 1),
                new DateTime(2016, 6, 2),
                new DateTime(2016, 6, 3)
            };

            car.AllColor = new WholeColor("颜色", 8, true);

            List <CarAccessory> accessories = new List <CarAccessory>()
            {
                new CarAccessory("配饰1", 10, new DateTime(2017, 6, 1)),
                new CarAccessory("配饰2", 11, new DateTime(2017, 6, 2)),
                new CarAccessory("配饰3", 12, new DateTime(2017, 6, 3))
            };

            car.CarAccessories = accessories;

            car.MainWheel = new CarWheel(1)
            {
                OrderIndex  = 1,
                Description = "the main CarWheel",
                TheColor    = new WholeColor("主色", 5, true)
            };

            CarWheel wheel1 = new CarWheel(2)
            {
                OrderIndex  = 11,
                Description = "theCarWheel1",
                TheColor    = new WholeColor("红色", 6, true)
            };

            CarWheel wheel2 = new CarWheel(3)
            {
                OrderIndex  = 12,
                Description = "theCarWheel2",
                TheColor    = new WholeColor("蓝色", 7, true)
            };

            car.AddCarWheel(wheel1);
            car.AddCarWheel(wheel2);

            car.MainBreak = new CarBreak(1)
            {
                Description = "MainBreak",
                TheColor    = new WholeColor("主色", 5, true),
                CreateDate  = new DateTime(2017, 6, 1)
            };


            return(car);
        }