public void Forbide_non_pharmacie() { var resolver = new ProducerSynonymResolver(1); var row = table.NewRow(); row["UEstatus"] = 1; row["UEFirmCr"] = "Производитель"; row["UEPriorCatalogId"] = 1; row["UEPriorProductId"] = 1; row["Pharmacie"] = false; table.Rows.Add(row); resolver.ForbidProducer(row); Assert.That(row["UEStatus"], Is.EqualTo(3.ToString())); }
public void CreateForbiddenProducerName() { var rnd = new Random(); var producerName = "testTest" + rnd.Next(); var product = new TestProduct("Тестовый Продукт"); var catalogProduct = product.CatalogProduct; catalogProduct.Pharmacie = true; product.Save(); var synonym = new TestProductSynonym("test", product, price); synonym.Save(); var producerSynonym = new TestProducerSynonym(producerName, null, price); producerSynonym.Save(); var expression = new TestUnrecExp(synonym, producerSynonym); expression.Save(); var notFormExpression = new TestUnrecExp("newTest", producerName, price); notFormExpression.Save(); Load(); resolver.ForbidProducer(GetRow(expression)); Save(); var query = session.CreateSQLQuery(String.Format("SELECT count(*) FROM farm.ForbiddenProducers F where F.Name='{0}'", producerName)); var count = query.UniqueResult(); Assert.That(count, Is.GreaterThan(0)); var exclude = session.Query <TestExclude>().Where(e => e.Price == price); Assert.That(exclude.Count(), Is.EqualTo(0)); var unrec = session.Query <TestUnrecExp>().Where(e => e.FirmCr.ToLower() == producerName && e.Status == 1); Assert.That(unrec.Count(), Is.EqualTo(0)); unrec = session.Query <TestUnrecExp>().Where(e => e.FirmCr.ToLower() == producerName); Assert.That(unrec.Count(), Is.GreaterThan(0)); }