Exemplo n.º 1
0
 public Exchange(Guid playerOutId, Guid playerInId, MatchMinute timeOfExchange)
 {
     if (IsValidInparameters(playerOutId, playerInId, timeOfExchange))
     {
         PlayerOutId    = playerOutId;
         PlayerInId     = playerInId;
         TimeOfExchange = timeOfExchange;
     }
 }
Exemplo n.º 2
0
        public Event(Guid playerId, MatchMinute timeOfEvent)
        {
            if (playerId == Guid.Empty)
            {
                throw new ArgumentException($"{nameof(playerId)} cannot be an empty Guid.");
            }

            PlayerId    = playerId;
            TimeOfEvent = timeOfEvent;
        }
Exemplo n.º 3
0
 public static bool TryParse(int minute, out MatchMinute result)
 {
     try
     {
         result = new MatchMinute(minute);
         return(true);
     }
     catch (ArgumentException)
     {
         result = null;
         return(false);
     }
 }
Exemplo n.º 4
0
        private bool IsValidInparameters(Guid playerOutId, Guid playerInId, MatchMinute timeOfExchange)
        {
            if (playerOutId == Guid.Empty)
            {
                throw new ArgumentException($"{nameof(playerOutId)} cannot be an empty Guid.");
            }
            if (playerInId == Guid.Empty)
            {
                throw new ArgumentException($"{nameof(playerInId)} cannot be an empty Guid.");
            }
            if (0 > timeOfExchange.Value || timeOfExchange.Value > MatchMinute.MaxValue)
            {
                throw new ArgumentOutOfRangeException($"{nameof(timeOfExchange)} must be between 0 and {MatchMinute.MaxValue}");
            }

            return(true);
        }