示例#1
0
        public void WhenCreatingExtra_WithBadParameters_ExceptionIsThrown(string categoryName, string extraName, string color, string price, string reusable)
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);
            Assert.Throws(typeof(InvalidParameterException), () => logic.CreateExtraLogic(categoryName, extraName, color, price, reusable));
        }
示例#2
0
        public void WhenCreatingBrand_WithBadParameters_ExceptionThrown(string name, string country, string url, string date, string revenue)
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);
            Assert.Throws(typeof(InvalidParameterException), () => logic.CreateBrandLogic(name, country, url, date, revenue));
        }
示例#3
0
文件: Program.cs 项目: dark567/Cars
        private static void addNewCar()
        {
            try
            {
                string  Type, Color;
                decimal Price;

                Console.Write("\t Write Type Car:");
                Type = Console.ReadLine();

                Console.Write("\t Write Collor Car:");
                Color = Console.ReadLine();

                bool pr = false;
                do
                {
                    Console.Write("\t Write Price Car:");
                    pr = decimal.TryParse(Console.ReadLine(), out Price);
                    if (Price <= 0)
                    {
                        pr = false;
                    }
                } while (!pr);


                CarLogic.AddCar(new Car(Type, Color, Price));

                Console.WriteLine("\tSuccessfully");
            }
            catch (Exception e)
            {
                Console.WriteLine("\tError. Something went wrong!)", e.Message);
            }
        }
示例#4
0
        public void WhenUpdatingBrandWithInvalidValues_ExceptionThrwon(string id, string name, string country, string founded, string revenue)
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);
            Assert.Throws(typeof(InvalidParameterException), () => logic.UpdateBrandLogic(id, name, country, founded, revenue));
        }
        public void SetCarAbilities(bool singleRaceStarted)
        {
            CarLogic car = G.Sys.PlayerManager_.Current_.playerData_.CarLogic_;

            try
            {
                RandoMap map = randoGame.maps[Game.LevelName];
                if (!singleRaceStarted)
                {
                    jumpShouldBeEnabled  = map.jumpEnabled;
                    wingsShouldBeEnabled = map.wingsEnabled;
                    jetsShouldBeEnabled  = map.jetsEnabled;
                }
                car.Boost_.AbilityEnabled_ = map.boostEnabled;
                car.Jump_.AbilityEnabled_  = jumpShouldBeEnabled;
                car.Wings_.AbilityEnabled_ = wingsShouldBeEnabled;
                car.Jets_.AbilityEnabled_  = jetsShouldBeEnabled;

                // Disable stock show scores so we can display our own thing.
                car.CarLogicLocal_.PlayerDataLocal_.EnableOrDisableShowScores(false);

                Console.WriteLine($"Jump {car.Jump_.AbilityEnabled_} - Wings {car.Wings_.AbilityEnabled_} - Jets {car.Jets_.AbilityEnabled_}");
            }
            catch (KeyNotFoundException)
            {
                // this should only ever happen on Credits or Destination Unknown, so just enable everything
                car.Boost_.AbilityEnabled_ = true;
                car.Jump_.AbilityEnabled_  = true;
                car.Wings_.AbilityEnabled_ = true;
                car.Jets_.AbilityEnabled_  = true;
            }

            car.GetComponent <LocalPlayerControlledCar>().showBackToResetWarning_ = false;
        }
示例#6
0
            static void Postfix(CarLogic __instance)
            {
                Entry.logCurrentObjectAndChilds(__instance.gameObject, true);

                try
                {
                    var asset = GameObject.Instantiate(car);
                    asset.transform.parent        = __instance.transform;
                    asset.transform.localPosition = Vector3.zero;
                    asset.transform.localRotation = Quaternion.Euler(0, 180, 0);
                    asset.SetLayerRecursively(__instance.gameObject.GetLayer());
                    logCurrentObjectAndChilds(asset, false);
                    logger.WriteLine(asset.transform.parent.name);

                    /*var mat = new Material(Shader.Find("Diffuse"));
                     *
                     * foreach (var renderer in GameObject.FindObjectsOfType<Renderer>())
                     * {
                     *  renderer.material = mat;
                     * }*/
                }
                catch (Exception e)
                {
                    Console.Out.WriteLine(e.Message);
                    Console.Out.WriteLine(e.ToString());
                }

                Entry.logCurrentObjectAndChilds(__instance.gameObject, false);
            }
