public void ThenThereArePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var people = peopleRepo.GetAll(); TableAid.ObjectComparer(table, people); }
public void ThenThereArePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var actualPeople = peopleRepo.GetAll(); table.CompareToSet(actualPeople); }
public void GivenIHavePeopleExampleBasic(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var people = TableAid.ObjectCreator <Person>(table); foreach (var person in people) { peopleRepo.Save(person); } }
public void GivenIHaveStores(Table table) { var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); var stores = table.CreateSet <Store>(); foreach (var store in stores) { storeRepo.Save(store); } }
public void WhenIBuildTheStoreEmployeeReport() { var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var allStores = storeRepo.GetAll(); var allPeople = peopleRepo.GetQueryible().OrderByDescending(p => p.YearsOfService).ToList(); var lineNumber = 0; var report = new List <ReportEntry>(); //1234567890123456789012345678901234567890 report.Add(new ReportEntry() { LineNumber = lineNumber++, Line = "Store " }); report.Add(new ReportEntry() { LineNumber = lineNumber++, Line = " Employee Years of Service" }); report.Add(new ReportEntry() { LineNumber = lineNumber++, Line = " " }); foreach (var store in allStores) { report.Add(new ReportEntry() { LineNumber = lineNumber++, Line = store.Name.PadRight(40) }); foreach (var person in allPeople) { if (person.Store.StoreId != store.StoreId) { return; } var theLine = " " + person.FirstName + " " + person.LastName; var theLine39 = theLine.PadRight(39); var theLine40 = theLine39 + person.YearsOfService; report.Add(new ReportEntry() { LineNumber = lineNumber++, Line = theLine40 }); } } RecallAid.It["StoreReport"] = report; }
public void GivenIUpdatePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); TableAid.ObjectUpdater <Person> ( table, (tr) => { return(peopleRepo.GetById(tr["!Emp Id"])); } ); }
public void GivenIHaveStores(Table table) { var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); foreach (var tableRow in table.Rows) { var newStore = new Store(); newStore.StoreId = int.Parse(tableRow["Store Id"]); newStore.Name = tableRow["Name"]; storeRepo.Save(newStore); } }
public void ThenTheyAreOnTheHill() { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var jackId = (int)ScenarioContext.Current["JackId"]; var jack = peopleRepo.GetById(jackId); Assert.AreEqual(jack.Address, "Top of Hill"); var jillId = (int)ScenarioContext.Current["JillId"]; var jill = peopleRepo.GetById(jillId); Assert.AreEqual(jill.Address, "Top of Hill"); }
public void GivenIHavePeopleExampleBasic(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); var people = table.CreateSet <Person>().ToList(); for (int i = 0; i < table.Rows.Count; i++) { var store = storeRepo.GetById(table.Rows[i]["Store Id"]); people[i].Store = store; peopleRepo.Save(people[i]); } }
public void WhenTheyGoUpTheHill() { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var jackId = (int)ScenarioContext.Current["JackId"]; var jack = peopleRepo.GetById(jackId); jack.Address = "Top of Hill"; peopleRepo.Save(jack); var jillId = (int)ScenarioContext.Current["JillId"]; var jill = peopleRepo.GetById(jillId); jill.Address = "Top of Hill"; peopleRepo.Save(jack); }
public void GivenIHavePeopleExampleBasic(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); // Tell TableAid to Ignore the Un-mappable column // Necessary when SpecAidAssertWhenUnknownColumn is True TableAid.ObjectCreator <Person>( table, (tr, p) => { p.Store = storeRepo.GetById(Convert.ToInt32(tr["Store Id"])); peopleRepo.Save(p); }, (new CreateColumnBuilder <Person>()).AddIgnore("Store Id").Out ); }
public void ThenThereArePeople(Table table) { try { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var actualPeople = peopleRepo.GetAll(); TableAid.ObjectComparer(table, actualPeople); } catch (Exception ex) { // We are good! return; } Assert.Fail("An Exception was expected."); }
public static IList <PersonReportDto> GetDataForPersonReport() { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var persons = peopleRepo.GetAll(); var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); var stores = storeRepo.GetAll(); var data = (from person in persons join store in stores on person.Store.StoreId equals store.StoreId select new PersonReportDto { FirstName = person.FirstName, LastName = person.LastName, StoreName = store.Name, YearsOfService = person.YearsOfService, Tenured = person.YearsOfService >= 5 ? "Yes" : "No" }).ToList(); return(data); }
public void ThenThereArePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); foreach (var tableRow in table.Rows) { var person = peopleRepo.GetById(tableRow["Emp Id"]); if (person == null) { Assert.Fail("Person not found"); } Assert.AreEqual(tableRow["First Name"], person.FirstName); Assert.AreEqual(tableRow["Middle Name"], person.MiddleName); Assert.AreEqual(tableRow["Last Name"], person.LastName); Assert.AreEqual(int.Parse(tableRow["Years Of Service"]), person.YearsOfService); Assert.AreEqual(tableRow["Store.Name"], person.Store.Name); } }
public void GivenJackAndJillAreAtTheBottomOfTheHill() { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var jack = new Person() { FirstName = "Jack", Address = "Bottom of Hill" }; var jill = new Person() { FirstName = "Jill", Address = "Bottom of Hill" }; peopleRepo.Save(jack); peopleRepo.Save(jill); ScenarioContext.Current.Add("JackId", jack.Id); ScenarioContext.Current.Add("JillId", jill.Id); }
public void GivenIHavePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); foreach (var tableRow in table.Rows) { var localTableRow = tableRow; var newPerson = new Person(); newPerson.EmpId = tableRow["Emp Id"]; newPerson.FirstName = tableRow["First Name"]; newPerson.MiddleName = tableRow["Middle Name"]; newPerson.LastName = tableRow["Last Name"]; newPerson.YearsOfService = int.Parse(tableRow["Years Of Service"]); var store = storeRepo.GetById(localTableRow["Store Id"]); newPerson.Store = store; peopleRepo.Save(newPerson); } }
public void GivenIHavePeople(Table table) { var peopleRepo = RecallAidHelper.GetReal <PeopleRepo>(); TableAid.ObjectCreator <Person>(table, (tr, p) => peopleRepo.Save(p)); }
public void GivenIHaveStores(Table table) { var storeRepo = RecallAidHelper.GetReal <StoreRepo>(); TableAid.ObjectCreator <Store>(table, (tr, s) => storeRepo.Save(s)); }