public void SelectAllRecordsTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); Assert.Equals(ad.ApplicantList, ad.SelectAllRecords()); }
public void PropHasValueTest_False() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); Assert.IsFalse(ApplicantDatabase.PropHasValue(a, "TestGrade", "8")); }
public void GetPropValueTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); Assert.AreEqual(ApplicantDatabase.GetPropValue(a, "Id").ToString(), "1892184593201"); }
public void InsertRecordTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); Assert.IsTrue(ad.ApplicantList.Contains(a)); }
public void SaveToFileTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); ad.SaveToFile(); Assert.Equals(ad, ApplicantDatabase.LoadFromFile(file)); }
public void UpdateRecordsTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); ad.UpdateRecords("Surname", "Alex", "TestGrade", "8"); Assert.IsTrue(ApplicantDatabase.PropHasValue(a, "TestGrade", "8")); }
public void SelectRecordsTest() { string file = "myfile.txt"; ApplicantDatabase ad = ApplicantDatabase.InitializeDatabase(file); Applicant a = new Applicant("1892184593201,Alex,Radu,7,4.75,4,4.5,0"); ad.InsertRecord(a); List <Applicant> list = new List <Applicant>(); list.Add(a); Assert.Equals(list, ad.SelectRecords("Id", "1892184593201")); }