示例#7
0
        public void WhenCreatingModel_WithBadParameters_ExceptionThrown(string id, string name, string startDate, string engineSize, string horsePower, string price)
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);
            Assert.Throws(typeof(InvalidParameterException), () => logic.CreateModelLogic(id, name, startDate, engineSize, horsePower, price));
        }
示例#8
0
        public void WhenDeletingExtraWithInvalidId_ExceptionIsThrown(string selection)
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);

            Assert.Throws(typeof(InvalidParameterException), () => logic.DeleteExtra(selection));
        }
        public ActionResult Refuel(int id)
        {
            var carLogic = new CarLogic();

            var car = carLogic.GetById(id);

            return(View(car));
        }
示例#10
0
 public FormCreateOrder(CarLogic logicF, CustomerLogic logicO, EmployeeLogic logicC, OrderLogic or)
 {
     InitializeComponent();
     _logicC     = logicF;
     _logicP     = logicO;
     _logicE     = logicC;
     _logicOrder = or;
 }
示例#11
0
        static void Postfix(CarLogic __instance)
        {
            GameObject Car = __instance.gameObject;

            if (Car != null)
            {
                Car.AddComponent <UnitydTracker>();
            }
        }
示例#12
0
        /// <summary>
        /// Checks if repository was called once
        /// </summary>
        /// <param name="selection">id of the extra</param>
        public void WhenDeletingExtra_RepositoryIsCalled(string selection)
        {
            CarLogic logic = new CarLogic();

            // this.mockedRepository.Setup(m => m.DeleteModelRepo(It.IsAny<car_models>()));
            logic.SetRepositoryInterface(this.mockedRepository.Object);
            logic.DeleteModel(selection);
            this.mockedRepository.Verify(m => m.DeleteExtraRepo(It.IsAny <extra>()), Times.Once);
        }
示例#13
0
        static void Main(string[] args)
        {
            // add connection string
            // add entity fw

            CarDatabaseEntities db = new CarDatabaseEntities();

            Console.WriteLine(db.CAR.Count());

            //var q = from car in db.CAR
            //        group car by car.BRAND into grp
            //        select new
            //        {
            //            Brand = grp.Key.brand_name,
            //            AvgPrice = grp.Average(car => car.car_baseprice)
            //        };

            //foreach (var item in q) Console.WriteLine(item);


            // ----


            CarLogic cl = new CarLogic();

            Console.WriteLine("----");
            foreach (var item in cl.GetBrandAverages())
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("----");
            foreach (var item in cl.GetCarsWithLetter('a', false))
            {
                Console.WriteLine(item);
            }

            cl.InsertCar(new CAR()
            {
                car_model         = "Ford mustang",
                car_baseprice     = 990,
                car_discountprice = 10,
                car_brand         = 1,
                car_id            = 5 // no identity ~ auto incr.
            });

            cl.DeleteCar(1);

            Console.WriteLine("----");
            foreach (var item in cl.GetAll())
            {
                Console.WriteLine($"{item.car_model} {item.car_baseprice} {item.car_discountprice}");
            }

            Console.WriteLine("----");
            Console.WriteLine(cl.GetCheapestCarModel());
        }
示例#14
0
        public void CreateLamp()
        {
            string model = "";

            switch (Mod.Instance.Config.MeshModel)
            {
            case LampModel.EmpireLamp:
                model = EmpireLampPrefab;
                break;

            case LampModel.EmpirePilar:
                model = EmpireLampAlternatePrefab;
                break;

            case LampModel.NitronicLamp:
                model = NitronicLampPrefab;
                break;
            }

            carLogic_ = GetComponentInParent <CarLogic>();

            lamp_ = Instantiate(Resources.Load <GameObject>(model), transform.position, transform.rotation);

            lamp_.transform.parent = transform.parent;

            foreach (Collider collider in lamp_.GetComponentsInChildren <MeshCollider>(true))
            {
                collider.Destroy();
            }

            flare_  = lamp_.GetComponentInChildren <LensFlareLogic>();
            flares_ = lamp_.GetComponentsInChildren <LensFlare>() ?? new LensFlare[0];

            foreach (MeshRenderer renderer in lamp_.GetComponentsInChildren <MeshRenderer>())
            {
                foreach (Material material in renderer.materials)
                {
                    switch (material.name.ToLowerInvariant().Split(' ')[0])
                    {
                    case "empire_light_strip":
                    case "nitronic_lamplight":
                        materialLampLight_ = material;
                        break;

                    case "empire_panel":
                    case "nitronicpanel":
                        materialLampPanel_ = material;
                        break;
                    }
                }
            }

            light_ = lamp_.GetComponentInChildren <Light>();
            lamp_.SetActive(Mod.Instance.Config.Enabled);
        }
