/// <summary> /// Returns true if CreatePaymentResult instances are equal /// </summary> /// <param name="other">Instance of CreatePaymentResult to be compared</param> /// <returns>Boolean</returns> public bool Equals(CreatePaymentResult other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( CreationOutput == other.CreationOutput || CreationOutput != null && CreationOutput.Equals(other.CreationOutput) ) && ( MerchantAction == other.MerchantAction || MerchantAction != null && MerchantAction.Equals(other.MerchantAction) ) && ( Payment == other.Payment || Payment != null && Payment.Equals(other.Payment) )); }
public CreationOutput StartGame(int person1, int person2, int size) { CreationOutput output = new CreationOutput(); if (person1 > 0 && person2 > 0 && person2 == person1 & size > 1) { output.Message = "Invalid Details"; return(output); } if (!gamesService.IsGameValid(person1, person2)) { output.Message = "Player is already playing"; return(output); } GameStatus gameStatus = new GameStatus() { Person1 = person1, Person2 = person2, BoardSize = size, Board = new int[size, size], PlayerTurn = person2, PlayerMoves = new Dictionary <int, List <Coordinate> >() }; gameStatus.PlayerMoves.Add(person1, new List <Coordinate>()); gameStatus.PlayerMoves.Add(person2, new List <Coordinate>()); var guid = gamesService.AddGame(gameStatus); output.Message = "Game is started, GameId : " + guid; output.Guid = guid; return(output); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (CreationOutput != null) { hashCode = hashCode * 59 + CreationOutput.GetHashCode(); } if (MerchantAction != null) { hashCode = hashCode * 59 + MerchantAction.GetHashCode(); } if (Payment != null) { hashCode = hashCode * 59 + Payment.GetHashCode(); } return(hashCode); } }