Example #1
0
        public void CreateDraft()
        {
            // Arrange
            IShapeFactory shapeFactory = new ShapeFactory();
            var           designer     = new Designer.Designer(shapeFactory);

            var shapeDecriptions = new List <string>
            {
                "Triangle red 0 0 1 0 1 1",
                "RegularPolygon yellow 3 2 0 0"
            };

            // Act
            PictureDraft     draft  = designer.CreateDraft(shapeDecriptions);
            List <BaseShape> shapes = draft?.Shapes;

            // Assert
            Assert.NotNull(shapes);
            Assert.Equal(2, draft.Shapes.Count);
            Assert.Contains(shapes, s => s.GetType() == typeof(Triangle));
            Assert.Contains(shapes, s => s.GetType() == typeof(RegularPolygon));
        }
Example #2
0
 private void designLevel(object sender, EventArgs e)
 {
     string levelToLoad = "";
     string levelID = "";
     if (sender == this.custom1Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv1;
         levelID = "customlv1";
     }
     else if (sender == this.custom2Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv2;
         levelID = "customlv2";
     }
     else if (sender == this.custom3Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv3;
         levelID = "customlv3";
     }
     else if (sender == this.custom4Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv4;
         levelID = "customlv4";
     }
     else if (sender == this.custom5Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv5;
         levelID = "customlv5";
     }
     else if (sender == this.custom6Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv6;
         levelID = "customlv6";
     }
     else if (sender == this.custom7Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv7;
         levelID = "customlv7";
     }
     else if (sender == this.custom8Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv8;
         levelID = "customlv8";
     }
     else if (sender == this.custom9Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv9;
         levelID = "customlv9";
     }
     else if (sender == this.custom10Btn)
     {
         levelToLoad = Properties.Levels.Default.customlv10;
         levelID = "customlv10";
     }
     this.Close();
     Designer.Designer design = new Designer.Designer(formulier, levelToLoad,levelID);
     design.Show();
 }