From 4df43fde543e93eea9e5b5fba6783a88d7065cbd Mon Sep 17 00:00:00 2001 From: Strati Date: Sun, 19 Aug 2018 15:57:44 +0200 Subject: [PATCH] add helper to generate testdata --- .../WpfWebClient/Helper/GenerateTestData.cs | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 WebClient/WpfWebClient/Helper/GenerateTestData.cs diff --git a/WebClient/WpfWebClient/Helper/GenerateTestData.cs b/WebClient/WpfWebClient/Helper/GenerateTestData.cs new file mode 100644 index 0000000..01175be --- /dev/null +++ b/WebClient/WpfWebClient/Helper/GenerateTestData.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WpfWebClient.ServiceReferenceEHEC; + +namespace WpfWebClient.Helper +{ + public static class GenerateTestData + { + private static List Foodplaces = new List(); + private static List Exams = new List(); + private static Random random = new Random(); + + private static List FoodPlaceNameFirstPart = new List(new string[] + { + "The ", "Tony's ", "Best ", "Paulas ", "Golden ", "Platinum ", "Super " + }); + + private static List FoodPlaceNameSecondPart = new List(new string[] + { + "Pizzaplace", "Meatclub", "Veganitorium", "Applepie", "Burger", "Esspalast", "Döner", "Bananorama" + }); + + private static List FoodPlaceDescription = new List(new string[] + { + "Einfach unglaublich", "Die grössten der ganzen Stadt", "Ziemlich durchschnittlich", "Einmal alles ohne scharf bitte", + "Das ist eine B-Schreibung", "Etwas teuer aber trotzdem einen Besuch Wert", "Grösster Müll EVER", "Do ane chumi NIE MEH!" + }); + + private static List FoodPlaceStreetName = new List(new string[] +{ + "Hansestrasse", "Dorfweg", "Rumpelstrasse", "Hauptstrasse", + "Blumengasse", "Pimpelpfad", "Im Grund", "Schotterweg" +}); + + public static List CreateFoodPlaces() + { + + WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient(); + List cities = new List(client.GetCities()); + + int FirstPartLength = FoodPlaceNameFirstPart.Count(); + int SecondPartLength = FoodPlaceNameSecondPart.Count(); + int Counter = FirstPartLength * SecondPartLength; + + int i = 1; + while (i < 20) + { + int FirstPart = random.Next(1, FirstPartLength); + int SecondPart = random.Next(1, SecondPartLength); + int Description = random.Next(FoodPlaceDescription.Count); + string FoodPlaceDescr = FoodPlaceDescription[Description]; + int StreetName = random.Next(FoodPlaceStreetName.Count); + string FoodPlacesm = FoodPlaceStreetName[StreetName]; + + string FoodPlaceName = FoodPlaceNameFirstPart[FirstPart] + FoodPlaceNameSecondPart[SecondPart]; + string streetname = FoodPlacesm; + string fpdescr = FoodPlaceDescr; + int StreetNumber = random.Next(1, 100); + int CityID = random.Next(1, cities.Count()); + City city = cities[CityID]; + FoodPlace NewFoodPlace = new FoodPlace(); + + NewFoodPlace.Name = FoodPlaceName; + NewFoodPlace.Streetname = streetname; + NewFoodPlace.Streetnumber = StreetNumber.ToString(); + NewFoodPlace.Description = fpdescr; + NewFoodPlace.City = city; + + + + Foodplaces.Add(NewFoodPlace); + i++; + } + + return Foodplaces; + } + } +}