Пример #1
0
        public void AddTyreTooMuch()
        {
            var engine = CreateEngine();
            var tyres = CreateTyres(Car.StandardTyreCount);

            var car = new Car(engine, tyres);

            car.AddTyre(new Tyre());
            Assert.Fail();
        }
Пример #2
0
        public void AddTyre()
        {
            var engine = CreateEngine();

            var car = new Car(engine, null);
            Assert.AreEqual(0, car.TyreCount);

            car.AddTyre(new Tyre());
            Assert.AreEqual(1, car.TyreCount);
        }
Пример #3
0
        private void RepairTyre(Car car)
        {
            if (car.IsTyreBroken) {
                car.UnloadBrokenTyres();
                for(int i = car.TyreCount; i < Car.StandardTyreCount; i++)
                {
                    var tyre = new Tyre();

                    car.AddTyre(tyre);
                }
            }
        }