示例#1
0
 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));
 }
示例#2
0
 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);
 }
示例#3
0
        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;
        }
示例#4
0
        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;
        }
示例#5
0
        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;
        }
示例#6
0
 public void DShape_WhenAskedForKey_ReturnsCountryID()
 {
     DShape shape = new DShape { Shape_ID = -1 };
     int key = shape.key;
     Assert.AreEqual(key, shape.Shape_ID);
 }
示例#7
0
 public void Shape_Update(DShape updating)
 {
     drawingService.Shape_Update(updating, User.Identity.Name);
 }
示例#8
0
 public void Shape_Delete(DShape deleting)
 {
     drawingService.Shape_Delete(deleting, User.Identity.Name);
 }
示例#9
0
 public void Shape_Create(DShape creating)
 {
     drawingService.Shape_Create(creating, User.Identity.Name);
 }