public CatalogController() { Func <StoreDbEntities> createStoreContext = () => new StoreDbEntities(); var sqlRepository = new SqlCatalogRepository(createStoreContext); _catalogService = new CatalogService(sqlRepository); _licenseTypeService = new LicensingBasisService(); }
public void TestMethod1() { SqlCatalogRepository rep = new SqlCatalogRepository(); IQueryable <Category> qry = rep.GetCategories(); Assert.IsNotNull(qry); IList <Category> catList = (from c in qry where c.ID == 1 select c).ToList <Category>(); Assert.AreEqual(1, catList.Count); Assert.AreEqual("Category 1", catList[0].Name); }
public void SqlCatalogRepository_ShouldReturn_Categories_AsQueryable() { var rep = new SqlCatalogRepository(); var qry = rep.GetCategories(); Assert.NotNull(qry); var catList = (from c in qry where c.ID == 1 select c).ToList(); Assert.Single(catList); Assert.Equal(catList[0].Name, "category1"); }
public PurchaseController() { Func <StoreDbEntities> createStoreContext = () => new StoreDbEntities( ); var sqlRepository = new SqlPurchaseRecordRepository(createStoreContext); _purchaseService = new PurchaseService(sqlRepository); var sqlCatalogRepository = new SqlCatalogRepository(createStoreContext); _catalogService = new CatalogService(sqlCatalogRepository); _licensingService = new LicensingService(SoftwarePotentialConfiguration.File.ReadCredentials()); var sqlOrderItemRepository = new SqlOrderItemRepository(createStoreContext); _orderItemService = new OrderItemService(sqlOrderItemRepository); }