示例#15
0
        public void WhenGettingExtraConnections_GetsExtraConnections()
        {
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);

            var result = logic.ListConnectionLogic();

            Assert.That(result.Count(), Is.EqualTo(3));
            Assert.That(result.SingleOrDefault(x => x.id == 3), Is.Not.Null);
        }
示例#16
0
        public static CarState TryGetCarState(CarLogic carLogic, NitronicCarController nitronicCarController,
                                              Rigidbody rigidbody, CarStats carStats)
        {
            if (carLogic == null || carLogic.IsDying_ || nitronicCarController == null || rigidbody == null ||
                carStats == null)
            {
                return(null);
            }

            return(new CarState(carLogic, nitronicCarController, rigidbody, carStats));
        }
示例#17
0
        static void Main(string[] args)
        {
            var carLogic = new CarLogic();

            var car = carLogic.GetById(1);

            Console.WriteLine("Brand : " + car.Brand);
            Console.WriteLine("Model : " + car.Model);
            Console.WriteLine("Driver Name : " + car.Driver.FirstName + " " + car.Driver.LastName);
            Console.ReadLine();
        }
示例#18
0
        public async Task <IActionResult> GetAvailable(DateTime beginDateTime, DateTime endDateTime)
        {
            if (!ModelState.IsValid)
            {
                BadRequest("Parametreler uyuşmuyor");
            }

            var list = await CarLogic.AvailableCar(GetDepartmentCode(), beginDateTime, endDateTime);

            return(Ok(list));
        }
示例#19
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var carlogic = new CarLogic();

            var vechilelogic = new VehicleLogicCalculation();
            var userinput    = new UserInput();

            userinput.CarInput();
            CarLogic.DisplayCars();
            vechilelogic.NewVehicleLogic();
        }
示例#20
0
        public void WhenDeletingBrand_RepositoryIsCalled(string selection)
        {
            // Arrange
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);

            // Act
            logic.DeleteBrand(selection);

            // Assert (Verify)
            this.mockedRepository.Verify(m => m.DeleteBrandRepo(It.IsAny <car_brands>()), Times.AtLeastOnce);
        }
示例#21
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            int selectedId = (VehicleGrid.SelectedItem as CarVM).Id;
            var responce   = CarLogic.Delete(new CarVM
            {
                Id = selectedId,
            });

            if (responce.IsCompleted)
            {
                VehicleGrid.ItemsSource = CarLogic.List().Object;
            }
        }
示例#22
0
        public void WhenDeletingBrandWithInvalidId_ExceptionIsThrown(string selection)
        {
            // Arrange
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);

            // Act, Assert
            Assert.Throws(typeof(InvalidParameterException), () => logic.DeleteBrand(selection));

            this.mockedRepository.Verify(
                m => m.DeleteBrandRepo(It.IsAny <car_brands>()), Times.Never);
        }
示例#23
0
        public void WhenGettingExtrasFromDb_GetsExtras()
        {
            // Mock
            CarLogic logic = new CarLogic();

            logic.SetRepositoryInterface(this.mockedRepository.Object);

            // Act
            var result = logic.ListExtraLogic();

            // Assert
            Assert.That(result.Count(), Is.EqualTo(3));
            Assert.That(result.SingleOrDefault(x => x.name == "turbo"), Is.Not.Null);
        }
