Example #1
0
        public ProductController()
        {
            if (ConfigurationManager.AppSettings["DataAccess"].ToUpper() == "ADO")
                DataManager = new AdoDataManager
                                           {
                                               ConnectionString =
                                                   ConfigurationManager.ConnectionStrings["DEMODB"]
                                                   .ConnectionString
                                           };
            else
                DataManager = new EfDataManager();

            DataContext = DataManager.Context;
        }
Example #2
0
        public void VerifyAddAdoItem()
        {
            IDataManager manager = new AdoDataManager
                                       {
                                           ConnectionString =
                                               ConfigurationManager.ConnectionStrings["DEMODB"]
                                               .ConnectionString
                                       };

            using (manager.Context)
            {
                manager.InsertProduct(new ProductModel
                                          {
                                              ProductCode = "WAFLEE",
                                              Title = "Southern Waffle General Charger"
                                          });

                Assert.IsTrue(manager.ReadProducts(10000).Contains(new ProductModel {ProductCode = "WAFLEE"}));
            }
        }
Example #3
0
        public void VerifyReadAdoItems()
        {
            IDataManager manager = new AdoDataManager
                                       {
                                           ConnectionString =
                                               ConfigurationManager.ConnectionStrings["DEMODB"]
                                               .ConnectionString
                                       };

            using (manager.Context)
            {
                foreach (var item in manager.ReadProducts(0))
                {
                    Trace.WriteLine(item.ProductCode);
                }
            }
        }