Esempio n. 1
0
        public void ServiceLayer_User_INF_Test()
        {
            //Arrange
            var options = new DbContextOptionsBuilder <EfstoreContext>()
                          .UseInMemoryDatabase(databaseName: "WebstoreDB").Options;

            //ACT
            using (var op = new EfstoreContext(options))
            {
                userinformation sb = new userinformation();
                sb.id          = 1;
                sb.fullname    = "Hansen";
                sb.Address     = "Hansenvej 1";
                sb.dateofbirth = DateTime.Now;
                sb.CountryCode = 1100;
                sb.city        = "hansenberg";
                sb.gender      = "M";
                sb.paymentO    = "MasterCard";

                var PS = new UserinformationService(op);
                PS.Add(sb);

                //Assert
                // Use a separate instance of the context to verify correct data was saved to database
                using (var context = new EfstoreContext(options))
                {
                    Assert.AreEqual(1, context.userinformtation.Count());
                    Assert.AreEqual("hansenberg", context.userinformtation.Single().city);
                    Assert.AreNotEqual("ansenberg", context.userinformtation.Single().city);
                }

                {
                }
            }
        }
Esempio n. 2
0
        private userinformation GetUserInfOne(int i)
        {
            var context = new EfstoreContext();

            US = new UserinformationService(context);
            userinformation pd = US.GetuserinfById(i);

            return(pd);
        }
Esempio n. 3
0
        public userinformation GetuserinfById(int Id)
        {
            //var context = new EfstoreContext();
            //var SelectProduct = context.userinf
            //                                  .Select(x => x.id = Id)
            //                                  .ToList();
            userinformation pd = new userinformation();// SelectProduct.ToList<Userinformation>();

            return(pd);
        }
Esempio n. 4
0
        public userinformation Delete(int id)
        {
            userinformation m = GetuserinfById(id);

            if (m != null)
            {
                _ctx.userinformtation.Remove(m);
            }
            return(m);
        }
Esempio n. 5
0
        public userinformation one()
        {
            EfstoreContext efx = new EfstoreContext();
            // UserinformationService ser1 = new UserinformationService(efx);


            userinformation sb = new userinformation();
            ////sb.id = 1;
            //sb.fullname = "Hansen";
            //sb.Address = "Hansenvej 1";
            //sb.dateofbirth = DateTime.Now;
            //sb.CountryCode = 1100;
            //sb.city = "hansenberg";
            //sb.gender = "M";
            //sb.paymentO = "MasterCard";
            //ser1.Add(sb);

            ShopbasketService sb1 = new ShopbasketService(efx);

            sb1.Delete(0);

            return(sb);



            //Shopbasket sb = new Shopbasket();


            //IQueryable<Products> ps =       prod1.GetProductById(2);



            //var context = new EfstoreContext();
            //var studentsWithSameName = context.Products
            //                                  .Where(s => s.ClothingID == 2)
            //                                  .ToList();

            //List<Products> pd = studentsWithSameName.ToList<Products>();
        }
Esempio n. 6
0
        public userinformation Update(userinformation updateuserinf)
        {
            _ctx.userinformtation.Update(updateuserinf);

            return(updateuserinf);
        }
Esempio n. 7
0
 public userinformation Add(userinformation P)
 {
     _ctx.userinformtation.Add(P);
     Commit();
     return(P);
 }
Esempio n. 8
0
 static void Main(string[] args)
 {
     normal1         n = new normal1();
     userinformation d = n.one();
 }