예제 #1
0
        public void XYOrientation_ValidXYOStringInput_IsCorrect()
        {
            var xyo = XYOrientation.FromString("(3,4,D)");

            Assert.AreEqual(3, xyo.X);
            Assert.AreEqual(4, xyo.Y);
            Assert.AreEqual(Orientation.Down, xyo.Orientation);
        }
예제 #2
0
        public void XYOrientation_ValidXYStringInput_IsCorrect()
        {
            var xyo = XYOrientation.FromString("(1,2)");

            Assert.AreEqual(1, xyo.X);
            Assert.AreEqual(2, xyo.Y);
            Assert.AreEqual(Orientation.None, xyo.Orientation);
        }
예제 #3
0
 private static XYOrientation GetXYOrientation(string placement, Orientation defaultOrientation)
 {
     try
     {
         var loc = XYOrientation.FromString(placement);
         return(loc.Orientation.Equals(Orientation.None)
             ? new XYOrientation(loc.X, loc.Y, defaultOrientation)
             : loc);
     }
     catch (Exception e)
     {
         throw new ArgumentException($"Invalid placement: {placement}", e);
     }
 }
 private ObjectInstruction Create(string objName, string xyo)
 {
     return(new ObjectInstruction(objName, XYOrientation.FromString(xyo)));
 }
예제 #5
0
 public void XYOrientation_InvalidStringInputs_ThrowsArgumentException()
 {
     ExceptionAssert.Throws(() => XYOrientation.FromString(""));
     ExceptionAssert.Throws(() => XYOrientation.FromString("12"));
 }
예제 #6
0
 public ObjectInstruction(string objectName, XYOrientation placement)
 {
     ObjectName = objectName;
     Location   = placement;
 }