Example #1
0
 /// <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();
 }
Example #2
0
 /// <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();
 }
Example #3
0
 /// <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();
 }
Example #4
0
 /// <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();
 }
Example #5
0
 /// <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;
 }
Example #6
0
 public void TestSubjectConstructorTest()
 {
     TestSubject target = new TestSubject();
     Assert.IsNotNull(target);
 }
Example #7
0
 public void PasswordTest()
 {
     TestSubject target = new TestSubject();
     string expected = null;
     Assert.AreEqual(expected, target.Password);
 }
Example #8
0
 public void LastNameTest()
 {
     TestSubject target = new TestSubject();
     string expected = null;
     Assert.AreEqual(expected, target.LastName);
 }
Example #9
0
 public void EmailTest()
 {
     TestSubject target = new TestSubject();
     string expected = null;
     Assert.AreEqual(expected, target.Email);
 }