Пример #1
0
        public void View_document_certificates()
        {
            var log      = DataMother.CreateTestDocumentLog(supplier, client);
            var document = DataMother.CreateTestDocument(supplier, client, log);
            var line     = document.Lines[0];
            //Добавим CertificateSource т.к. изменилась выборка для сертификатов - теперь необходим еще Id источника для CertificateFile
            var newCertificate = new CertificateSource {
                Supplier        = supplier,
                Name            = "Test_Source",
                SourceClassName = "Test_class_Name"
            };

            supplier.CertificateSource = newCertificate;
            session.Save(newCertificate);

            line.CatalogProduct = DataMother.Product();
            line.Product        = line.CatalogProduct.Catalog.Name;
            line.Certificate    = DataMother.Certificate(line.CatalogProduct.Catalog, newCertificate.Id.ToString());
            session.Save(line);

            var dir      = Directory.CreateDirectory(Path.Combine(DataRoot, "Certificates"));
            var filename = line.Certificate.Files[0].Filename;

            File.WriteAllText(Path.Combine(dir.FullName, filename), "");

            Open("Logs/Documents?filter.Client.Id={0}", client.Id);
            AssertText("Тестовый поставщик");
            Click("TestFile.txt");
            WaitForText("Страна");
            AssertText("Страна");
            Click(line.Product);
            WaitForText(filename);
            AssertText(filename);

            session.Delete(newCertificate);
        }