コード例 #1
0
    public void TestRotate()
    {
      Vector3F[] oldOrientation = _testShapes.StoreShapeOrientationArray();
      Vector3F[] oldPosition = _testShapes.StoreShapePositionArray();
      foreach (Shape3D shape in _testShapes)
        shape.Orientation = new Vector3F( 100.0f, 0.0f, 0.0f );

      Vector3F[] newOrientation = _testShapes.StoreShapeOrientationArray();
      Vector3F[] newPosition = _testShapes.StoreShapePositionArray();
      IAction rotateAction = new RotateShapesAction( _testShapes, oldOrientation, newOrientation, oldPosition, newPosition);

      ResetPropertyChanged();
      rotateAction.Do();
      Assert.AreEqual( newOrientation[0], (_testShapes[0] as Shape3D).Orientation );
      Assert.AreEqual( newOrientation[1], (_testShapes[1] as Shape3D).Orientation );
      Assert.AreEqual( true, _propertyChanged );

      ResetPropertyChanged();
      rotateAction.Undo();
      Assert.AreEqual( oldOrientation[0], (_testShapes[0] as Shape3D).Orientation );
      Assert.AreEqual( oldOrientation[1], (_testShapes[1] as Shape3D).Orientation );
      Assert.AreEqual( true, _propertyChanged );

      ResetPropertyChanged();
      rotateAction.Do();
      Assert.AreEqual( newOrientation[0], (_testShapes[0] as Shape3D).Orientation );
      Assert.AreEqual( newOrientation[1], (_testShapes[1] as Shape3D).Orientation );
      Assert.AreEqual( true, _propertyChanged );
    }