Exemple #1
0
 public void Create_Account_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var model = new Account("Tony", "123456");
         context.RegisterNew <Account, int>(model);
         context.Commit();
         Assert.AreNotEqual(0, model.Id);
     }
 }
Exemple #2
0
 public void Create_Member_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var account = context.Context.Set <Account>().Find(1);
         var model   = new Member(account, "Tony.xie", 24);
         context.RegisterNew <Member, Guid>(model);
         context.Commit();
         Assert.AreNotEqual(Guid.Empty, model.Id);
     }
 }
Exemple #3
0
 public void Update_CostType_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var model = context.Context.Set <CostType>().Find(1);
         model.ChangeName("生活消费");
         context.RegisterModified <CostType, int>(model);
         context.Commit();
         Assert.AreEqual("生活消费", model.Name);
     }
 }
Exemple #4
0
 public void Update_Account_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var model = context.Context.Set <Account>().Find(1);
         model.RegisterEmail = "*****@*****.**";
         context.RegisterModified <Account, int>(model);
         context.Commit();
         Assert.AreEqual("*****@*****.**", model.RegisterEmail);
     }
 }
Exemple #5
0
 public void Update_Expand_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var id    = Guid.Parse("20A7115F-2346-E411-8843-005056C00008");
         var model = context.Context.Set <Expand>().First(p => p.Id.Equals(id));
         model.Describtion = "水电费";
         context.RegisterModified <Expand, Guid>(model);
         context.Commit();
         Assert.AreEqual("水电费", model.Describtion);
     }
 }
Exemple #6
0
 public void Create_Expand_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var costType = context.Context.Set <CostType>().First(p => p.ParentType != null);
         var member   = context.Context.Set <Member>().First();
         var model    = new Expand(costType, 80, member, "");
         context.RegisterNew <Expand, Guid>(model);
         context.Commit();
         Assert.AreNotEqual(Guid.Empty, model.Id);
     }
 }
Exemple #7
0
 public void Create_CostType_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var model = new CostType("生活开支", null);
         model.AddChildType(new CostType("水电气费", model));
         model.AddChildType(new CostType("交通费", model));
         model.AddChildType(new CostType("日常开支", model));
         context.RegisterNew <CostType, int>(model);
         context.Commit();
         Assert.AreNotEqual(0, model.Id);
     }
 }
Exemple #8
0
 public void Update_Member_Test()
 {
     using (EntityframeworkContext context = new EntityframeworkContext())
     {
         var model = context.Context.Set <Member>().Find(Guid.Parse("81B0D18F-3243-E411-8282-005056C00008"));
         model.ChangeContact(new Contact()
         {
             Email = "*****@*****.**",
             QQ    = "350357474"
         });
         context.RegisterModified <Member, Guid>(model);
         context.Commit();
         Assert.AreEqual(model.Contact.Email, "*****@*****.**");
     }
 }
Exemple #9
0
 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);
     }
 }