示例#24
0
        public void Update()
        {
            var playerManager  = G.Sys.PlayerManager_;
            var optionsManager = G.Sys.OptionsManager_;

            GeneralSettings = optionsManager ? optionsManager.General_ : null;
            var localPlayer     = playerManager ? playerManager.Current_ : null;
            var playerDataLocal = localPlayer?.playerData_;
            var carGameObject   = playerDataLocal ? playerDataLocal.Car_ : null;

            HoverScreenEmitter = carGameObject ? carGameObject.GetComponent <HoverScreenEmitter>() : null;
            CarLogic           = playerDataLocal ? playerDataLocal.CarLogic_ : null;
            CarStats           = CarLogic ? CarLogic.CarStats_ : null;
        }
        // GET: Car
        public ActionResult Index()
        {
            var carLogic = new CarLogic();

            var carList = carLogic.GetListAll();

            var model = new CarViewModel()
            {
                Cars        = carList,
                CountOfCars = carList.Count
            };

            return(View(model));
        }
示例#26
0
        internal static void Postfix(CarLogic __instance)
        {
            Transform reindeerCosmetic = __instance.transform.Find(InternalResources.Constants.REINDEER_COSMETIC);

            if (reindeerCosmetic)
            {
                if (reindeerCosmetic.HasComponent <HolidayFeaturesToggle>())
                {
                    reindeerCosmetic.GetComponent <HolidayFeaturesToggle>().Destroy();
                }

                bool flag = Mod.Instance.IsActive && Mod.Instance.Config.ReindeerCosmeticVisualCheat;
                reindeerCosmetic.gameObject.SetActive(flag);
            }
        }
示例#27
0
 public BookingController()
 {
     bookingLogic         = new BookingLogic();
     requestBookingLogic  = new RequestBookingLogic();
     stopOverAddressLogic = new StopOverAddressLogic();
     userBookingLogic     = new UserBookingLogic();
     carLogic             = new CarLogic();
     carModelLogic        = new CarModelLogic();
     carMakeLogic         = new CarMakeLogic();
     stopOverLogic        = new StopOverLogic();
     addressLogic         = new AdressLogic();
     utilisateurLogic     = new UtilisateurLogic();
     statusLogic          = new StatusLogic();
     notificationLogic    = new NotificationLogic();
 }
示例#28
0
        public async Task <IActionResult> Get(DateTime beginDateTime, DateTime endDateTime)
        {
            if (!await PublicAuthLogic.CheckAccessToken(GetAccessToken(), GetDepartmentCode()))
            {
                return(Unauthorized());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("Parametreler uyuşmuyor"));
            }

            var list = await CarLogic.AvailableCar(GetDepartmentCode(), beginDateTime, endDateTime);

            return(Ok(list));
        }
示例#29
0
 public CarController()
 {
     companyLogic         = new CompanyLogic();
     carLogic             = new CarLogic();
     carModelLogic        = new CarModelLogic();
     carMakeLogic         = new CarMakeLogic();
     bookingLogic         = new BookingLogic();
     requestBookingLogic  = new RequestBookingLogic();
     eventLogic           = new EventLogic();
     addressLogic         = new AdressLogic();
     utilisateurLogic     = new UtilisateurLogic();
     statusLogic          = new StatusLogic();
     stopOverLogic        = new StopOverLogic();
     stopOverAddressLogic = new StopOverAddressLogic();
     notificationLogic    = new NotificationLogic();
 }
        public void UpdateAbilityState()
        {
            RandoMap map = randoGame.maps[Game.LevelName];
            CarLogic car = G.Sys.PlayerManager_.Current_.playerData_.CarLogic_;

            if (car.Jump_.AbilityEnabled_ && !map.jumpEnabled)
            {
                jumpShouldBeEnabled = true;
            }
            if (car.Wings_.AbilityEnabled_ && !map.wingsEnabled)
            {
                wingsShouldBeEnabled = true;
            }
            if (car.Jets_.AbilityEnabled_ && !map.jetsEnabled)
            {
                jetsShouldBeEnabled = true;
            }
        }
示例#31
0
 public void setCarAndCarLogic()
 {
     car = GameObject.FindGameObjectWithTag ("car");
     if (car != null) { carLogic = car.GetComponent<CarLogic> (); }
 }
示例#32
0
    /*public void PutAtStart(GameObject go){
        go.transform.position = start.transform.position;

    }*/
    public void PutAtNode(CarLogic go, PathNode start)
    {
        go.transform.position = start.transform.position;
        go.rigidbody.velocity = start.next.transform.position - go.transform.position;
    }