public TestGame(
     ZeroPositiveInt maxPlayersCount,
     ZeroPositiveInt minimalRequiredPlayersCount,
     DateTimeOffset gameDate, 
     string description, 
     DateTimeOffset registrationEndDate) 
     : base(maxPlayersCount, minimalRequiredPlayersCount, gameDate, description, registrationEndDate)
 {
 }
 public void CreatingCheck(int value, bool willSucceed)
 {
     if (willSucceed)
     {
         var zeroPositive = new ZeroPositiveInt(value);
         Assert.AreEqual(value, zeroPositive.Value);
     }
     else
     {
         Assert.Throws <BusinessLogicException>(() => new ZeroPositiveInt(value));
     }
 }
        public void EqualityCheck()
        {
            var firstZeroPositiveInt  = new ZeroPositiveInt(1);
            var secondZeroPositiveInt = new ZeroPositiveInt(1);

            Assert.AreEqual(firstZeroPositiveInt, secondZeroPositiveInt);

            var thirdZeroPositiveInt = new ZeroPositiveInt(2);

            Assert.AreNotEqual(firstZeroPositiveInt, thirdZeroPositiveInt);
            Assert.AreNotEqual(secondZeroPositiveInt, thirdZeroPositiveInt);

            var somethingElse = new SomeOtherClass();

            Assert.AreNotEqual(secondZeroPositiveInt, somethingElse);
        }
Пример #4
0
        protected ThirdGame(
            ZeroPositiveInt maxPlayersCount,
            ZeroPositiveInt minimalRequiredPlayersCount,
            DateTimeOffset gameDate,
            string description,
            DateTimeOffset registrationEndDate)
        {
            if (minimalRequiredPlayersCount.Value > maxPlayersCount.Value)
            {
                throw new BusinessLogicException($"Minimal required players count [{minimalRequiredPlayersCount.Value}] cannot be higher than max players count [{maxPlayersCount.Value}].");
            }

            Guid                        = Guid.NewGuid();
            MaxPlayersCount             = maxPlayersCount;
            MinimalRequiredPlayersCount = minimalRequiredPlayersCount;
            GameDate                    = gameDate;
            Description                 = description;
            RegistrationEndDate         = registrationEndDate;

            _playerRegistered = new List <PlayerRegisteredForGame>();
        }
 protected bool Equals(ZeroPositiveInt other)
 {
     return(Value == other.Value);
 }