public void SetUp() { session.CreateQuery(@"delete SupplierPromotion").ExecuteUpdate(); _supplier = CreateSupplier(); _catalog = FindFirstFreeCatalog(); _promotion = CreatePromotion(_supplier, _catalog); _promotionWithFile = CreatePromotion(_supplier, _catalog, withFile: true); _promotionNotModerated = CreatePromotion(_supplier, _catalog, false); Open(); Click("Промо-акции"); AssertText("Список акций"); }
private SupplierPromotion CreatePromotion(PromotionOwnerSupplier supplier, Catalog catalog, bool moderated) { var supplierPromotion = new SupplierPromotion { Enabled = true, PromotionOwnerSupplier = supplier, Annotation = catalog.Name, Name = catalog.Name, Begin = DateTime.Now.Date.AddDays(-7), End = DateTime.Now.Date, Moderated = moderated, Catalogs = new List <Catalog> { catalog } }; supplierPromotion.UpdateStatus(); session.Save(supplierPromotion); return(supplierPromotion); }
private SupplierPromotion CreatePromotion(PromotionOwnerSupplier supplier, Catalog catalog, bool moderated = true, bool withFile = false) { var supplierPromotion = new SupplierPromotion { Enabled = true, PromotionOwnerSupplier = supplier, Annotation = catalog.Name, Name = catalog.Name, Begin = DateTime.Now.Date.AddDays(-7), End = DateTime.Now.Date.AddDays(1), Moderated = moderated, Catalogs = new List <Catalog> { catalog } }; if (withFile) { supplierPromotion.PromoFile = "testName.jpg"; } supplierPromotion.UpdateStatus(); session.Save(supplierPromotion); return(supplierPromotion); }