static void Main(string[] args) { MockDataProvider data = new MockDataProvider(); List <Person> persons = (data.GetPeople(20)); if (persons != null) { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[4] { new DataColumn("ID", typeof(int)), new DataColumn("Firstname", typeof(string)), new DataColumn("Lastname", typeof(string)), new DataColumn("Title", typeof(string)) }); int ID = 1; foreach (Person p in persons) { dt.Rows.Add(ID, p.Firstname, p.Lastname, p.TitleOfCountesey); ID++; } Executor executor = new Executor(); executor.Execute("InsertPerson", dt); } Repository repository = new Repository(); PrintAll(repository.GetAll()); Console.ReadLine(); }
public void List_WithValidCount_FromWebService() { //arrange int expectedAmount = 5; MockDataProvider data = new MockDataProvider(); //act int actualAmount = data.GetPeople(expectedAmount).Count; //assert Assert.AreEqual(expectedAmount, actualAmount); }
static void Main(string[] args) { MockDataProvider dataProvider = new MockDataProvider(); DataRepository repo = new DataRepository(); repo.Executor.Execute("dbo.MyProcedure1", repo.SqlCreater(dataProvider.GetPeople(10))); foreach (Person p in repo.GetAll()) { Console.WriteLine(p); } Console.ReadKey(); }
static void Main(string[] args) { //Creates a instance of MockDataProvider so we can access the functions in it MockDataProvider dataProvider = new MockDataProvider(); //Create a instance of Reporsitory so we can call the database function Reporsitory executor = new Reporsitory(); //First it gets the results from dataProvider, and saves it all in the database. executor.Save((dataProvider.GetPeople(99))); //Calls a function to print all persons to the console PrintAll(executor.GetAll()); //Wait for user to press any key on the keyboard Console.ReadKey(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //Data // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); listView = FindViewById <ListView>(Resource.Id.myListView); foreach (Port port in mock.GetPeople(5)) { mItems.Add(new Port(port.PortSpecifier, port.PortNumber, port.Activity)); } mItems.Add(new Port("g", 3, true)); mItems.Add(new Port("g", 3, true)); MyListViewAdapter adapter = new MyListViewAdapter(mItems, this); listView.Adapter = adapter; }
public void List_WithValidCount_DB() { //arrange int ammount = 5; MockDataProvider data = new MockDataProvider(); Reporsitory executor = new Reporsitory(); List <Person> personList = new List <Person>(); int expectedAmmount = 0; //act personList = data.GetPeople(ammount); expectedAmmount = personList.Count; executor.Save(personList); int actualAmmount = executor.GetAll().Count; //assert Assert.AreEqual(expectedAmmount, actualAmmount); }
static void Main(string[] args) { MockDataProvider dataProvider = new MockDataProvider(); DataRepository repo = new DataRepository(); repo.Executor.Execute("dbo.MyProcedure", 2); List <Person> persons = dataProvider.GetPeople(9); repo.Save(persons); List <Person> personFromDatabase = repo.GetAll(); foreach (Person p in personFromDatabase) { Console.WriteLine(p); } Console.ReadKey(); }