public void GeneratesValidSignatureXml()
            {
                //Arrange
                var signatureGenerator = DomainUtility.GetSignature();
                var xml = signatureGenerator.Xml().InnerXml;
                var signatureValidator = new SignatureValidator();

                //Act
                var isValidSignatureXml = signatureValidator.Validate(xml);
                var signatureLength     = xml.Length;

                //Assert
                Assert.True(isValidSignatureXml);
                Assert.True(signatureLength > 3200);
            }
            public void SendsBytesThroughDocumentBundleProcessor()
            {
                //Arrange
                var clientConfiguration = new ClientConfiguration(Environment.DifiQa, CoreDomainUtility.GetPostenTestCertificate())
                {
                    DocumentBundleProcessors = new List <IDocumentBundleProcessor>
                    {
                        new SimpleDocumentBundleProcessor(),
                        new SimpleDocumentBundleProcessor()
                    }
                };

                var job = DomainUtility.GetDirectJobWithSender();
                var asiceAttachableProcessors = clientConfiguration.DocumentBundleProcessors.Select(p => new AsiceAttachableProcessor(job, p));
                var asiceAttachables          = new IAsiceAttachable[] { DomainUtility.GetDirectManifest(), DomainUtility.GetSignature(), DomainUtility.GetDirectDocument() };

                //Act
                var asiceArchive = new AsiceArchive(asiceAttachableProcessors, asiceAttachables);

                asiceArchive.GetBytes();

                //Assert
                foreach (var simpleProcessor in clientConfiguration.DocumentBundleProcessors.Cast <SimpleDocumentBundleProcessor>())
                {
                    Assert.True(simpleProcessor.StreamLength > 1000);
                    Assert.True(simpleProcessor.CouldReadBytesStream);
                    Assert.Equal(0, simpleProcessor.Initialposition);
                }
            }
            public void ConstructorGeneratesBytes()
            {
                //Arrange
                var document     = DomainUtility.GetDirectDocument();
                var asiceArchive = new AsiceArchive(new AsiceAttachableProcessor[] { }, DomainUtility.GetDirectManifest(), DomainUtility.GetSignature(), document);

                //Act
                var archiveBytes = asiceArchive.GetBytes();

                //Assert
                using (var memoryStream = new MemoryStream(archiveBytes))
                {
                    using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Read))
                    {
                        Assert.Contains(archive.Entries, entry => entry.FullName == "manifest.xml");
                        Assert.Contains(archive.Entries, entry => entry.FullName == "META-INF/signatures.xml");
                        Assert.Contains(archive.Entries, entry => entry.FullName == document.FileName);
                    }
                }
            }