public void Setup() { prices = new List <TestPrice>(); using (new SessionScope()) { var supplier = TestSupplier.Create(); var price = supplier.Prices[0]; var cost = price.Costs[0]; cost.Name = "116"; priceItem = cost.PriceItem; priceItem.Format.PriceFormat = PriceFormatType.FarmaimpeksXml; price.SaveAndFlush(); prices.Add(price); price.CreateAssortmentBoundSynonyms("Аспирин-С №10 таб.шип.", "Bayer AG, Франция"); price.CreateAssortmentBoundSynonyms("Абактал 400мг №10 таб.п/о", "Lek, Словения"); price = new TestPrice(supplier) { CostType = CostType.MultiColumn, ParentSynonym = price.Id, }; cost = price.Costs[0]; cost.Name = "2"; price.SaveAndFlush(); supplier.Maintain(); prices.Add(price); } }
public void Hide_header() { var supplier1 = TestSupplier.Create(session); supplier1.CreateSampleCore(session); var supplier2 = TestSupplier.Create(session); supplier2.CreateSampleCore(session); var client = TestClient.Create(session); Property("ReportType", 2); Property("RegionEqual", new List <ulong> { 1 }); Property("ClientCode", client.Id); Property("ReportIsFull", false); Property("ReportSortedByPrice", false); Property("ShowPercents", true); Property("CalculateByCatalog", false); Property("PriceCode", (int)supplier1.Prices[0].Id); Property("ByWeightCosts", false); Property("HideHeader", true); TryInitReport <SpecReport>(); var sheet = ReadReport(); var text = ToText(sheet); Assert.That(text, Does.Not.Contains("Специальный отчет по взвешенным ценам по данным на")); Assert.That(text, Does.Not.Contains(supplier2.Name)); }
public static List <DocumentReceiveLog> GetFilesForParsing(ISession session, params string[] filePaths) { var client = TestClient.Create(session); var supplier = TestSupplier.Create(session); var resultList = new List <uint>(); foreach (var filePath in filePaths) { var file = filePath; if (!File.Exists(file)) { file = Path.Combine(@"..\..\Data\Waybills\multifile", filePath); } var log = new TestDocumentLog(supplier, client, Path.GetFileName(filePath)); session.Save(log); resultList.Add(log.Id); var clientDir = Path.Combine(Settings.Default.DocumentPath, log.Address.Id.ToString().PadLeft(3, '0')); var documentDir = Path.Combine(clientDir, DocumentType.Waybill + "s"); var name = String.Format("{0}_{1}({2}){3}", log.Id, supplier.Name, Path.GetFileNameWithoutExtension(file), Path.GetExtension(file)); Common.Tools.FileHelper.CreateDirectoryRecursive(documentDir); File.Copy(file, Path.Combine(documentDir, name)); } return(DocumentReceiveLog.LoadByIds(resultList.ToArray())); }
public void Hide_all_except4() { var supplier1 = TestSupplier.Create(session); supplier1.CreateSampleCore(session); var supplier2 = TestSupplier.Create(session); supplier2.CreateSampleCore(session); var client = TestClient.Create(session); Property("ReportType", 3); Property("RegionEqual", new List <ulong> { 1 }); Property("ClientCode", client.Id); Property("ReportIsFull", false); Property("ReportSortedByPrice", false); Property("ShowPercents", false); Property("CalculateByCatalog", false); Property("PriceCode", (int)supplier1.Prices[0].Id); Property("ByWeightCosts", false); Property("HideHeader", false); Property("HideAllExcept4", true); TryInitReport <SpecReport>(); var sheet = ReadReport(); var text = ToText(sheet); Assert.That(text, Does.Not.Contains("Макс. цена")); }
public void Setup() { CertificateSource.Assembly = typeof(AptekaHoldingVoronezhCertificateSource).Assembly; testSupplier = TestSupplier.Create(); supplier = Supplier.Find(testSupplier.Id); }
public void SetUp() { var supplier = TestSupplier.Create(); _testPrice = supplier.Prices[0]; _testPrice.Costs[0].FormRule.FieldName = "name"; _testPrice.Costs[0].PriceItem.Format.PriceEncode = 1251; session.Save(_testPrice); session.Save(_testPrice.Costs[0].PriceItem.Format); }
public void Setup() { var supplier = TestSupplier.Create(); supplier.Prices[0].CostType = CostType.MultiFile; supplier.Save(); form = new frmFREMain(); form.Form1_Load(form, null); }
public void ParseEmptySerialNumber() { DeleteCertificatedWithEmptySerialNumber(); var catalogProduct = new Catalog { Id = 1, Name = "catalog1" }; var testSupplier = TestSupplier.Create(); var docSupplier = Supplier.Find(testSupplier.Id); var certificateSource = CreateRealSourceForSupplier(docSupplier); var product = new Product { Id = 3, CatalogProduct = catalogProduct }; var document = new Document { FirmCode = docSupplier.Id }; document.NewLine(new DocumentLine { ProductEntity = product, SerialNumber = null, CertificateFilename = "cerFilename" }); document.NewLine(new DocumentLine { ProductEntity = product, SerialNumber = "", CertificateFilename = "cerFilename" }); document.NewLine(new DocumentLine { ProductEntity = product, SerialNumber = " ", CertificateFilename = "cerFilename" }); document.NewLine(new DocumentLine { ProductEntity = product, SerialNumber = "-", CertificateFilename = "cerFilename" }); document.NewLine(new DocumentLine { ProductEntity = product, SerialNumber = " - ", CertificateFilename = "cerFilename" }); CertificateSourceDetector.DetectAndParse(document); Assert.That(document.Tasks.Count, Is.EqualTo(5)); Assert.That(document.Tasks.TrueForAll(t => t.CertificateSource.Id == certificateSource.Id)); var task = document.Tasks[0]; Assert.That(task.CatalogProduct.Id == catalogProduct.Id && task.SerialNumber == DocumentLine.EmptySerialNumber); }
public void SetUp() { orders = new List <OrderHead>(); client = TestClient.Create(session); var testAddress = client.Addresses[0]; address = Address.Find(testAddress.Id); var supplier = TestSupplier.Create(session); price = supplier.Prices[0]; appSupplier = Supplier.Find(supplier.Id); }
public void Setup() { session.CreateSQLQuery("delete from logs.document_logs").ExecuteUpdate(); var supplier = TestSupplier.Create(session); supplier.WaybillSource.SourceType = TestWaybillSourceType.FtpInforoom; supplier.WaybillSource.ReaderClassName = "SIAMoscow_2788_Reader"; session.Save(supplier); supplierId = supplier.Id; FlushAndCommit(); }
public void SetUp() { TestHelper.RecreateDirectories(); priceProcessor = factory.CreateChannel(); supplier = TestSupplier.Create(); var price = supplier.Prices[0]; price.SetFormat(PriceFormatType.NativeDbf); priceItem = price.Costs[0].PriceItem; source = priceItem.Source; priceItem.Format.Save(); }
public void SetUp() { var supplier = TestSupplier.Create(); var realSupplier = Supplier.Find(supplier.Id); using (new TransactionScope()) { var certificateSources = CertificateSource.Queryable.Where(s => s.SourceClassName == typeof(RostaCertificateSource).Name).ToList(); certificateSources.ForEach(c => c.Delete()); _source = new CertificateSource { SourceClassName = typeof(RostaCertificateSource).Name }; _source.Suppliers = new List <Supplier>(); _source.Suppliers.Add(realSupplier); _source.Save(); } }
private TestSupplier CreateAndSetupSupplier(string ftpHost, int ftpPort, string ftpWaybillDirectory, string ftpRejectDirectory, string user, string password) { var supplier = TestSupplier.Create(session); var source = supplier.WaybillSource; source.SourceType = TestWaybillSourceType.FtpSupplier; source.UserName = user; source.Password = password; var waybillUri = new UriBuilder("ftp", ftpHost, ftpPort, ftpWaybillDirectory); var rejectUri = new UriBuilder("ftp", ftpHost, ftpPort, ftpRejectDirectory); source.WaybillUrl = waybillUri.Uri.AbsoluteUri; source.RejectUrl = rejectUri.Uri.AbsoluteUri; session.Save(supplier); return(supplier); }
public void Send_waybill_from_supplier_with_filials() { var fileNames = new List <string> { @"..\..\Data\Waybills\0000470553.dbf" }; SetUp(fileNames); var supplier = TestSupplier.Create(64UL); PrepareSupplier(supplier, String.Format("{0}@test.test", client)); Process(); var savedFiles = GetSavedFiles("*(0000470553).dbf"); Assert.That(savedFiles.Count(), Is.EqualTo(1)); }
private uint CatchWarningFormalizeExceptionTestPrepareData(PriceFormatType priceFormatId = PriceFormatType.NativeDbf, CostType priceCostType = CostType.MultiColumn) { var supplier = TestSupplier.Create(session); supplier.Disabled = true; var price = supplier.Prices[0]; price.CostType = priceCostType; var item = price.Costs.First().PriceItem; var format = price.Costs.Single().PriceItem.Format; format.PriceFormat = priceFormatId; session.Save(supplier); price.Save(); return(item.Id); }
public void SetUp() { _testSupplier = TestSupplier.Create(); _realSupplier = session.Query <Supplier>().FirstOrDefault(s => s.Id == _testSupplier.Id); var certificateSources = session.Query <CertificateSource>().Where(s => s.SourceClassName == typeof(RostaCertificateSource).Name).ToList(); certificateSources.ForEach(c => session.Delete(c)); _source = new CertificateSource { SourceClassName = typeof(RostaCertificateSource).Name }; _source.Suppliers = new List <Supplier>(); _source.Suppliers.Add(_realSupplier); session.Save(_source); _testUser = TestClient.Create().Users[0]; }
public void Check_user_update_time() { var client = TestClient.CreateNaked(); var supplier = TestSupplier.Create(); session.CreateSQLQuery( "update Logs.AuthorizationDates set AFTime = '2012-05-06' where UserId = :userId") .SetParameter("userId", client.Users[0].Id) .ExecuteUpdate(); var log = new DocumentReceiveLog( session.Load <Supplier>(supplier.Id), session.Load <Address>(client.Addresses[0].Id)); var e = Assert.Catch <EMailSourceHandlerException>(() => log.Check(session)); Assert.That(e.Message, Is.StringContaining("ни один пользователь этого адреса не обновляется более месяца")); }
public void Setup() { TestHelper.RecreateDirectories(); supplier = TestSupplier.Create(); priceItem = supplier.Prices[0].Costs[0].PriceItem; source = priceItem.Source; source.SourceType = PriceSourceType.Http; source.PricePath = "www.ru"; source.PriceMask = "index.html"; source.ExtrMask = "index.html"; priceItem.Format.PriceFormat = PriceFormatType.NativeDbf; priceItem.Format.Save(); handler = new T(); handler.CreateDirectoryPath(); }
public void GetFilesFromSource() { var testSupplier = TestSupplier.Create(); var supplier = Supplier.Find(testSupplier.Id); GetFiles(supplier, new[] { "1.tif" }, "1.tif", "1.tif", ".tif"); GetFiles(supplier, new[] { "2.jpg" }, "2.jpg", "2.jpg", ".jpg"); GetFiles(supplier, new[] { @"d\2.jpg" }, @"d\2.jpg", @"d\2.jpg", ".jpg"); GetFiles(supplier, new[] { @"d\2" }, @"d\2", @"d\2", ".tif"); GetFiles(supplier, new[] { @"d\2." }, @"d\2.", @"d\2.", ".tif"); GetFiles(supplier, new[] { @"d\2.123" }, @"d\2.123", @"d\2.123", ".tif"); GetFiles(supplier, new[] { @"d\2.123", @"d\2." }, @"d\2.", @"d\2.", ".tif"); GetFiles(supplier, new[] { @"d\2.123", @"d\3." }, @"d\2.", null, null); }
public void Setup() { xml = @"<Price> <Item> <Code>109054</Code> <Product>Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м</Product> <Producer>Вухан Лифарма Кемикалз Ко</Producer> <Volume>400</Volume> <Quantity>296</Quantity> <Period>01.01.2013</Period> <VitallyImportant>0</VitallyImportant> <NDS>10</NDS> <RequestRatio>20</RequestRatio> <Cost> <Id>PRICE6</Id> <Value>10.0</Value> <MinOrderCount>20</MinOrderCount> </Cost> <Cost> <Id>PRICE1</Id> <Value>10.0</Value> <MinOrderCount>20</MinOrderCount> </Cost> </Item> </Price> "; var supplier = TestSupplier.Create(session); price = supplier.Prices[0]; priceItem = price.Costs[0].PriceItem; var format = priceItem.Format; format.PriceFormat = PriceFormatType.UniversalXml; format.Save(); price.CreateAssortmentBoundSynonyms("Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м", "Вухан Лифарма Кемикалз Ко"); price.Save(); }
private void CreatePrices() { using (var scope = new TransactionScope(OnDispose.Rollback)) { rootPrice = supplier.Prices[0]; rootPrice.SetFormat(PriceFormatType.NativeDbf); rootPrice.Save(); scope.VoteCommit(); } var supplier2 = TestSupplier.Create(); using (var scope = new TransactionScope(OnDispose.Rollback)) { childPrice = supplier2.Prices[0]; childPrice.SetFormat(PriceFormatType.NativeDbf); new TestUnrecExp("test", "test", childPrice).Save(); new TestUnrecExp("test", "test", rootPrice).Save(); childPrice.ParentSynonym = rootPrice.Id; childPrice.Save(); scope.VoteCommit(); } }
public void FindTest() { var supplier = TestSupplier.Create(); var price = supplier.Prices[0]; var itemFormat = price.Costs[0].PriceItem.Format; itemFormat.PriceFormat = PriceFormatType.NativeDbf; itemFormat.FCode = "F1"; session.Save(itemFormat); session.Flush(); session.Save(price); Reopen(); var filter = new FormPositionFilter(); filter.Session = session; var result = filter.Find(); var sourceData = result.FirstOrDefault(r => ((FormPositionItem)r).PriceCode == price.Id); Assert.That(sourceData != null); Assert.That(((FormPositionItem)sourceData).FCode, Is.Not.Null); }
public void Setup() { testSupplier = TestSupplier.Create(); testUser = TestClient.Create().Users[0]; supplier = Supplier.Find(testSupplier.Id); }
public void Setup() { var supplier = TestSupplier.Create(); price = session.Load <Price>(supplier.Prices[0].Id); }
public void SetUp() { _supplier = TestSupplier.Create(); }