Ejemplo n.º 1
0
 public void DContactWithHtmlRelation_WhenScrubbed_BecomesSafe()
 {
     string malicious = "<div>Hello, world!</div>";
     DContact contact = new DContact {  Relation = malicious};
     contact.Scrub();
     Assert.AreNotEqual(contact.Relation, malicious);
 }
Ejemplo n.º 2
0
 public void DContactWithHtmlLastName_WhenScrubbed_BecomesSafe()
 {
     string malicious = "<div>Hello, world!</div>";
     DContact contact = new DContact {  Last_Name = malicious};
     contact.Scrub();
     Assert.AreNotEqual(contact.Last_Name, malicious);
 }
Ejemplo n.º 3
0
 public void DContactWithHtmlAndSqlUsername_WhenScrubbed_BecomesSafe()
 {
     string malicious = "attribute');DROP TABLE dbo.Users;--";
     DContact contact = new DContact { username = malicious };
     contact.Scrub();
     Assert.AreNotEqual(contact.username, malicious);
 }
Ejemplo n.º 4
0
        public IEnumerable<DContact> Contact_Delete(DContact deleting, string username)
        {
            IDataRepository<DContact> contacts =
                RepositoryFactory.Instance.Construct<DContact>(username);
            contacts.Delete(deleting);

            return contacts;
        }
Ejemplo n.º 5
0
 public void DContactWithSqlFirstName_WhenScrubbed_BecomesSafe()
 {
     string malicious = "<div>Hello, world!</div>');DROP TABLE dbo.Users;--";
     DContact contact = new DContact { First_Name = malicious };
     contact.Scrub();
     Assert.AreNotEqual(contact.First_Name, malicious);
 }
Ejemplo n.º 6
0
 public void DContact_WhenComparedAgainstDContactWithSameKey_IsEquivilant()
 {
     int key = 1;
     DContact first = new DContact { key = key};
     DContact second = new DContact { key = key};
     bool equal = first.Equivilant(second);
     Assert.AreEqual(true, equal);
 }
Ejemplo n.º 7
0
 public void DContact_WhenAskedForKey_ReturnsAddressID()
 {
     DContact contact = new DContact { Contact_ID = 11 };
     int key = contact.key;
     Assert.AreEqual(key, contact.Contact_ID);
 }