public void Disabled_suppliers() { var supplier = DataMother.CreateSupplier(x => x.Name = Guid.NewGuid().ToString()); session.Save(supplier); Maintainer.MaintainIntersection(supplier, session); user.DisablePrice(session, supplier.Prices[0].Id); var result = filter.Find(true); Assert.That(result.Count, Is.GreaterThan(0)); result.Each(x => x.ForExport = true); var item = result.FirstOrDefault(x => x.UserId == user.Id.ToString()); Assert.IsNotNull(item, $"не найдена запись для пользователя {user.Id}"); Assert.AreEqual(item.DisabledSupName, supplier.Name); }
public void Check_proxy_for_validation_error() { var supplier = DataMother.CreateSupplier(); Save(supplier); session.Clear(); var item = session.Load <Supplier>(supplier.Id); Assert.That(item as INHibernateProxy, Is.Not.Null); item.Name = ""; Assert.That(validator.IsValid(item), Is.False); session.Clear(); item = session.Load <Supplier>(supplier.Id); Assert.That(item.Name, Is.EqualTo("Тестовый поставщик")); }
public void FormPositionFixture() { var supplier = DataMother.CreateSupplier(); var price = supplier.Prices[0]; var item = price.Costs[0].PriceItem; item.FormRule.FCode = "F1"; item.FormRule.Format = session.Query <PriceFormat>().First(f => f.FileExtention == ".dbf"); session.Save(supplier); Open("ManagerReports"); Click("Отчет о состоянии формализуемых полей в прайс-листах поставщиков"); AssertText("Отчет о состоянии формализуемых полей в прайс-листах поставщиков"); AssertText("Выгрузить в Excel"); Click("Показать"); AssertText(price.Id.ToString()); }
public void Do_not_register_duplicate_emails() { var supplier1 = DataMother.CreateSupplier(); supplier1.WaybillSource = new WaybillSource(supplier1); supplier1.WaybillSource.EMailFrom = "*****@*****.**"; session.Save(supplier1); session.Flush(); controller.Params["source.Emails[0]"] = "*****@*****.**"; Request.HttpMethod = "POST"; controller.WaybillSourceSettings(supplier.Id); Assert.IsFalse(Response.WasRedirected); Assert.AreEqual("Ошибка сохранения", (controller.PropertyBag["message"] ?? "").ToString()); Errors(supplier.WaybillSource); session.Clear(); }
public void UpdatePricesForClientTest() { var region = session.Query <Region>().First(); var supplier = DataMother.CreateSupplier(); session.Save(supplier); var client = DataMother.CreateTestClientWithAddressAndUser(); session.Save(client); var intersection = session.Query <Intersection>().First(i => i.Client == client && i.Price.PriceType != PriceType.Vip); intersection.AgencyEnabled = false; intersection.AvailableForClient = false; session.Save(intersection); var vipPrice = supplier.AddPrice("vip", PriceType.Vip); session.Save(vipPrice); var vipIntersection = new Intersection { Client = client, Region = region, Price = vipPrice, Org = client.GetLegalEntity().First(), AgencyEnabled = false, AvailableForClient = false }; session.Save(vipIntersection); session.CreateSQLQuery(@"delete from customers.userprices").ExecuteUpdate(); client.UpdatePricesForClient(session); session.Refresh(intersection); Assert.IsTrue(intersection.AgencyEnabled); Assert.IsTrue(intersection.AvailableForClient); session.Refresh(vipIntersection); vipIntersection = session.Get <Intersection>(vipIntersection.Id); Assert.IsTrue(vipIntersection.AgencyEnabled); Assert.IsFalse(vipIntersection.AvailableForClient); var usePricesCount = session.CreateSQLQuery(@" select count(*) from customers.userprices u where u.UserId = :userId ") .SetParameter("userId", client.Users[0].Id) .UniqueResult <long?>(); var intCount = session.Query <Intersection>().Count(i => i.Client == client); Assert.AreEqual(usePricesCount, intCount); }
public void SetUp() { supplier = DataMother.CreateSupplier(); Save(supplier); client = DataMother.CreateClientAndUsers(); session.SaveOrUpdate(client); Flush(); user = client.Users.First(); Assert.That(GetReplication(user.Id).Count, Is.EqualTo(0)); session .CreateSQLQuery("insert into Usersettings.AnalitfReplicationInfo(UserId, FirmCode, ForceReplication) values (:UserId, :SupplierId, 0)") .SetParameter("UserId", user.Id) .SetParameter("SupplierId", supplier.Id) .ExecuteUpdate(); }
public void Get_document_error_for_supplier() { var supplier = DataMother.CreateSupplier(); Save(supplier); var document = new DocumentReceiveLog(supplier); Save(document); Flush(); var filter = new DocumentFilter(); filter.Supplier = supplier; var documents = filter.Find(session); Assert.That(documents.Count, Is.GreaterThan(0)); Assert.That(documents.Any(d => d.Id == document.Id), Is.True, "должен быть {0} но есть {1}", document.Id, documents.Implode(d => d.Id)); }
public void Set_costs_noising_except_one_supplier() { var supplier = DataMother.CreateSupplier(); MakeNameUniq(supplier); Maintainer.MaintainIntersection(supplier, session); Refresh(); Css("#drugstore_NoiseCosts").Click(); var select = new SelectElement((RemoteWebElement)SearchV2("#drugstore_NoiseCostExceptSupplier_Id", supplier.Name)); Assert.That(select.SelectedOption.Text, Is.StringEnding(supplier.Name)); ClickButton("Сохранить"); AssertText("Сохранено"); session.Refresh(settings); Assert.That(settings.FirmCodeOnly, Is.EqualTo(supplier.Id)); }
public void Update_firm_code_only() { var client = DataMother.CreateTestClientWithUser(); var supplier = DataMother.CreateSupplier(); session.Save(supplier); client.Settings.NoiseCosts = true; session.SaveOrUpdate(client.Settings); Assert.That(client.Settings.FirmCodeOnly, Is.EqualTo(0)); client.Settings.NoiseCostExceptSupplier = supplier; session.SaveOrUpdate(client.Settings); Assert.That(client.Settings.FirmCodeOnly, Is.EqualTo(supplier.Id)); client.Settings.NoiseCosts = false; session.SaveOrUpdate(client.Settings); Assert.That(client.Settings.FirmCodeOnly, Is.Null); }
public void Delete_supplier() { var supplier = DataMother.CreateSupplier(); supplier.Disabled = true; var format = session.Query <PriceFormat>().First(); supplier.Prices[0].Costs[0].PriceItem.FormRule.Format = format; Save(supplier); Reopen(); supplier = session.Get <Supplier>(supplier.Id); Assert.That(supplier.CanDelete(session), Is.True); supplier.Delete(session); Reopen(); Assert.That(session.Get <Supplier>(supplier.Id), Is.Null); Assert.IsNotNull(session.Get <PriceFormat>(format.Id)); }
public void Check_default_smart_order_settings() { var supplier = DataMother.CreateSupplier(s => { s.Name = "Фармаимпекс"; s.FullName = "Фармаимпекс"; s.AddPrice("Матрица", PriceType.Assortment); }); Save(supplier); session.Save(new ParseAlgorithm("TextSource")); FlushAndCommit(); var price = SearchV2(Css("#drugstore_SmartOrderRules_AssortimentPriceCode_Id"), "Фармаимпекс"); Assert.That(price.SelectedItem, Is.EqualTo("Фармаимпекс - Матрица")); Click("Сохранить"); AssertText("Сохранено"); }
public void Search_by_type() { var supplier = DataMother.CreateSupplier(); var payer = supplier.Payer; Save(supplier); Flush(); var items = new PayerFilter(session) { SearchBy = SearchBy.Name, ClientType = SearchClientType.Supplier }.Find(); Assert.That(items.Count, Is.GreaterThan(0)); var result = items.FirstOrDefault(i => i.PayerId == payer.Id); Assert.That(result, Is.Not.Null, "не нашли плательщика {0}", payer.Id); }
public void NoParsedWaybillsReport() { var supplier = DataMother.CreateSupplier(); session.Save(supplier); var client = DataMother.CreateClientAndUsers(); session.Save(client); var documentLog = new DocumentReceiveLog(supplier); documentLog.ForClient = client; session.Save(documentLog); Open("ManagerReports"); Click("Отчет о состоянии неформализованных накладных по поставщикам"); AssertText("Отчет о состоянии неформализованных накладных по поставщикам"); AssertText("Кол-во нераспознанных накладных"); AssertText(supplier.Id.ToString()); AssertText(supplier.Name); }
public void Status_for_supplier() { var supplier = DataMother.CreateSupplier(); var payer = supplier.Payer; Save(supplier); Flush(); var items = new PayerFilter(session) { SearchBy = SearchBy.PayerId, SearchText = payer.Id.ToString(), }.Find(); Assert.That(items.Count, Is.EqualTo(1)); var result = items[0]; Assert.That(result.PayerId, Is.EqualTo(payer.Id)); Assert.That(result.IsDisabled, Is.False); }
public void Setup() { client = DataMother.CreateTestClientWithAddressAndUser(); payer = client.Payers.First(); payer.Name += payer.Id; session.SaveOrUpdate(payer); client.AddAddress("test address for billing"); user = client.Users[0]; address = client.Addresses[0]; session.SaveOrUpdate(client); _supplier = DataMother.CreateSupplier(); _supplier.Payer = payer; session.Save(_supplier); Open(payer); WaitForText("Плательщик"); AssertText("Плательщик"); }
public void SetUp() { session.CreateSQLQuery("delete from documents.Mails;").ExecuteUpdate(); Supplier = DataMother.CreateSupplier(); session.Save(Supplier); Client = DataMother.CreateTestClientWithAddressAndUser(); session.Save(Client); Mail = new Mail { LogTime = DateTime.Now, Supplier = Supplier, Subject = "testSubject", Body = "test body mail supplier", SupplierEmail = "*****@*****.**" }; Mail.Recipients.Add(new MailRecipient { Region = Supplier.HomeRegion, Mail = Mail, Type = RecipientType.Region }); Mail.Recipients.Add(new MailRecipient { Client = Client, Mail = Mail, Type = RecipientType.Client }); Mail.Recipients.Add(new MailRecipient { Address = Client.Addresses[0], Mail = Mail, Type = RecipientType.Address }); session.Save(Mail); session.Save(new Attachment { Filename = "testFileName", Extension = ".ttt", Mail = Mail }); var log1 = new MailSendLog { Committed = true, Mail = Mail, User = Client.Users[0] }; var log2 = new MailSendLog { Mail = Mail, User = Client.Users[0] }; Save(log1, log2); }
public void Unset_costs_noising() { var supplier = DataMother.CreateSupplier(s => { s.Payer = client.Payers.First(); }); Save(supplier); client.Settings.NoiseCosts = true; client.Settings.NoiseCostExceptSupplier = supplier; session.SaveOrUpdate(client.Settings); FlushAndCommit(); Refresh(); //ждем тк список для редактирования отображает js Assert.IsTrue(browser.CheckBox(Find.ByName("drugstore.NoiseCosts")).Checked); browser.CheckBox(Find.ByName("drugstore.NoiseCosts")).Checked = false; Thread.Sleep(1000); ClickButton("Сохранить"); AssertText("Сохранено"); session.Refresh(settings); Assert.That(settings.FirmCodeOnly, Is.Null); }
public void Copy_user_price_settings_with_ignore_new_price() { var supplier = DataMother.CreateSupplier(); session.Save(supplier); var client = DataMother.CreateTestClientWithUser(); client.Settings.IgnoreNewPriceForUser = true; var user = client.Users[0]; var price = supplier.AddPrice("Тестовый"); session.Flush(); client.MaintainIntersection(session); var count = session.CreateSQLQuery("select count(*) from Customers.UserPrices where userId = :userId and priceId = :priceId") .SetParameter("userId", user.Id) .SetParameter("priceId", price.Id) .UniqueResult <long>(); Assert.AreEqual(count, 1); }
public void Setup() { client = DataMother.CreateTestClientWithAddressAndUser(); user = client.Users[0]; address = client.Addresses[0]; supplier = DataMother.CreateSupplier(); session.SaveOrUpdate(client); session.Save(supplier); document = new DocumentReceiveLog(supplier) { FileName = "test.txt", ForClient = client, Address = address, }; sendLog = new DocumentSendLog(user, document); Save(document, sendLog); }
public void Add_parser_and_assortiment_price() { var supplier = DataMother.CreateSupplier(s => { s.Name = "Фармаимпекс"; s.FullName = "Фармаимпекс"; s.AddPrice("Матрица", PriceType.Assortment); }); Save(supplier); session.Save(new ParseAlgorithm("TextSource")); FlushAndCommit(); var parser = SearchV2(Css("#drugstore_SmartOrderRules_ParseAlgorithm"), "TextSource"); Assert.That(parser.SelectedItem, Is.EqualTo("TextSource")); var price = SearchV2(Css("#drugstore_SmartOrderRules_AssortimentPriceCode_Id"), "Фармаимпекс"); Assert.That(price.SelectedItem, Is.EqualTo("Фармаимпекс - Матрица")); Css("#drugstore_SmartOrderRules_ColumnSeparator").TypeText(@"\t"); Css("#drugstore_SmartOrderRules_CodePage").Select("windows-1251"); Css("#drugstore_SmartOrderRules_ProductColumn").TypeText("0"); Css("#drugstore_SmartOrderRules_QuantityColumn").TypeText("1"); Click("Сохранить"); AssertText("Сохранено"); Click("Настройка"); Assert.IsTrue(Css("#drugstore_EnableSmartOrder").Checked); AssertText("Фармаимпекс - Матрица"); AssertText("TextSource"); var rule = client.Settings.SmartOrderRules; session.Refresh(rule); Assert.AreEqual(@"\t", rule.ColumnSeparator); Assert.AreEqual(1251, rule.CodePage); Assert.AreEqual("0", rule.ProductColumn); Assert.AreEqual("1", rule.QuantityColumn); }
public void Search_supplier_after_reset() { var supplier1 = DataMother.CreateSupplier(); MakeNameUniq(supplier1); var supplier2 = DataMother.CreateSupplier(); MakeNameUniq(supplier2); FlushAndCommit(); Css("#ShowForOneSupplier").Click(); SearchSupplier(supplier1.Name); Assert.That(Css("#SupplierComboBox").Options.Count, Is.EqualTo(1)); Assert.That(Css("#SupplierComboBox").SelectedItem, Is.StringEnding(supplier1.Name)); Css("#ResetSupplierButton").Click(); SearchSupplier(supplier2.Name); Assert.That(Css("#SupplierComboBox").Options.Count, Is.EqualTo(1)); Assert.That(Css("#SupplierComboBox").SelectedItem, Is.StringEnding(supplier2.Name)); }
public void Batch_edit() { var supplier = DataMother.CreateSupplier(); Open("UserSearch/Search"); AssertText("Поиск пользователей"); Css("#filter_SearchText").SendKeys(supplier.Id.ToString()); Click("Поиск"); Click("Редактировать"); browser .FindElementsByCssSelector(".select-col input[type=checkbox]") .First(x => x.GetAttribute("value") == supplier.Id.ToString()).Click(); Click("Редактировать"); AssertText("Групповое редактирование"); Css("#data_FederalSupplier").SelectByText("Да"); Click("Сохранить"); AssertText("Сохранено"); session.Refresh(supplier); Assert.IsTrue(supplier.IsFederal); }
public void Setup() { client = DataMother.CreateTestClientWithAddressAndUser(); user = client.Users[0]; supplier = DataMother.CreateSupplier(); Save(supplier); BuildMail(); config = new AppConfig { AttachmentsPath = "../../../AdminInterface/Data/Attachments/" }; if (!Directory.Exists("../../../AdminInterface/Data")) { Directory.CreateDirectory("../../../AdminInterface/Data"); } if (!Directory.Exists(config.AttachmentsPath)) { Directory.CreateDirectory(config.AttachmentsPath); } }
public void ChangeOtherPricePropertiesAndNotChangedForceReplication() { var client = DataMother.CreateTestClientWithUser(); var user = client.Users[0]; var supplier = DataMother.CreateSupplier(); Save(supplier); var price = supplier.Prices[0]; session .CreateSQLQuery("insert into Usersettings.AnalitfReplicationInfo(UserId, FirmCode, ForceReplication) values (:UserId, :SupplierId, 0)") .SetParameter("UserId", user.Id) .SetParameter("SupplierId", supplier.Id) .ExecuteUpdate(); price.Name = price.Name + " 123"; Save(price); Flush(); CheckForceReplicationIsValue(supplier, false); }
public void Setup() { testClient = DataMother.CreateTestClientWithAddressAndUser(); var user = testClient.Users.First(); user.AvaliableAddresses.Add(testClient.Addresses.First()); session.Save(user); testSupplier = DataMother.CreateSupplier(); session.Save(testSupplier); var order = new ClientOrder(testClient.Users.First(), testSupplier.Prices[0]); session.Save(order); var product = new Product(session.Load <Catalog>(DataMother.CreateCatelogProduct())); var line = new OrderLine(order, product, 100, 1); session.Save(product); session.Save(line); session.Save(order); testSupplier = DataMother.CreateSupplier(); var documentLogEntity = DataMother.CreateTestDocumentLog(testSupplier, testClient); var updateLogEntity = DataMother.CreateTestUpdateLogEntity(testClient); documentLogEntity.DocumentType = DocumentType.Waybill; session.SaveOrUpdate(updateLogEntity); documentLogEntity.SendUpdateLogEntity = updateLogEntity; session.Save(documentLogEntity); var document = DataMother.CreateTestDocument(testSupplier, testClient, documentLogEntity); session.Save(document); session.Flush(); Open(testClient); AssertText("Клиент"); }
public void Show_all_show_current() { var supplier = DataMother.CreateSupplier(); var payer = supplier.Payer; var client = DataMother.TestClient(c => { c.Payers.Clear(); c.Payers.Add(payer); c.AddUser(new User(c) { Name = "Тестовый пользователь", }); }); MakeNameUniq(supplier); session.SaveOrUpdate(client); Open(payer); Click(supplier.Name); var table = GetLogTable(); var row = GetRow(table, supplier.Name); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("table-row")); row = GetRow(table, "Тестовый пользователь"); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("none")); Click("Показать для всех"); row = GetRow(table, supplier.Name); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("table-row")); row = GetRow(table, "Тестовый пользователь"); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("table-row")); Click("Показать только для текущего"); row = GetRow(table, supplier.Name); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("table-row")); row = GetRow(table, "Тестовый пользователь"); Assert.That(row.Style.GetAttributeValue("display"), Is.EqualTo("none")); }
public void SetUp() { _client = DataMother.CreateTestClientWithAddressAndUser(); _user = _client.Users[0]; _address = _client.Addresses[0]; _supplier = DataMother.CreateSupplier(); session.Save(_client); session.Save(_supplier); _document = new DocumentReceiveLog(_supplier) { FileName = "test.txt", ForClient = _client, Address = _address, }; session.Save(_document); referer = "http://ya.ru"; _controller = new LogsController(); Prepare(_controller); }
public void After_user_moving_must_be_entries_in_UserPrices() { var supplier = DataMother.CreateSupplier(s => s.AddRegion(session.Load <Region>(16UL), session)); Save(supplier); var maskRegion = 1UL | 16UL; var newClient = DataMother.CreateTestClientWithAddressAndUser(maskRegion); var oldCountUserPrices = user.GetUserPriceCount(session); Open(user, "edit"); browser.TextField(Find.ById("TextForSearchClient")).TypeText(newClient.Id.ToString()); browser.Button(Find.ById("SearchClientButton")).Click(); Thread.Sleep(2000); ClickButton("Переместить"); AssertText("Пользователь успешно перемещен"); var newCountUserPricesEntries = user.GetUserPriceCount(session); Assert.That(oldCountUserPrices, Is.LessThan(newCountUserPricesEntries)); Assert.That(GetCountUserPricesForRegion(user.Id, 16UL), Is.GreaterThan(0)); }
public void Register_client_for_supplier() { var supplier = DataMother.CreateSupplier(); Save(supplier); supplier.Name = "Тестовый поставщик " + supplier.Id; Save(supplier); FlushAndCommit(); SetupGeneralInformation(); Css("#ShowForOneSupplier").Checked = true; Assert.That(Css("#PayerExists").Enabled, Is.False); Css("#SearchSupplierTextPattern").TypeText(supplier.Name); Css("#SearchSupplierButton").Click(); WaitForText(supplier.Name); Assert.That(browser.Text, Is.StringContaining(supplier.Name), "не нашли поставщика"); browser.SelectList(Find.ById("SupplierComboBox")).Select(String.Format("{0}. {1}", supplier.Id, supplier.Name)); Assert.That(Css("#options_FillBillingInfo").Enabled, Is.False); Assert.That(Css("#SelectSupplierDiv").Style.Display, Is.EqualTo("block")); Assert.That(Css("#SearchSupplierDiv").Style.Display, Is.EqualTo("none")); Assert.That(Css("#SupplierComboBox").AllContents.Count, Is.GreaterThan(0)); Assert.That(Css("#SupplierComboBox").SelectedItem.Length, Is.GreaterThan(0)); Css("#options_SendRegistrationCard").Click(); Click("Зарегистрировать"); var client = GetRegistredClient(); var settings = client.Settings; Assert.That(settings.NoiseCosts, Is.True); Assert.That(settings.NoiseCostExceptSupplier.Id, Is.EqualTo(supplier.Id)); Assert.That(settings.InvisibleOnFirm, Is.EqualTo(DrugstoreType.Hidden)); Assert.That(settings.FirmCodeOnly, Is.EqualTo(supplier.Id)); }
public void Update_orders() { var supplier = DataMother.CreateSupplier(); var newClient = DataMother.TestClient(); var client = DataMother.CreateTestClientWithAddressAndUser(); var user = client.Users[0]; var address = client.Addresses[0]; user.AvaliableAddresses.Add(address); var query = new UpdateOrders(newClient, user, address); var order = new ClientOrder(user, supplier.Prices[0]); var product = new Product(session.Load <Catalog>(DataMother.CreateCatelogProduct())); var line = new OrderLine(order, product, 100, 1); Save(supplier, product, line, order); query.Execute(session); session.Refresh(order); Assert.That(order.Client, Is.EqualTo(newClient)); }