public Fund Build()
        {
            Fund fund = null;

            if (_parentFund != null)
            {
                fund                 = new Fund(_parentFund, _name, _fundBalance);
                fund.Duration        = _parentFund.Duration;
                fund.User            = _parentFund.User;
                fund.ParentFund      = _parentFund;
                _parentFund.SubFunds = _parentFund.SubFunds?.Append(fund) ?? new List <Fund>()
                {
                    fund
                };
                fund.Id = _id;
            }
            else
            {
                BudgetDurationBase budgetDuration = _durationBuilder.Build();
                fund = new Fund(
                    _id,
                    _name,
                    _fundBalance,
                    budgetDuration,
                    _ownerId
                    );
            }

            if (_owner != null)
            {
                fund.User = _owner;
            }

            return(fund);
        }
        public void Test_SetAmountDefaultsTo0_WhenCreatingBudget()
        {
            IBudgetDurationBuilder durationBuilder = _builderFactoryFixture.GetService <BudgetDurationBuilderProvider>().GetBuilder <MonthlyBookEndedDuration>();
            BudgetDurationBase     randomDuration  = durationBuilder.Build();
            Fund     fund = _builderFactoryFixture.FundBuilder.Build();
            DateTime now  = DateTime.Now;

            Budget subject = new Budget(
                fund,
                new BudgetPeriod(now, fund.Duration.GetEndDateFromStartDate(now))
                );

            decimal expectedDefaultSetAmount = 0;

            Assert.Equal(expectedDefaultSetAmount, subject.SetAmount);
        }