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

      // spawn the action
      IAction moveAction = new MoveShapesAction( _testShapes, oldPosition, newPosition);

      ResetPropertyChanged();
      moveAction.Do();
      Assert.AreEqual( newPosition[0], (_testShapes[0] as Shape3D).Position );
      Assert.AreEqual( newPosition[1], (_testShapes[1] as Shape3D).Position );
      Assert.AreEqual( true, _propertyChanged );

      ResetPropertyChanged();
      moveAction.Undo();
      Assert.AreEqual( oldPosition[0], (_testShapes[0] as Shape3D).Position );
      Assert.AreEqual( oldPosition[1], (_testShapes[1] as Shape3D).Position );
      Assert.AreEqual( true, _propertyChanged );

      ResetPropertyChanged();
      moveAction.Do();
      Assert.AreEqual( newPosition[0], (_testShapes[0] as Shape3D).Position );
      Assert.AreEqual( newPosition[1], (_testShapes[1] as Shape3D).Position );
      Assert.AreEqual( true, _propertyChanged );
		}
コード例 #2
0
        public void TestMove()
        {
            Vector3F[] oldPosition = _testShapes.StoreShapePositionArray();
              foreach (Shape3D shape in _testShapes)
            shape.Position = new Vector3F( 100.0f, 0.0f, 0.0f );

              Vector3F[] newPosition = _testShapes.StoreShapePositionArray();

              // spawn the action
              IAction moveAction = new MoveShapesAction( _testShapes, oldPosition, newPosition);

              ResetPropertyChanged();
              moveAction.Do();
              Assert.AreEqual( newPosition[0], (_testShapes[0] as Shape3D).Position );
              Assert.AreEqual( newPosition[1], (_testShapes[1] as Shape3D).Position );
              Assert.AreEqual( true, _propertyChanged );

              ResetPropertyChanged();
              moveAction.Undo();
              Assert.AreEqual( oldPosition[0], (_testShapes[0] as Shape3D).Position );
              Assert.AreEqual( oldPosition[1], (_testShapes[1] as Shape3D).Position );
              Assert.AreEqual( true, _propertyChanged );

              ResetPropertyChanged();
              moveAction.Do();
              Assert.AreEqual( newPosition[0], (_testShapes[0] as Shape3D).Position );
              Assert.AreEqual( newPosition[1], (_testShapes[1] as Shape3D).Position );
              Assert.AreEqual( true, _propertyChanged );
        }