public void DUser_Profile_WhenAskedForKey_ReturnsEmail_ID() { //Arrange: An user_profile with a unique key is constructed. DUser_Profile user_profile = new DUser_Profile { User_Profile_ID = -1 }; //Act: the key is retrieved. int key = user_profile.key; //Assert: the key is the same as the friended user's ID. Assert.AreEqual(key, user_profile.User_Profile_ID); }
public void DUser_ProfileWithSqlMembers_WhenScrubbed_BecomesSafe() { //Arrange: An user_profile with malicious html and sql members is constructed. string malicious = "1');DELETE TABLE dbo.example;--"; DUser_Profile user_profile = new DUser_Profile{ Short_Alias = malicious, Long_Alias = malicious, username = malicious }; //Act: The friended user is scrubbed. user_profile.Scrub(); //Assert: The friended user has no html in its members. Assert.AreNotEqual(malicious, user_profile.Short_Alias); Assert.AreNotEqual(malicious, user_profile.Long_Alias); Assert.AreNotEqual(malicious, user_profile.username); }
public DUser_Profile Profile_Update(DUser_Profile updating, string username) { IDataRepository<DUser_Profile> profiles = RepositoryFactory.Instance.Construct<DUser_Profile>(username); profiles.Update(updating); return profiles.FirstOrDefault(); }
public void Profile_Delete(DUser_Profile deleting, string username) { IDataRepository<DUser_Profile> profiles = RepositoryFactory.Instance.Construct<DUser_Profile>(username); profiles.Delete(deleting); }
public ActionResult UserProfile_Create(DUser_Profile creating, string returnView = "Index") { string returnUrl = returnView.Equals("Index") ? "http://www.jonathan-burrows.com/profile/home" : "http://www.jonathan-burrows.com/profile/Update"; HomeIndexViewModel model = new HomeIndexViewModel { avatars = service.Avatar_GetList(), profile = service.Profile_Create(creating, User.Identity.Name), navSection = infastructure.PageStructure_GetBySelected(35) }; return View(returnView, model); }
public ActionResult Update(DUser_Profile updating) { HomeIndexViewModel model = new HomeIndexViewModel { avatars = service.Avatar_GetList(), profile = service.Profile_Update(updating, User.Identity.Name), navSection = infastructure.PageStructure_GetBySelected(35) }; return View(model); }
public ActionResult UserProfile_Update(DUser_Profile updating) { return View("Index"); }
public ActionResult UserProfile_Delete(DUser_Profile deleting) { return View("Index"); }