Beispiel #1
0
 /// <summary>
 /// Compare to another <see cref="LocalDate"/>
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 int IComparable.CompareTo(object obj)
 {
     if (obj == null)
     {
         return(1);
     }
     Checks.CheckArgument(obj is LocalDate, nameof(obj), "Object must be of type NodaTime.LocalDate.");
     return(CompareTo(new BadiDate((LocalDate)obj)));
 }
Beispiel #2
0
        /// <summary>
        ///     Add items to checkout.
        /// </summary>
        /// <param name="amount">The item amount.</param>
        /// <param name="item">The item for checkout.</param>
        public void AddItem(int amount, Item item)
        {
            Checks.CheckArgumentNotNull(item, "Item can't be null.");
            Checks.CheckArgument(amount > 0, "Amount must be > 0.");

            if (items.TryGetValue(item, out var currentAmount))
            {
                items[item] = currentAmount + amount;
            }
            else
            {
                items.Add(item, amount);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Constructor for specific year
 /// </summary>
 /// <param name="year"></param>
 public BadiYearInfo(int year)
 {
     Checks.CheckArgument(year >= _calendarSystem.MinYear && year <= _calendarSystem.MaxYear, nameof(year), "Year out of supported range");
     _year = year;
 }
Beispiel #4
0
        public void CheckArgument()
        {
            Checks.CheckArgument("a" == "a", "Test1", "Okay");

            Assert.Throws <ArgumentException>(() => Checks.CheckArgument("a" == "b", "Test2", "Should Fail"));
        }