/// <summary> /// See <see cref="IDataStore"/> for method descriptions. /// </summary> public void AddSubject(TestSubject subject) { // A well designed UI should prevent this, but let's be safe. subject.Validate(); datastore.Add(subject); // flush the updated dataset this.Flush(); }
/// <summary> /// Removes a subject from the datastore. /// </summary> /// <returns>An <see cref="ActionResult"/> containing the updated view data.</returns> public ActionResult RemoveSubject() { TestSubject subject = new TestSubject() { Email = Request.QueryString["Email"], }; DataStore.DeleteSubject(subject); return UpdateSubjectTable(); }
/// <summary> /// See <see cref="IDataStore"/> for method descriptions. /// </summary> public void DeleteSubject(TestSubject subject) { var match = datastore.Where(sub => sub.Email == subject.Email).SingleOrDefault(); if (match != null) { datastore.Remove(match); } // flush the updated dataset this.Flush(); }
/// <summary> /// Adds a subject to the DataStore object. /// </summary> /// <returns>An <see cref="ActionResult"/> containing the updated view data.</returns> public ActionResult AddToSubjectTable() { IndexModel model = new IndexModel(); TestSubject subject = new TestSubject() { Email = Request.QueryString["Email"], FirstName = Request.QueryString["FirstName"], LastName = Request.QueryString["LastName"], Password = Request.QueryString["Password"] }; DataStore.AddSubject(subject); return UpdateSubjectTable(); }
/// <summary> /// See <see cref="IDataStore"/> for method descriptions. /// </summary> public bool HasDuplicate(TestSubject subject) { TestSubject dupe = datastore.Select(entry => entry).Where(entry => entry.Email == subject.Email).FirstOrDefault(); if (dupe != null) { return false; } else return true; }
public void TestSubjectConstructorTest() { TestSubject target = new TestSubject(); Assert.IsNotNull(target); }
public void PasswordTest() { TestSubject target = new TestSubject(); string expected = null; Assert.AreEqual(expected, target.Password); }
public void LastNameTest() { TestSubject target = new TestSubject(); string expected = null; Assert.AreEqual(expected, target.LastName); }
public void EmailTest() { TestSubject target = new TestSubject(); string expected = null; Assert.AreEqual(expected, target.Email); }