/// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked             // Overflow is fine, just wrap
            {
                int hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + EnergyCubes.GetHashCode();

                hashCode = hashCode * 59 + Health.GetHashCode();

                hashCode = hashCode * 59 + Active.GetHashCode();

                hashCode = hashCode * 59 + Virtual.GetHashCode();

                hashCode = hashCode * 59 + Priority.GetHashCode();

                hashCode = hashCode * 59 + OnTurn.GetHashCode();

                hashCode = hashCode * 59 + IsMine.GetHashCode();

                hashCode = hashCode * 59 + HandCards.GetHashCode();

                hashCode = hashCode * 59 + Attitude.GetHashCode();

                hashCode = hashCode * 59 + Type.GetHashCode();
                return(hashCode);
            }
        }
        /// <summary>
        ///     Returns true if RobotInfoAllOf instances are equal
        /// </summary>
        /// <param name="other">Instance of RobotInfoAllOf to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RobotInfoAllOf other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     EnergyCubes == other.EnergyCubes ||
                     EnergyCubes.Equals(other.EnergyCubes)
                     ) &&
                 (
                     Health == other.Health ||
                     Health.Equals(other.Health)
                 ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     Virtual == other.Virtual ||
                     Virtual.Equals(other.Virtual)
                 ) &&
                 (
                     Priority == other.Priority ||
                     Priority.Equals(other.Priority)
                 ) &&
                 (
                     OnTurn == other.OnTurn ||
                     OnTurn.Equals(other.OnTurn)
                 ) &&
                 (
                     IsMine == other.IsMine ||
                     IsMine.Equals(other.IsMine)
                 ) &&
                 (
                     HandCards == other.HandCards ||
                     HandCards.Equals(other.HandCards)
                 ) &&
                 (
                     Attitude == other.Attitude ||
                     Attitude.Equals(other.Attitude)
                 ) &&
                 (
                     Type == other.Type ||
                     Type.Equals(other.Type)
                 ));
        }
Exemplo n.º 3
0
        public void ObsorveIfMine()
        {
            // Arrange
            Board board = new Board(4, 5);
            Point pos   = new Point(2, 2);
            Mine  mine  = new Mine()
            {
                Position = pos
            };

            board[pos] = mine;
            Observer observer = new Observer(board);

            // Act
            IsMine actual = observer.Observe(pos) as IsMine;

            // Assert
            Assert.IsInstanceOfType(actual, typeof(IsMine));
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Returns true if RobotInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of RobotInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RobotInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||
                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Id == other.Id ||
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Location == other.Location ||
                     Location != null &&
                     Location.Equals(other.Location)
                 ) &&
                 (
                     EnergyCubes == other.EnergyCubes ||
                     EnergyCubes.Equals(other.EnergyCubes)
                 ) &&
                 (
                     Health == other.Health ||
                     Health.Equals(other.Health)
                 ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     Virtual == other.Virtual ||
                     Virtual.Equals(other.Virtual)
                 ) &&
                 (
                     Priority == other.Priority ||
                     Priority.Equals(other.Priority)
                 ) &&
                 (
                     OnTurn == other.OnTurn ||
                     OnTurn.Equals(other.OnTurn)
                 ) &&
                 (
                     IsMine == other.IsMine ||
                     IsMine.Equals(other.IsMine)
                 ) &&
                 (
                     HandCards == other.HandCards ||
                     HandCards.Equals(other.HandCards)
                 ) &&
                 (
                     Attitude == other.Attitude ||
                     Attitude.Equals(other.Attitude)
                 ) &&
                 (
                     Type == other.Type ||
                     Type.Equals(other.Type)
                 ));
        }
Exemplo n.º 5
0
 public override string ToString()
 {
     return(String.Format("GameTileModel {{ IsMine : %s, IsFlagged : %s, IsSelected: %s }}", IsMine.ToString(), IsFlagged.ToString(), IsSelected.ToString()));
 }