public void DShape_WhenComparedAgainstDShapeWithSameKey_IsEquivilant() { int key = 1; DShape first = new DShape { key = key }; DShape second = new DShape { key = key }; Assert.IsTrue(first.Equivilant(second)); }
public void DShapeWithHtmlAndSqlMembers_WhenScrubbed_RemainsTheSame() { string malicious = "attribute');DROP TABLE dbo.Users;--"; DShape shape = new DShape { Json = malicious }; shape.Scrub(); Assert.AreEqual(shape.Json, malicious); }
public IEnumerable<PShape> Shape_Delete(DShape deleting, string username) { IDataRepository<DImage> images = RepositoryFactory.Instance.Construct<DImage>(username); IDataRepository<DShape> shapes; //Shape is deleted from the shape repository belonging given to user and image. if ((shapes = images.FirstOrDefault(x => x.Image_ID == deleting.Image_ID && x.username == username).shapes as IDataRepository<DShape>) != null){ shapes.Delete(deleting); } return shapes; }
public IEnumerable<PShape> Shape_Create(DShape creating, string username) { IDataRepository<DImage> images = RepositoryFactory.Instance.Construct<DImage>(username); IDataRepository<DShape> shapes; //Finds first repository belonging to given user and image, then creates shape if ((shapes = images.FirstOrDefault(x => x.Image_ID == creating.Image_ID && x.username == username).shapes as IDataRepository<DShape>) != null){ shapes.Create(creating); } return shapes; }
public IEnumerable<PShape> Shape_Update(DShape updating, string username) { IDataRepository<DImage> images = RepositoryFactory.Instance.Construct<DImage>(username); IDataRepository<DShape> shapes; if ((shapes = images.FirstOrDefault(x => x.Image_ID == updating.Image_ID && x.username == username).shapes as IDataRepository<DShape>) != null){ shapes.Update(updating); } return shapes; }
public void DShape_WhenAskedForKey_ReturnsCountryID() { DShape shape = new DShape { Shape_ID = -1 }; int key = shape.key; Assert.AreEqual(key, shape.Shape_ID); }
public void Shape_Update(DShape updating) { drawingService.Shape_Update(updating, User.Identity.Name); }
public void Shape_Delete(DShape deleting) { drawingService.Shape_Delete(deleting, User.Identity.Name); }
public void Shape_Create(DShape creating) { drawingService.Shape_Create(creating, User.Identity.Name); }