/// <summary> /// Creating a vehicle object according to the input. /// </summary> /// <param name="vehicleType"></param> /// <param name="licensePlate"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="length"></param> /// <returns> a vehicle according to its data</returns> public static Vehicle GetVehicle(string vehicleType, string licensePlate, int width, int height, int length) { Vehicle vehicle = null; switch (vehicleType) { case ("motorcycle"): vehicle = new Motorcycle(licensePlate, width, height, length); break; case ("private"): vehicle = new PrivateVehicle(licensePlate, width, height, length); break; case ("crossover"): vehicle = new Crossover(licensePlate, width, height, length); break; case ("van"): vehicle = new Van(licensePlate, width, height, length); break; case ("truck"): vehicle = new Truck(licensePlate, width, height, length); break; case ("suv"): vehicle = new SUV(licensePlate, width, height, length); break; } return(vehicle); }
static void Main(string[] args) { // Hook(intervention point) for child classes example Contracts.FactoryMethodAsHookForChildClasses.ICar car = new SUV(); Console.WriteLine($"Engine volume :{car.Engine.Volume} \nEngine cilinders amount:{car.Engine.CilindersAmount}"); // Resolver example ICarResolver carResolver = new CarResolver(); double targetPrice = 30000; IEnumerable cars = carResolver.ResolveByPrice(targetPrice); Console.Write($"\nCars under {targetPrice} : "); foreach (var c in cars) { Console.Write($"{c.GetType().Name},"); } string targetType = "Truck"; ICar carByType = carResolver.ResolveByType(targetType); Console.WriteLine($"\nType of the car resolved for '{targetType}' : {carByType.GetType()}"); Console.ReadLine(); }
static void Main(string[] args) /// Purpose: To declare interface from created object and send it into function AddPassenger /// Restrictions: None: { IPassengerCarrier myCar = new SUV(); AddPassenger(myCar); }
public void Create_Lexus_SUV_Test() { SUV lexusSUV = lexusFactory.CreateSUV(); Assert.IsType <LexusSUV>(lexusSUV); Assert.IsAssignableFrom <SUV>(lexusSUV); Assert.Equal("Lexus SUV has been turned on.", lexusSUV.TurnOn()); Assert.Equal("Lexus SUV has been turned off.", lexusSUV.TurnOff()); }
static void Main(string[] args) { Console.WriteLine("Building C# Applications"); ReadCommandLineArgs(); Car obj = new SUV("CRV"); Console.WriteLine(((SUV)obj).GetName()); Car objnew = new Car("accord"); Console.ReadLine(); }
public void Create_Toyota_SUV_Test() { SUV toyotaSUV = toyotaFactory.CreateSUV(); Assert.IsType <ToyotaSUV>(toyotaSUV); Assert.IsAssignableFrom <SUV>(toyotaSUV); Assert.Equal("Toyota SUV has been turned on.", toyotaSUV.TurnOn()); Assert.Equal("Toyota SUV has been turned off.", toyotaSUV.TurnOff()); }
static void Main(string[] args) { Compact compact = new Compact(); SUV sUV = new SUV(); PassengerTrain passengerTrain = new PassengerTrain(); AddPassenger(compact); AddPassenger(sUV); AddPassenger(passengerTrain); }
static void Main(string[] args) { ICar car = new SUV(); car = new AlloywheelsDecorator(car); car = new LeatherworkDecorator(car); car = new SunroofDecorator(car); Console.WriteLine($"Price : {car.GetPrice()}"); Console.ReadLine(); }
public void TestMethod1() { SUV tahoe = new SUV(); tahoe.Make = "Chevy"; tahoe.Model = "Tahoe"; Console.WriteLine(tahoe.Start()); Console.WriteLine(tahoe.Drive()); Console.WriteLine(tahoe.CloseDoors()); Console.WriteLine(tahoe.Drive()); }
public async Task <SUV> Update(SUV suv) { var result = DBTable.FirstOrDefault(x => x.SUVId == suv.SUVId); if (result != null) { await Delete(suv.SUVId); return(await Create(suv)); } return(null); }
static void Main(string[] args) { PassengerTrain ptrain = new PassengerTrain(); Compact cpact = new Compact(); SUV suv = new SUV(); Pickup pickup = new Pickup(); AddPassenger(ptrain); AddPassenger(cpact); AddPassenger(suv); AddPassenger(pickup); Console.ReadKey(); }
public void Setup() { _subareOutbackMock = new SubaruOutback(); _suvMock = new SUV(); _truckMock = new Truck(); var autoMobiles = new IAutomobile[] { _subareOutbackMock, _suvMock, _truckMock }; _automobileFactory = new AutomobileFactory(autoMobiles); }
static void Main(string[] args) { Compact c = new Compact(); SUV s = new SUV(); //Pickup p = new Pickup(); PassengerTrain pt = new PassengerTrain(); IPassengerCarrier pt2 = new PassengerTrain(); AddPassenger(c); AddPassenger(s); AddPassenger(new Pickup()); AddPassenger(pt); AddPassenger(pt2); Console.ReadKey(); }
public ActionResult Create(SUV entity) { if (ModelState.IsValid) { using (IUnitOfWork uow = uowFactory.Create()) { repository.Add(entity); uow.Save(); return(RedirectToAction("Index")); } } else { return(View()); } }
static void Main(string[] args) { // 자식은 부모를 대체할 수 있어야함. Car sedanCar = new Sedan(); sedanCar.applyBreak(); sedanCar.DisplayDescription(); Console.WriteLine("========================================"); Car suvCar = new SUV(); suvCar.applyBreak(); suvCar.DisplayDescription(); Console.WriteLine("========================================"); suvCar.SetBreakBehavior(new BreakWithoutABS()); suvCar.applyBreak(); suvCar.DisplayDescription(); Console.WriteLine("========================================"); Console.ReadKey(); }
public async Task SUV_Create_SUVFuel() { //setup var position = new SUV() { SUVId = 13, SUVBrand = "Volkswagen", SUVModel = "T-Cross S", DateOfManufacturing = new DateTime(2020, 05, 30), SUVType = "AWD", Engine = "1.6 TSI, 95HP", Fuel = "Gasoline" }; _suvRepository.Setup(x => x.Create(It.IsAny <SUV>())).Callback(() => { _suv.Add(position); }).Returns(() => Task <SUV> .Factory.StartNew(() => new SUV() { SUVId = 13, SUVBrand = "BMW", SUVModel = "X5 M Sport", DateOfManufacturing = new DateTime(2020, 05, 30), SUVType = "AWD", Engine = "340HP", Fuel = "Gasoline/ Diesel" })); //Act var result = await _controller.Create(_mapper.Map <SUVRequest>(position)); //Assert var okObjectResult = result as OkObjectResult; Assert.NotNull(okObjectResult); var pos = okObjectResult.Value as SUVResponse; Assert.NotNull(pos); Assert.NotNull(_suv.FirstOrDefault(x => x.SUVId == position.SUVId)); }
static void Main(string[] args) { #region Lab_1 IBilesen bilesen = new Bilesen(); Client.Display("1.Basit Bileşen: ", bilesen); Console.WriteLine("\n"); Console.WriteLine("\n"); Client.Display("2.Bileşen A-Dekaratörü Eklendi: ", new Decorator_A(bilesen)); Console.WriteLine("\n"); Console.WriteLine("\n"); Client.Display("3.Bilesen B-Dekaratörü Eklendi: ", new Decorator_B(bilesen)); Console.WriteLine("\n"); Console.WriteLine("\n"); Client.Display("4.Bilesen İlk Önce A-Dekaratörü sonra B-Dekaratörü Eklendi: ", new Decorator_B(new Decorator_A(bilesen))); Console.WriteLine("\n"); Console.WriteLine("\n"); Decorator_B decorator_B = new Decorator_B(new Bilesen()); Client.Display("5.Bilesen İlk Önce B-Dekaratörü sonra B-Dekaratörü Eklendi: ", new Decorator_B(decorator_B)); Console.WriteLine("\t\t\t" + decorator_B.EklenenDavranış()); #endregion #region Lab_1 var mycar = new SUV { Marka = "Dodge", Model = "2019 Ram Power Wagon", HirePrice = 55000 }; HireOffer hireOffer = new HireOffer(mycar); hireOffer.DiscountPersantage = 10; Console.WriteLine("First Hire Price: {0}", mycar.HirePrice); Console.WriteLine("Discount Applied Price: {0}", hireOffer.HirePrice); #endregion Console.ReadKey(); }
public void TestVersion02(string vehicleCategory, string vehicleType) { const string Car = "Car"; const string SUV = "SUV"; string searchResult = null; VehicleFactory vehicleFactory = VehicleFactory.GetVehicleFactory(vehicleCategory); if (vehicleType.Equals(Car)) { Car car = vehicleFactory.GetCar(); searchResult = "Name: " + car.GetCarName() + "\nFeatures: " + car.GetCarFeatures(); } else if (vehicleType.Equals(SUV)) { SUV suv = vehicleFactory.GetSUV(); searchResult = "Name: " + suv.GetSUVName() + "\nFeatures: " + suv.GetSUVFeatures(); } Debug.WriteLine(searchResult); }
public ActionResult SearchResult(string type, string price, string year) { Dealership d = new Dealership(); Car car1 = new Car("Saab", "9-3 Convertible", 12000, 50000, 2011, "https://parkers-images.bauersecure.com/pagefiles/202328/cut-out/600x400/saab_93_conv03.jpg"); d.AddCar(car1); SUV suv1 = new SUV("Honda", "CRV", 3000, 120000, 2008, "https://cdn.jdpower.com/Models/400x200/2008-Honda-CR-V.jpg"); d.AddCar(suv1); SUV suv2 = new SUV("Honda", "CRV", 30000, 5, 2020, "https://2020hondarelease.com/wp-content/uploads/2019/04/2020-Honda-Crv-Australia-Arrival-Redesign-Interior-Changes-2.png"); d.AddCar(suv2); SUV suv3 = new SUV("Tesla", "Model-X", 100000, 10, 2019, "https://wi-images.condecdn.net/image/pekOxKERYM2/crop/1620/f/tesla1.jpg"); d.AddCar(suv3); Sedan sedan1 = new Sedan("Toyota", "Camry LE", 2500, 250000, 1995, "https://cdn04.carsforsale.com/3/706559/13654755/thumb/950860869.jpg"); d.AddCar(sedan1); Sedan sedan2 = new Sedan("Volvo", "244", 1000, 375000, 1985, "https://cdn.bringatrailer.com/wp-content/uploads/2019/05/1985_volvo_244_1558905199bbb65d56947eIMG_0395-e1559955417902-940x590.jpg"); d.AddCar(sedan2); Sedan sedan3 = new Sedan("Saturn", "L Series", 5000, 16000, 2002, "https://upload.wikimedia.org/wikipedia/commons/c/c9/00-02_Saturn_L-Series_sedan.jpg"); d.AddCar(sedan3); Sedan sedan4 = new Sedan("Volkswagon", "Golf", 1000000000, 49000, 2014, "https://cimg1.ibsrv.net/ibimg/hgm/1600x900-1/100/403/2014-volkswagen-gti-concept_100403401.jpg"); d.AddCar(sedan4); Truck truck1 = new Truck("Toyota", "Tacoma", 11380, 260000, 2003, "https://cdn.bringatrailer.com/wp-content/uploads/2018/03/152124801198764da20180316_122214-940x705.jpg"); d.AddCar(truck1); Truck truck2 = new Truck("Chevy", "S10", 4812, 350000, 1992, "https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/1992_Chevrolet_S-10_Tahoe.jpg/280px-1992_Chevrolet_S-10_Tahoe.jpg"); d.AddCar(truck2); Van van1 = new Van("Mercedes", "12 Passenger Van", 50000, 70000, 2015, "https://www.mercedes-benz-vans.ca/images/vehicles/sprinter/passenger-van-nav.png"); d.AddCar(van1); List <Car> searchList = d.Search(type, price, year); return(View(searchList)); }
public void Show() { Console.WriteLine(@" Создайте проект консольного приложения с именем Traffic, ссылающийся на проект Vehicles.dll (из упражнения 4). Добавьте в него функцию AddPasenger, принимаю- щую любой объект с интерфейсом IPassengerCarrier. Для проверки работоспособно- сти кода вызовите эту функцию для экземпляров всех объектов, которые поддерживают этот интерфейс, и выводите результаты с помощью метода ToString, унаследованного от класса System.Object. "); IPassengerCarrier iPassenger; SUV suv = new SUV(); Compact compact = new Compact(); PassengerTrain passegerTrain = new PassengerTrain(); iPassenger = suv; Console.WriteLine(iPassenger.ToString()); iPassenger = compact; Console.WriteLine(iPassenger.ToString()); iPassenger = passegerTrain; Console.WriteLine(iPassenger.ToString()); Console.WriteLine(); }
static void Main(string[] args) { var myFavoritePet = new Rabbit("Kelly", 2, 4, "Carrots"); myFavoritePet.Jump(); Console.WriteLine(myFavoritePet); var myfavoriteFood = new Indian("Paneer Tikka", "appealing", "medium", 8, "you should try it as it's very delicious"); Console.WriteLine(myfavoriteFood); var myFavoriteCar = new SUV("Toyota", "Rav4", 2016); Console.WriteLine(myFavoriteCar); //var camry = new Cars("Toyota", "Camry", "new", CarType.Convertible); //camry.SetYear(2018); //camry.Ride(); //var dog = new Pets("Tommy", 3, PetType.Dog); //dog.Lick(); //dog.Talk(); //var kachoriChat = new Foods("kachori Chat", CuisineType.Indian); //kachoriChat.SetRating(8); //kachoriChat.SetRating(8, "It's delicious"); //var minion = new Movies("Despicable Me", GenreType.Animation); //minion.SetRating(9); //minion.SetRating(9, "loved it"); //Console.WriteLine($"{dog.Name} is {dog.Age} years old {dog.Type} and {dog.Talk()} and my lick {dog.Lick()}."); //Console.WriteLine($"I like {camry.Type} {camry.Make} {camry.Model} in {camry.Condition} condition! {camry.Ride()}"); //Console.WriteLine($"{kachoriChat.Name} is {kachoriChat.Type} dish and it's rated {kachoriChat.Rating} with review of {kachoriChat.Review}. "); //Console.WriteLine($"{minion.Name} is {minion.Type} movie and it's rated {minion.Rating} with review of {minion.Review}."); Console.ReadLine(); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Car[] myCars = new Car[n]; for (int i = 0; i < n/2; i++) { myCars[i] = new Automobile(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine())); } Console.WriteLine("Enter SUV's:"); for (int i = 0; i < n/2; i++) { myCars[i] = new SUV(int.Parse(Console.ReadLine()), bool.Parse(Console.ReadLine())); } for (int i = 0; i < myCars.Length/2; i++) { object[] autoArray = myCars[i]; } }
static void Main(string[] args) { Vehicles[] aVehicles = new Vehicles[6]; aVehicles[0] = new Compact(); aVehicles[1] = new DoubleBogey(); aVehicles[2] = new FreightTrain(); aVehicles[3] = new PassengerTrain(); aVehicles[4] = new PickUp(); aVehicles[5] = new SUV(); foreach (Vehicles vehicles in aVehicles) { try { IPassengerCarrier tmp = (IPassengerCarrier) vehicles; AddPassenger(tmp); } catch (Exception) { Console.WriteLine("Объект не наследует интерфейс IPassengerCarrier {0}",vehicles.ToString()); } } Console.ReadKey(); }
private void btnRightNew_Click(object sender, EventArgs e) { const string FileName = @"..\..\..\..\Vehicle.bin"; SUV suv = new SUV("Honda CRV", "Blue", 2000, 170000, 5, 5000, 6000); Vehicle suv2 = (Vehicle)suv.Clone(); Compact sedan = new Compact("Toyato Camry", "Green", 2011, 100, 5, 10000, 15000); Vehicle sedan2 = (Vehicle)sedan.Clone(); Stream VehicleFileStream = File.Create(FileName); BinaryFormatter serializer = new BinaryFormatter();//overwrites var myVehicleList = new List <Vehicle> { suv, suv2, sedan, sedan2, }; foreach (Vehicle v in myVehicleList) { serializer.Serialize(VehicleFileStream, v); } VehicleFileStream.Close(); }
private static void UserInputForAutomobiles() { Console.WriteLine("What is your dream car?"); var UserInput = Console.ReadLine(); var isCarType = Enum.TryParse(UserInput, out CarType carType); if (isCarType) { IAutomobile automobile; switch (carType) { case CarType.Suv: automobile = new SUV(); automobile.Mileage = 170; automobile.Type = carType; automobile.VroomVroom(); break; case CarType.Rickshaw: automobile = new Rickshaw { Mileage = 5, Type = carType }; automobile.VroomVroom(); break; case CarType.Sports: automobile = new Sports(); automobile.Mileage = 75; automobile.Type = carType; automobile.VroomVroom(); break; } } }
static void Main(string[] args) { Vehicle.Vehicle[] vehicles = new Vehicle.Vehicle[6]; vehicles[0] = new Compact(); vehicles[1] = new SUV(); vehicles[2] = new Pickup(); vehicles[3] = new PassengerTrain(); vehicles[4] = new FreightTrain(); vehicles[5] = new DoubleBogey424(); foreach (Vehicle.Vehicle veh in vehicles) { try { AddPassenger((IPassengerCarrier)veh); } catch (Exception e) { WriteLine(e.Message); WriteLine($"Unable to add passenger to {veh.ToString()}"); } } ReadKey(); }
public void PrepareData() { ISession s = OpenSession(); ITransaction txn = s.BeginTransaction(); Car car = new Car(); car.Id = GetNewId(); car.Vin = "123c"; car.Owner = "Kirsten"; s.Save(car); Truck truck = new Truck(); truck.Id = GetNewId(); truck.Vin = "123t"; truck.Owner = "Steve"; s.Save(truck); SUV suv = new SUV(); suv.Id = GetNewId(); suv.Vin = "123s"; suv.Owner = "Joe"; s.Save(suv); Pickup pickup = new Pickup(); pickup.Id = GetNewId(); pickup.Vin = "123p"; pickup.Owner = "Cecelia"; s.Save(pickup); txn.Commit(); s.Close(); }
public async Task PrepareDataAsync(CancellationToken cancellationToken = default(CancellationToken)) { ISession s = OpenSession(); ITransaction txn = s.BeginTransaction(); Car car = new Car(); car.Id = GetNewId(); car.Vin = "123c"; car.Owner = "Kirsten"; await(s.SaveAsync(car, cancellationToken)); Truck truck = new Truck(); truck.Id = GetNewId(); truck.Vin = "123t"; truck.Owner = "Steve"; await(s.SaveAsync(truck, cancellationToken)); SUV suv = new SUV(); suv.Id = GetNewId(); suv.Vin = "123s"; suv.Owner = "Joe"; await(s.SaveAsync(suv, cancellationToken)); Pickup pickup = new Pickup(); pickup.Id = GetNewId(); pickup.Vin = "123p"; pickup.Owner = "Cecelia"; await(s.SaveAsync(pickup, cancellationToken)); await(txn.CommitAsync(cancellationToken)); s.Close(); }
protected override void OnSetUp() { using (var s = OpenSession()) using (var txn = s.BeginTransaction()) { _polliwog = new Animal { BodyWeight = 12, Description = "Polliwog" }; _catepillar = new Animal { BodyWeight = 10, Description = "Catepillar" }; _frog = new Animal { BodyWeight = 34, Description = "Frog" }; _butterfly = new Animal { BodyWeight = 9, Description = "Butterfly" }; _polliwog.Father = _frog; _frog.AddOffspring(_polliwog); _catepillar.Mother = _butterfly; _butterfly.AddOffspring(_catepillar); s.Save(_frog); s.Save(_polliwog); s.Save(_butterfly); s.Save(_catepillar); var dog = new Dog { BodyWeight = 200, Description = "dog" }; s.Save(dog); var cat = new Cat { BodyWeight = 100, Description = "cat" }; s.Save(cat); var dragon = new Dragon(); dragon.SetFireTemperature(200); s.Save(dragon); _zoo = new Zoo { Name = "Zoo" }; var add = new Address { City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000" }; _zoo.Address = add; _pettingZoo = new PettingZoo { Name = "Petting Zoo" }; var addr = new Address { City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000" }; _pettingZoo.Address = addr; s.Save(_zoo); s.Save(_pettingZoo); var joiner = new Joiner { JoinedName = "joined-name", Name = "name" }; s.Save(joiner); var car = new Car { Vin = "123c", Owner = "Kirsten" }; s.Save(car); var truck = new Truck { Vin = "123t", Owner = "Steve" }; s.Save(truck); var suv = new SUV { Vin = "123s", Owner = "Joe" }; s.Save(suv); var pickup = new Pickup { Vin = "123p", Owner = "Cecelia" }; s.Save(pickup); var entCompKey = new EntityWithCrazyCompositeKey { Id = new CrazyCompositeKey { Id = 1, OtherId = 1 }, Name = "Parent" }; s.Save(entCompKey); _joe = new Human { Name = new Name { First = "Joe", Initial = 'Q', Last = "Public" } }; _doll = new Human { Name = new Name { First = "Kyu", Initial = 'P', Last = "Doll" }, Friends = new[] { _joe } }; _stevee = new Human { Name = new Name { First = "Stevee", Initial = 'X', Last = "Ebersole" } }; s.Save(_joe); s.Save(_doll); s.Save(_stevee); _intVersioned = new IntegerVersioned { Name = "int-vers", Data = "foo" }; s.Save(_intVersioned); _timeVersioned = new TimestampVersioned { Name = "ts-vers", Data = "foo" }; s.Save(_timeVersioned); var scwc = new SimpleClassWithComponent { Name = new Name { First = "Stevee", Initial = 'X', Last = "Ebersole" } }; s.Save(scwc); var mainEntWithAssoc = new SimpleEntityWithAssociation() { Name = "main" }; var otherEntWithAssoc = new SimpleEntityWithAssociation() { Name = "many-to-many-association" }; mainEntWithAssoc.ManyToManyAssociatedEntities.Add(otherEntWithAssoc); mainEntWithAssoc.AddAssociation("one-to-many-association"); s.Save(mainEntWithAssoc); var owner = new SimpleEntityWithAssociation { Name = "myEntity-1" }; owner.AddAssociation("assoc-1"); owner.AddAssociation("assoc-2"); owner.AddAssociation("assoc-3"); s.Save(owner); var owner2 = new SimpleEntityWithAssociation { Name = "myEntity-2" }; owner2.AddAssociation("assoc-1"); owner2.AddAssociation("assoc-2"); owner2.AddAssociation("assoc-3"); owner2.AddAssociation("assoc-4"); s.Save(owner2); var owner3 = new SimpleEntityWithAssociation { Name = "myEntity-3" }; s.Save(owner3); txn.Commit(); } }
static void Main(string[] args) { string[] brand = new string[10]; for (int i = 0; i < brand.Length; i++) { if (i >= 0 && i <= 4) { Console.Write("Enter a brand: "); brand[i] = Console.ReadLine(); } if (i > 4 && i < brand.Length) { Console.Write("Enter SUV brand: "); brand[i] = Console.ReadLine(); } } Console.WriteLine(); int[] price = new int[10]; for (int i = 0; i < price.Length; i++) { Console.Write("Enter price for every model: "); price[i] = int.Parse(Console.ReadLine()); } Console.WriteLine(); float[] consumption = new float[10]; for (int i = 0; i < consumption.Length; i++) { Console.Write("Enter average fuel consumption: "); consumption[i] = float.Parse(Console.ReadLine()); } Console.WriteLine(); Console.WriteLine("Model Info is:"); Console.WriteLine(); for (int i = 0; i < 10; i++) { if (i >= 0 && i <= 4) { Automobile carInfo = new Automobile(price[i], consumption[i]); carInfo.Price = price[i]; carInfo.Fuel = consumption[i]; Console.WriteLine("Brand of automobile: " + brand[i]); Console.WriteLine("Price: " + carInfo.Price + " EUR"); Console.WriteLine("Fuel consumption: " + carInfo.Fuel); Console.WriteLine(); } if (i > 4 && i < 10) { bool highRoad = true; SUV carInfo = new SUV(price[i], highRoad); carInfo.Price = price[i]; carInfo.HighRoad = highRoad; if (consumption[i] < 10) { carInfo.HighRoad = false; Console.WriteLine("Brand of SUV: " + brand[i]); Console.WriteLine("Price: " + carInfo.Price + " EUR"); Console.WriteLine("High road: " + carInfo.HighRoad); } if (consumption[i] >= 10) { carInfo.HighRoad = true; Console.WriteLine("Brand of SUV: " + brand[i]); Console.WriteLine("Price: " + carInfo.Price + " EUR"); Console.WriteLine("High road: " + carInfo.HighRoad); } Console.WriteLine(); } } Console.WriteLine(); Console.WriteLine(); }
public async Task PrepareAsync(CancellationToken cancellationToken = default(CancellationToken)) { ISession s = tc.OpenNewSession(); ITransaction txn = s.BeginTransaction(); Polliwog = new Animal { BodyWeight = 12, Description = "Polliwog" }; Catepillar = new Animal { BodyWeight = 10, Description = "Catepillar" }; Frog = new Animal { BodyWeight = 34, Description = "Frog" }; Polliwog.Father = Frog; Frog.AddOffspring(Polliwog); Butterfly = new Animal { BodyWeight = 9, Description = "Butterfly" }; Catepillar.Mother = Butterfly; Butterfly.AddOffspring(Catepillar); await(s.SaveAsync(Frog, cancellationToken)); await(s.SaveAsync(Polliwog, cancellationToken)); await(s.SaveAsync(Butterfly, cancellationToken)); await(s.SaveAsync(Catepillar, cancellationToken)); var dog = new Dog { BodyWeight = 200, Description = "dog" }; await(s.SaveAsync(dog, cancellationToken)); var cat = new Cat { BodyWeight = 100, Description = "cat" }; await(s.SaveAsync(cat, cancellationToken)); Zoo = new Zoo { Name = "Zoo" }; var add = new Address { City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000" }; Zoo.Address = add; PettingZoo = new PettingZoo { Name = "Petting Zoo" }; var addr = new Address { City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000" }; PettingZoo.Address = addr; await(s.SaveAsync(Zoo, cancellationToken)); await(s.SaveAsync(PettingZoo, cancellationToken)); var joiner = new Joiner { JoinedName = "joined-name", Name = "name" }; await(s.SaveAsync(joiner, cancellationToken)); var car = new Car { Vin = "123c", Owner = "Kirsten" }; await(s.SaveAsync(car, cancellationToken)); var truck = new Truck { Vin = "123t", Owner = "Steve" }; await(s.SaveAsync(truck, cancellationToken)); var suv = new SUV { Vin = "123s", Owner = "Joe" }; await(s.SaveAsync(suv, cancellationToken)); var pickup = new Pickup { Vin = "123p", Owner = "Cecelia" }; await(s.SaveAsync(pickup, cancellationToken)); var b = new BooleanLiteralEntity(); await(s.SaveAsync(b, cancellationToken)); await(txn.CommitAsync(cancellationToken)); s.Close(); }
public void PrepareData() { ISession s = OpenSession(); ITransaction txn = s.BeginTransaction(); Car car = new Car(); car.Id = GetNewId(); car.Vin="123c"; car.Owner="Kirsten"; s.Save(car); Truck truck = new Truck(); truck.Id = GetNewId(); truck.Vin = "123t"; truck.Owner="Steve"; s.Save(truck); SUV suv = new SUV(); suv.Id = GetNewId(); suv.Vin = "123s"; suv.Owner="Joe"; s.Save(suv); Pickup pickup = new Pickup(); pickup.Id = GetNewId(); pickup.Vin = "123p"; pickup.Owner="Cecelia"; s.Save(pickup); txn.Commit(); s.Close(); }
public void Prepare() { ISession s = tc.OpenNewSession(); ITransaction txn = s.BeginTransaction(); Polliwog = new Animal {BodyWeight = 12, Description = "Polliwog"}; Catepillar = new Animal {BodyWeight = 10, Description = "Catepillar"}; Frog = new Animal {BodyWeight = 34, Description = "Frog"}; Polliwog.Father = Frog; Frog.AddOffspring(Polliwog); Butterfly = new Animal {BodyWeight = 9, Description = "Butterfly"}; Catepillar.Mother = Butterfly; Butterfly.AddOffspring(Catepillar); s.Save(Frog); s.Save(Polliwog); s.Save(Butterfly); s.Save(Catepillar); var dog = new Dog {BodyWeight = 200, Description = "dog"}; s.Save(dog); var cat = new Cat {BodyWeight = 100, Description = "cat"}; s.Save(cat); Zoo = new Zoo {Name = "Zoo"}; var add = new Address {City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000"}; Zoo.Address = add; PettingZoo = new PettingZoo {Name = "Petting Zoo"}; var addr = new Address {City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000"}; PettingZoo.Address = addr; s.Save(Zoo); s.Save(PettingZoo); var joiner = new Joiner {JoinedName = "joined-name", Name = "name"}; s.Save(joiner); var car = new Car {Vin = "123c", Owner = "Kirsten"}; s.Save(car); var truck = new Truck {Vin = "123t", Owner = "Steve"}; s.Save(truck); var suv = new SUV {Vin = "123s", Owner = "Joe"}; s.Save(suv); var pickup = new Pickup {Vin = "123p", Owner = "Cecelia"}; s.Save(pickup); var b = new BooleanLiteralEntity(); s.Save(b); txn.Commit(); s.Close(); }
public Task <SUV> Create(SUV suv) { DBTable.Add(suv); return(Task.FromResult(suv)); }
public Client(CarFactory carFactory) { sportsCar = carFactory.CreateSportsCar(); suv = carFactory.CreateSUV(); }
public void Prepare() { ISession s = tc.OpenNewSession(); ITransaction txn = s.BeginTransaction(); Polliwog = new Animal { BodyWeight = 12, Description = "Polliwog" }; Catepillar = new Animal { BodyWeight = 10, Description = "Catepillar" }; Frog = new Animal { BodyWeight = 34, Description = "Frog" }; Polliwog.Father = Frog; Frog.AddOffspring(Polliwog); Butterfly = new Animal { BodyWeight = 9, Description = "Butterfly" }; Catepillar.Mother = Butterfly; Butterfly.AddOffspring(Catepillar); s.Save(Frog); s.Save(Polliwog); s.Save(Butterfly); s.Save(Catepillar); var dog = new Dog { BodyWeight = 200, Description = "dog" }; s.Save(dog); var cat = new Cat { BodyWeight = 100, Description = "cat" }; s.Save(cat); Zoo = new Zoo { Name = "Zoo" }; var add = new Address { City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000" }; Zoo.Address = add; PettingZoo = new PettingZoo { Name = "Petting Zoo" }; var addr = new Address { City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000" }; PettingZoo.Address = addr; s.Save(Zoo); s.Save(PettingZoo); var joiner = new Joiner { JoinedName = "joined-name", Name = "name" }; s.Save(joiner); var car = new Car { Vin = "123c", Owner = "Kirsten" }; s.Save(car); var truck = new Truck { Vin = "123t", Owner = "Steve" }; s.Save(truck); var suv = new SUV { Vin = "123s", Owner = "Joe" }; s.Save(suv); var pickup = new Pickup { Vin = "123p", Owner = "Cecelia" }; s.Save(pickup); var b = new BooleanLiteralEntity(); s.Save(b); txn.Commit(); s.Close(); }
public async Task <SUV> Update(SUV suv) { return(await _suvRepository.Update(suv)); }