Beispiel #1
0
            /// <summary>
            /// Records the connector's state change.
            /// </summary>
            /// <param name="change">Arguments that describes a change.</param>
            private void AddConnectionChange(ConnectedChangedEventArgs change)
            {
                if (this._connectionChanges == null)
                {
                    this._connectionChanges = new List <ConnectedChangedEventArgs>();
                }

                this._connectionChanges.Add(change);
            }
        /// <summary>
        /// Raises the event <see cref="ConnectedChanged"/>.
        /// </summary>
        /// <param name="e">The object with event's arguments.</param>
        private void OnConnectedChanged(ConnectedChangedEventArgs e)
        {
            var connectedChanged = this.ConnectedChanged;

            if (connectedChanged != null)
            {
                connectedChanged(this, e);
            }
        }
        public void RaisesConnectedChangedOnMoveConnected()
        {
            var connected1 = new object();
            var connected2 = new object();

            IItemsPlacementConnector connector = this.CreateTestObject();

            connector.Connect(connected1);
            connector.Connect(connected2);

            ConnectedChangedEventArgs args = null;

            connector.ConnectedChanged += (sender, e) => args = e;

            connector.MoveConnected(connected1, 1);
            Assert.AreEqual(ConnectedChangedAction.Move, args.Action);
            Assert.AreEqual(connected1, args.Changed);

            connector.MoveConnected(connected2, 1);
            Assert.AreEqual(ConnectedChangedAction.Move, args.Action);
            Assert.AreEqual(connected2, args.Changed);
        }