public void Create_MonthIncome_Test() { using (EntityframeworkContext context = new EntityframeworkContext()) { Member member = context.Context.Set <Member>().First(); var model = new MonthIncome(); model.AddItems(new List <IncomeItem>() { new IncomeItem(200, member, model), new IncomeItem(300, member, IncomeType.Other, model) }); context.RegisterNew <MonthIncome, Guid>(model); context.Commit(); Assert.AreNotEqual(Guid.Empty, model.Id); } }
public IncomeItem(double money, Member createBy, IncomeType incomeType, MonthIncome monthIncome) { if (money <= 0) { throw new Exception("money should be more than zero"); } if (createBy == null) { throw new Exception("createBy can't be null"); } if (monthIncome == null) { throw new Exception("monthIncome can't be null"); } this.Money = money; this.CreateBy = createBy; this.IncomeType = incomeType; this.MonthIncome = monthIncome; }
public IncomeItem(double money, Member createBy, MonthIncome monthIncome) : this(money, createBy, IncomeType.Salary, monthIncome) { }