public void the_number_of_applicants_should_increase_by_one() { var newApplicant = new Applicant(); int applicantsBeforeInsert = _repo.GetApplicants().AsEnumerable().ToArray().Length; newApplicant.Name = "asduth awutht"; newApplicant.Rate = 405; _repo.InsertApplicant(newApplicant); _repo.Save(); int applicantsAfterInsert = _repo.GetApplicants().AsEnumerable().ToArray().Length; Assert.AreEqual(applicantsBeforeInsert + 1, applicantsAfterInsert); }
public bool InsertApplicant(Applicant newApplicant) { try { _ctx.Applicants.Add(newApplicant); _ctx.Entry(newApplicant).State = EntityState.Unchanged; return true; } catch (Exception ex) { return false; } }
public void It_should_store_the_attributes_correctly() { var newApplicant = new Applicant(); newApplicant.Name = "assdh awutht"; newApplicant.Rate = 420; _repo.InsertApplicant(newApplicant); _repo.Save(); Applicant lastInsertedApplicant = _repo.GetApplicants().OrderByDescending(a => a.Id).FirstOrDefault(); Assert.AreEqual(newApplicant.Name,lastInsertedApplicant.Name); Assert.AreEqual(newApplicant.Rate, lastInsertedApplicant.Rate); }
public void Setup() { Database.SetInitializer(new DropCreateDatabaseAlways<DummyApplicantContext>()); _context.Database.CreateIfNotExists(); var newapp = new Applicant(); newapp.Name = "as adasw"; newapp.Rate = 400; _repo.InsertApplicant(newapp); _repo.Save(); //Candidate, TableName = "recruitment_candidate" //CandidateMapping, }