Example #1
0
 public void DAddressWithSqlCity_WhenScrubbed_BecomesSafe()
 {
     string malicious = "<div>Hello, world!</div>');DROP TABLE dbo.Users;--";
     DAddress address = new DAddress { City = malicious };
     address.Scrub();
     Assert.AreNotEqual(address.City, malicious);
 }
Example #2
0
 public void DAddressWithHtmlStreet_WhenScrubbed_BecomesSafe()
 {
     string malicious = "<div>Hello, world!</div>";
     DAddress address = new DAddress { Street_Name = malicious};
     address.Scrub();
     Assert.AreNotEqual(address.Street_Name, malicious);
 }
Example #3
0
 public void DAddressWithHtmlAndSqlStreet_WhenScrubbed_BecomesSafe()
 {
     string malicious = "attribute');DROP TABLE dbo.Users;--";
     DAddress address = new DAddress { Street_Name = malicious };
     address.Scrub();
     Assert.AreNotEqual(address.Street_Name, malicious);
 }
        public IEnumerable<DContact> Address_Update(DAddress updating, string username)
        {
            IDataRepository<DContact> contacts =
                RepositoryFactory.Instance.Construct<DContact>(username);
            IDataRepository<DAddress> addresses;
            if ((addresses =
                    contacts.FirstOrDefault(x => x.Contact_ID == updating.Contact_ID)
                    .addresses as IDataRepository<DAddress>) != null){
                addresses.Update(updating);
            }

            return contacts;
        }
Example #5
0
 public ActionResult Address_Update(DAddress updating)
 {
     return View();
 }
Example #6
0
 public ActionResult Address_Delete(DAddress deleting)
 {
     return View();
 }
Example #7
0
 public ActionResult Address_Create(DAddress creating)
 {
     return View();
 }
Example #8
0
        public void DAddress_WhenComparedAgainstDAddressWithSameKey_IsEquivilant()
        {
            int key = 1;
            DAddress first = new DAddress { key = key };
            DAddress second = new DAddress { key = key };

            bool equal = first.Equivilant(second);
            Assert.AreEqual(true, equal);
        }
Example #9
0
 public void DAddress_WhenAssignedKey_ChangesAddressID()
 {
     int key = -1;
     DAddress address = new DAddress { key = key };
     Assert.AreEqual(key, address.Address_ID);
 }
Example #10
0
 public void DAddress_WhenAskedForKey_ReturnsAddressID()
 {
     DAddress address = new DAddress { Address_ID = -1 };
     int key = address.key;
     Assert.AreEqual(key, address.Address_ID);
 }