public void employementTimesTest() { PersonalAssistantDAO paDao = new PersonalAssistantDAO(); PurchaserDataDAO pdDao = new PurchaserDataDAO(); PurchaserData originalPd = d; originalPd = pdDao.Insert(originalPd); idToDelete = originalPd.Purchaser.Id; List <PersonalAssistant> pas = paDao.SelectAll(); if (pas == null || pas.Count == 0) { Assert.Fail("Can not find personal assistants to add to purchasers employmentTimes"); } PersonalAssistant pa = pas[0]; Purchaser p = originalPd.Purchaser; paDao.insertEmploymentStatus(p, pa); //when PurchaserDAO purDao = new PurchaserDAO(); List <EmploymentStatus> empList = purDao.SelectEmploymentStatusList(p); //then Assert.IsNotNull(empList); Assert.AreEqual(empList.Count, 1); Assert.AreEqual(empList[0].Purchaser.Id, p.Id); Assert.AreEqual(empList[0].Assistant.Id, pa.Id); }
public void SelectAllTestPurchaserData() { //given (see setUp) PurchaserDataDAO pdDao = new PurchaserDataDAO(); PurchaserData originalPur = d; long id = pdDao.Insert(originalPur).Purchaser.Id; idToDelete = id; //when List <PurchaserData> pds = pdDao.SelectAll(); //then foreach (PurchaserData pd in pds) { if (pd.Purchaser.Id == id) { Assert.AreEqual(pd.Purchaser.FirstName, "testpersonDao"); Assert.AreEqual(pd.Purchaser.LastName, "testpersonDao"); Assert.AreEqual(pd.Purchaser.PhoneNumber, "9999"); Assert.AreEqual(pd.Purchaser.MobilePhone, "99999"); Assert.AreEqual(pd.Purchaser.EMail, "*****@*****.**"); Assert.AreEqual(pd.Purchaser.HomeAdress.Street, "Am Hügel"); Assert.AreEqual(pd.Purchaser.HomeAdress.HouseNumber, 12); Assert.AreEqual(pd.Purchaser.HomeAdress.City, "LINZ"); Assert.AreEqual(pd.Purchaser.HomeAdress.Country, "schland"); Assert.AreEqual(pd.Purchaser.HomeAdress.DoorNumber, 11115); Assert.AreEqual(pd.Purchaser.HomeAdress.StairNumber, 2345); Assert.AreEqual(pd.Purchaser.HomeAdress.Etage, 2); Assert.AreEqual(pd.Purchaser.HomeAdress.ZipCode, 5040); Assert.AreEqual(pd.Purchaser.IBAN, "AT1254859888898"); Assert.AreEqual(pd.Purchaser.BIC, "SPPR2586XX"); Assert.AreEqual(pd.Purchaser.AccountHolder, "Helmut Günther"); Assert.AreEqual(pd.Purchaser.SVN, 1225020496); Assert.AreEqual(pd.Purchaser.nationality, "Auenland"); Assert.AreEqual(pd.Purchaser.InfoField, "Infotext"); //purchaser Assert.AreEqual(pd.Purchaser.Active, true); Assert.AreEqual(pd.Purchaser.ApprovalBegin, new DateTime(2015, 05, 02)); Assert.AreEqual(pd.Purchaser.ApprovalEnd, new DateTime(2017, 05, 02)); Assert.AreEqual(pd.Purchaser.EntryDate, new DateTime(2015, 05, 02)); Assert.AreEqual(pd.Purchaser.hasContract, true); Assert.AreEqual(pd.Purchaser.hasIntroCourse, true); Assert.AreEqual(pd.Purchaser.DistrictCommision, "Perg"); //purchaserData Assert.AreEqual(pd.AssistenceDemand, 12); Assert.AreEqual(pd.CareAllowance, 2); Assert.AreEqual(pd.HourlyRate, 30); Assert.AreEqual(pd.HourlyRatePayoff, 20); Assert.AreEqual(pd.Income, 29); Assert.AreEqual(pd.InputIncome, 100); Assert.AreEqual(pd.Month, 11); Assert.AreEqual(pd.TravellingAllowance, 12); Assert.AreEqual(pd.TravellingAllowanceKM, 11); //Assert.AreEqual(pd.CareAllowanceMaximum, 16); Assert.AreEqual(pd.Year, 2015); } } }
public void employingPurchasersTest() { PersonalAssistantDAO paDao = new PersonalAssistantDAO(); PurchaserDataDAO pdDao = new PurchaserDataDAO(); PersonalAssistant originalPa = pa; originalPa = paDao.insert(originalPa); idToDelete = originalPa.Id; List <PurchaserData> purs = pdDao.SelectAll(); if (purs == null || purs.Count == 0) { Assert.Fail("Can not add purchaser to personal assistants purchasersList"); } Purchaser p = purs[0].Purchaser; paDao.insertEmploymentStatus(p, originalPa); //when paDao.selectPurchaserList(originalPa); //then Assert.IsNotNull(originalPa.Purchasers); Assert.AreEqual(originalPa.Purchasers.Count, 1); Assert.AreEqual(originalPa.Purchasers[0].Id, p.Id); }
private void FillGlobals() { PurchaserDataDAO pdao = new PurchaserDataDAO(); List <PurchaserData> purchasers = pdao.SelectAll(); PayperHour.Text = purchasers[0].HourlyRate.ToString(); billablePayperHour.Text = purchasers[0].HourlyRatePayoff.ToString(); KmPay.Text = purchasers[0].TravellingAllowanceKM.ToString(); }
public void tearDown() { PurchaserDataDAO pdDao = new PurchaserDataDAO(); pdDao.DeletePurchaserDataRecursive(idToDelete); }
public void UpdatePurchaserDataTest() { PurchaserDataDAO pdDao = new PurchaserDataDAO(); PurchaserData originalPur = d; PurchaserData pd = new PurchaserData(); PurchaserData p = pdDao.Insert(originalPur); idToDelete = p.Purchaser.Id; //Person Insert p.Purchaser.FirstName = "Hermann"; p.Purchaser.LastName = "Mayr"; p.Purchaser.PhoneNumber = "1111"; p.Purchaser.MobilePhone = "1111"; p.Purchaser.EMail = "*****@*****.**"; p.Purchaser.HomeAdress.Street = "Am Tal"; p.Purchaser.HomeAdress.HouseNumber = 2; p.Purchaser.HomeAdress.City = "LINZKeks"; p.Purchaser.HomeAdress.Country = "schiachland"; p.Purchaser.HomeAdress.DoorNumber = 2222; p.Purchaser.HomeAdress.StairNumber = 1; p.Purchaser.HomeAdress.Etage = 1; p.Purchaser.HomeAdress.ZipCode = 54; p.Purchaser.IBAN = "DE2554859888898"; p.Purchaser.BIC = "RAPR2586XX"; p.Purchaser.AccountHolder = "Herman Günther"; p.Purchaser.SVN = 3525020496; p.Purchaser.nationality = "BAuenland"; p.Purchaser.InfoField = "Infotext erweitert"; //purchaser p.Purchaser.Active = false; p.Purchaser.ApprovalBegin = new DateTime(2016, 06, 08); p.Purchaser.ApprovalEnd = new DateTime(2018, 08, 09); p.Purchaser.EntryDate = new DateTime(2018, 04, 07); p.Purchaser.hasContract = false; p.Purchaser.hasIntroCourse = false; p.Purchaser.DistrictCommision = "Freistadt"; //purchaserData p.AssistenceDemand = 225; p.CareAllowance = 84; p.HourlyRate = 26; p.HourlyRatePayoff = 12; p.Income = 2900; p.InputIncome = 1000; p.Month = 11; p.TravellingAllowance = 13; p.TravellingAllowanceKM = 25; p.CareAllowanceMaximum = 18; p.Year = 2015; pdDao.Update(p); p = new PurchaserData(); p.Purchaser = new Purchaser(); p.Purchaser.Id = idToDelete; pdDao.Select(p); //Person Insert Assert.AreEqual(p.Purchaser.FirstName, "Hermann"); Assert.AreEqual(p.Purchaser.LastName, "Mayr"); Assert.AreEqual(p.Purchaser.PhoneNumber, "1111"); Assert.AreEqual(p.Purchaser.MobilePhone, "1111"); Assert.AreEqual(p.Purchaser.EMail, "*****@*****.**"); Assert.AreEqual(p.Purchaser.HomeAdress.Street, "Am Tal"); Assert.AreEqual(p.Purchaser.HomeAdress.HouseNumber, 2); Assert.AreEqual(p.Purchaser.HomeAdress.City, "LINZKeks"); Assert.AreEqual(p.Purchaser.HomeAdress.Country, "schiachland"); Assert.AreEqual(p.Purchaser.HomeAdress.DoorNumber, 2222); Assert.AreEqual(p.Purchaser.HomeAdress.StairNumber, 1); Assert.AreEqual(p.Purchaser.HomeAdress.Etage, 1); Assert.AreEqual(p.Purchaser.HomeAdress.ZipCode, 54); Assert.AreEqual(p.Purchaser.IBAN, "DE2554859888898"); Assert.AreEqual(p.Purchaser.BIC, "RAPR2586XX"); Assert.AreEqual(p.Purchaser.AccountHolder, "Herman Günther"); Assert.AreEqual(p.Purchaser.SVN, 3525020496); Assert.AreEqual(p.Purchaser.nationality, "BAuenland"); Assert.AreEqual(p.Purchaser.InfoField, "Infotext erweitert"); //purchaser Assert.AreEqual(p.Purchaser.Active, false); Assert.AreEqual(p.Purchaser.ApprovalBegin, new DateTime(2016, 06, 08)); Assert.AreEqual(p.Purchaser.ApprovalEnd, new DateTime(2018, 08, 09)); Assert.AreEqual(p.Purchaser.EntryDate, new DateTime(2018, 04, 07)); Assert.AreEqual(p.Purchaser.hasContract, false); Assert.AreEqual(p.Purchaser.hasIntroCourse, false); Assert.AreEqual(p.Purchaser.DistrictCommision, "Freistadt"); //purchaserData Assert.AreEqual(p.AssistenceDemand, 225); Assert.AreEqual(p.CareAllowance, 84); Assert.AreEqual(p.HourlyRate, 26); Assert.AreEqual(p.HourlyRatePayoff, 12); Assert.AreEqual(p.Income, 2900); Assert.AreEqual(p.InputIncome, 1000); Assert.AreEqual(p.Month, 11); Assert.AreEqual(p.TravellingAllowance, 13); Assert.AreEqual(p.TravellingAllowanceKM, 25); Assert.AreEqual(p.Year, 2015); }
public void UpdatePaTest() { PersonalAssistantDAO paDao = new PersonalAssistantDAO(); PurchaserDataDAO pdDao = new PurchaserDataDAO(); PersonalAssistant originalPa = pa; originalPa = paDao.insert(originalPa); idToDelete = originalPa.Id; PersonalAssistant updatePa = new PersonalAssistant(); //Person Insert updatePa.FirstName = "update"; updatePa.LastName = "update"; updatePa.PhoneNumber = "1111"; updatePa.MobilePhone = "52451111"; updatePa.EMail = "*****@*****.**"; updatePa.HomeAdress.Street = "Am Tal"; updatePa.HomeAdress.HouseNumber = 14; updatePa.HomeAdress.City = "LINZKeks"; updatePa.HomeAdress.Country = "schiland"; updatePa.HomeAdress.DoorNumber = 111515; updatePa.HomeAdress.StairNumber = 45; updatePa.HomeAdress.Etage = 0; updatePa.HomeAdress.ZipCode = 50040; updatePa.IBAN = "AT1554859888898"; updatePa.BIC = "SPPR1586XX"; updatePa.AccountHolder = "Herman Günther"; updatePa.SVN = 2225025496; updatePa.nationality = "Bauernland"; updatePa.InfoField = "Infotext erweitert"; //pa updatePa.Active = false; updatePa.ClosingDateDocuments = new DateTime(2016, 04, 05); updatePa.SV = false; updatePa.Dienstvertrag = false; updatePa.BestBH = false; updatePa.Grundkurs = false; updatePa.consumedHours = 2.1M; updatePa.deadLineHours = new DateTime(2016, 01, 09); updatePa = paDao.update(updatePa); Assert.AreEqual(updatePa.FirstName, "update"); Assert.AreEqual(updatePa.LastName, "update"); Assert.AreEqual(updatePa.PhoneNumber, "1111"); Assert.AreEqual(updatePa.MobilePhone, "52451111"); Assert.AreEqual(updatePa.EMail, "*****@*****.**"); Assert.AreEqual(updatePa.HomeAdress.Street, "Am Tal"); Assert.AreEqual(updatePa.HomeAdress.HouseNumber, 14); Assert.AreEqual(updatePa.HomeAdress.City, "LINZKeks"); Assert.AreEqual(updatePa.HomeAdress.Country, "schiland"); Assert.AreEqual(updatePa.HomeAdress.DoorNumber, 111515); Assert.AreEqual(updatePa.HomeAdress.StairNumber, 45); Assert.AreEqual(updatePa.HomeAdress.Etage, 0); Assert.AreEqual(updatePa.HomeAdress.ZipCode, 50040); Assert.AreEqual(updatePa.IBAN, "AT1554859888898"); Assert.AreEqual(updatePa.BIC, "SPPR1586XX"); Assert.AreEqual(updatePa.AccountHolder, "Herman Günther"); Assert.AreEqual(updatePa.SVN, 2225025496); Assert.AreEqual(updatePa.nationality, "Bauernland"); Assert.AreEqual(updatePa.InfoField, "Infotext erweitert"); //pa Assert.AreEqual(updatePa.Active, false); Assert.AreEqual(updatePa.ClosingDateDocuments, new DateTime(2016, 04, 05)); Assert.AreEqual(updatePa.SV, false); Assert.AreEqual(updatePa.Dienstvertrag, false); Assert.AreEqual(updatePa.BestBH, false); Assert.AreEqual(updatePa.Grundkurs, false); Assert.AreEqual(updatePa.consumedHours, 2.1M); Assert.AreEqual(updatePa.deadLineHours, new DateTime(2016, 01, 09)); }
public static void setUp(TestContext testContext) { eeDao = new EffortEntryDAO(); mbDao = new MonthlyBillingDAO(); pdDao = new PurchaserDataDAO(); paDao = new PersonalAssistantDAO(); Purchaser p = new Purchaser(); //Person Insert p.FirstName = "testpersonDao"; p.LastName = "testpersonDao"; p.PhoneNumber = "9999"; p.MobilePhone = "99999"; p.EMail = "*****@*****.**"; p.HomeAdress.Street = "Am Hügel"; p.HomeAdress.HouseNumber = 12; p.HomeAdress.City = "LINZ"; p.HomeAdress.Country = "schland"; p.HomeAdress.DoorNumber = 11115; p.HomeAdress.StairNumber = 2345; p.HomeAdress.Etage = 2; p.HomeAdress.ZipCode = 5040; p.IBAN = "AT1254859888898"; p.BIC = "SPPR2586XX"; p.AccountHolder = "Helmut Günther"; p.SVN = 1225020496; p.nationality = "Auenland"; p.InfoField = "Infotext"; //purchaser p.Active = true; p.ApprovalBegin = new DateTime(2015, 05, 02); p.ApprovalEnd = new DateTime(2017, 05, 02); p.EntryDate = new DateTime(2015, 05, 02); p.hasContract = true; p.hasIntroCourse = true; p.DistrictCommision = "Perg"; //purchaserData d = new PurchaserData(); d.Purchaser = p; d.AssistenceDemand = 12; d.CareAllowance = 2; d.HourlyRate = 30; d.HourlyRatePayoff = 20; d.Income = 29; d.InputIncome = 100; d.Month = 11; d.TravellingAllowance = 12; d.TravellingAllowanceKM = 11; d.CareAllowanceMaximum = 16; d.Year = 1998; pa = new PersonalAssistant(); //Person Insert pa.FirstName = "persöhnlicher"; pa.LastName = "assistent"; pa.PhoneNumber = "9999"; pa.MobilePhone = "99999"; pa.EMail = "*****@*****.**"; pa.HomeAdress.Street = "Am Hügel"; pa.HomeAdress.HouseNumber = 12; pa.HomeAdress.City = "LINZ"; pa.HomeAdress.Country = "schland"; pa.HomeAdress.DoorNumber = 11115; pa.HomeAdress.StairNumber = 2345; pa.HomeAdress.Etage = 2; pa.HomeAdress.ZipCode = 5040; pa.IBAN = "AT1254859888898"; pa.BIC = "SPPR2586XX"; pa.AccountHolder = "Helmut Günther"; pa.SVN = 1225020496; pa.nationality = "Auenland"; pa.InfoField = "Infotext"; //pa pa.Active = true; pa.ClosingDateDocuments = new DateTime(2016, 02, 03); pa.SV = true; pa.Dienstvertrag = true; pa.BestBH = true; pa.Grundkurs = true; pa.consumedHours = 2.4M; pa.deadLineHours = new DateTime(2017, 02, 04); pa = paDao.insert(pa); d = pdDao.Insert(d); mb = new MonthlyBillingPerPa(); mb.PrivateKm = 21; mb.Month = 7; mb.Year = 1998; mb.Pa = pa; mb.Pur = d; mb.WorkingHours = 15; mb.BillableKm = 10; effortEntries = new List <EffortEntry>(); EffortEntry a = new EffortEntry(); a.Month = mb.Month; a.Year = mb.Year; a.Pa = mb.Pa; a.Purchaser = mb.Pur.Purchaser; a.Day = 1; a.From = new DateTime(a.Year, a.Month, a.Day, 12, 30, 0); a.To = new DateTime(a.Year, a.Month, a.Day, 18, 45, 0); a.Km = 10; a.A1 = new Activity(Activity.State.Begleitung); a.A2 = new Activity(Activity.State.Hauswirtschaft); EffortEntry b = new EffortEntry(); b.Month = mb.Month; b.Year = mb.Year; b.Pa = mb.Pa; b.Purchaser = mb.Pur.Purchaser; b.Day = 2; b.From = new DateTime(b.Year, b.Month, b.Day, 12, 30, 0); b.To = new DateTime(b.Year, b.Month, b.Day, 18, 45, 0); b.Km = 10; b.A1 = new Activity(Activity.State.Begleitung); b.A2 = new Activity(Activity.State.Hauswirtschaft); effortEntries.Add(a); effortEntries.Add(b); }