Esempio n. 1
0
 public Exchange(Guid playerOutId, Guid playerInId, MatchMinute timeOfExchange)
 {
     if (IsValidInparameters(playerOutId, playerInId, timeOfExchange))
     {
         PlayerOutId    = playerOutId;
         PlayerInId     = playerInId;
         TimeOfExchange = timeOfExchange;
     }
 }
Esempio 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;
        }
Esempio 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);
     }
 }
Esempio 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);
        }