コード例 #1
0
            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);
                }
            }
コード例 #2
0
            public void ReturnsCorrectStaticString()
            {
                //Arrange
                const string id       = "Id_1";
                var          manifest = DomainUtility.GetDirectManifest();

                //Act

                //Assert
                Assert.Equal(id, manifest.Id);
            }
コード例 #3
0
            public void ReturnsCorrectStaticString()
            {
                //Arrange
                const string mimeType = "application/xml";
                var          manifest = DomainUtility.GetDirectManifest();

                //Act

                //Assert
                Assert.Equal(mimeType, manifest.MimeType);
            }
コード例 #4
0
            public void ReturnsCorrectStaticString()
            {
                //Arrange
                const string fileName = "manifest.xml";
                var          manifest = DomainUtility.GetDirectManifest();

                //Act

                //Assert
                Assert.Equal(fileName, manifest.FileName);
            }
コード例 #5
0
            public void SuccessfulManifestToBytes()
            {
                //Arrange
                var manifest = DomainUtility.GetDirectManifest();
                var manifestDataTranferObject = DataTransferObjectConverter.ToDataTransferObject(manifest);
                var expectedResult            = SerializeUtility.Serialize(manifestDataTranferObject);

                //Act
                var bytes        = manifest.Bytes;
                var actualResult = Encoding.UTF8.GetString(bytes);

                //Assert
                Assert.Equal(expectedResult, actualResult);
            }
コード例 #6
0
            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);
                    }
                }
            }