public void BuildAccountingPeriodObjectSeperateMonthYearConstructorTest2(int MonthToTest, int YearToTest, int ShouldBeAccountingPeriod)
        {
            //grab the result
            var Result = new AccountingPeriod(MonthToTest, YearToTest);

            //test the month and year
            Assert.Equal(MonthToTest, Result.Month);
            Assert.Equal(YearToTest, Result.Year);

            //make sure the ToAccountingPeriod Works
            Assert.Equal(Result.ToAccountingPeriod(), ShouldBeAccountingPeriod);
        }
        public void BuildAccountingPeriodObjectIntConstructorTest1(int AccountingPeriodToTest, int ShouldBeMonth, int ShouldBeYear)
        {
            //go run the method and get the results
            var Result = new AccountingPeriod(AccountingPeriodToTest);

            //test the month and year
            Assert.Equal(ShouldBeMonth, Result.Month);
            Assert.Equal(ShouldBeYear, Result.Year);

            //make sure the ToAccountingPeriod Works
            Assert.Equal(Result.ToAccountingPeriod(), AccountingPeriodToTest);
        }
        /// <summary>
        /// Increments a period. Can add or subtract however many periods that is passed in
        /// </summary>
        /// <param name="AccountingPeriod">Accounting period to add too</param>
        /// <param name="HowManyPeriodsToAdd">How many periods to add. You can pass in -1 to subtract 1 period (will handle that)</param>
        /// <returns>New Period</returns>
        public static int IncrementPeriod(int AccountingPeriod, int HowManyPeriodsToAdd)
        {
            //first validate that the accounting period is legit (will throw an error if it fails)
            ValidateAccountingPeriod(AccountingPeriod);

            //let's split this out first
            var SplitOutPeriod = new AccountingPeriod(AccountingPeriod);

            //are we adding or subtracting
            if (HowManyPeriodsToAdd > 0)
            {
                //use the add period method
                return AddPeriod(SplitOutPeriod, HowManyPeriodsToAdd).ToAccountingPeriod();
            }

            //are we subtracting periods?
            if (HowManyPeriodsToAdd < 0)
            {
                //we are subtracting
                return SubtractPeriod(SplitOutPeriod, HowManyPeriodsToAdd).ToAccountingPeriod();
            }

            //HowManyPeriodsToAdd = 0...just return whatever was passed in
            return AccountingPeriod;
        }
        /// <summary>
        /// subtracts the accounting period by HowManyPeriodsToAdd periods.
        /// </summary>
        /// <param name="AccountingPeriodToSubtractTo">Accounting period to subtract to</param>
        /// <param name="HowManyPeriodsToSubtract">How many periods to subtract. You can pass in -1 to subtract 1 period (will handle that)</param>
        /// <returns>New Period</returns>
        private static AccountingPeriod SubtractPeriod(AccountingPeriod AccountingPeriodToSubtractTo, int HowManyPeriodsToSubtract)
        {
            //if we are are not adding then throw an error
            if (HowManyPeriodsToSubtract >= 0)
            {
                //throw an error because we aren't adding a period
                throw new ArgumentOutOfRangeException("Can't Use Subtract Period When You Want To Add A Period");
            }

            //since Accounting Period is immutable let's create a working month and a working year
            var WorkingMonth = AccountingPeriodToSubtractTo.Month;

            //grab the year now
            var WorkingYear = AccountingPeriodToSubtractTo.Year;

            //we want to loop through for each period we want to add
            for (int i = 0; i > HowManyPeriodsToSubtract; i--)
            {
                //are we up to january?
                if (WorkingMonth == 1)
                {
                    //we need to go to the previous year
                    WorkingYear -= 1;

                    //set the month to december
                    WorkingMonth = 12;
                }
                else
                {
                    //we just need to subtract the month (because we aren't in january)
                    WorkingMonth -= 1;
                }
            }

            //we just need to increment the month
            return new AccountingPeriod(WorkingMonth, WorkingYear);
        }
        /// <summary>
        /// Converts an accounting period to a date time object. Will set it to the first day of that month
        /// </summary>
        /// <param name="AccountingPeriod">Accounting Period To Convert</param>
        /// <returns>Date Time Object</returns>
        public static DateTime PeriodToDateTime(int AccountingPeriod)
        {
            //first validate the accounting period
            ValidateAccountingPeriod(AccountingPeriod);

            //go get the break down of this accounting period
            var Breakdown = new AccountingPeriod(AccountingPeriod);

            //go convert it and return it
            return new DateTime(Breakdown.Year, Breakdown.Month, 1);
        }