예제 #1
0
            public void LeggFilerTilDokumentpakkeAntallStemmer()
            {
                var dokumentpakke = DomainUtility.GetDokumentpakkeWithMultipleVedlegg(5);

                Assert.Equal(DomainUtility.GetVedleggFilesPaths().Length, dokumentpakke.Vedlegg.Count);
                Assert.NotNull(dokumentpakke);
            }
            public void ConstructorGeneratesBytes()
            {
                //Arrange
                var message = new Forsendelse(DomainUtility.GetAvsender(), DomainUtility.GetDigitalPostInfoSimple(), DomainUtility.GetDokumentpakkeWithMultipleVedlegg());

                var asiceArchive = DomainUtility.GetAsiceArchive(message);

                //Act
                var archiveBytes = asiceArchive.UnencryptedBytes;

                //Assert
                using (var memoryStream = new MemoryStream(archiveBytes))
                {
                    using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Read))
                    {
                        Assert.True(archive.Entries.Any(entry => entry.FullName == "manifest.xml"));
                        Assert.True(archive.Entries.Any(entry => entry.FullName == "META-INF/signatures.xml"));
                        Assert.True(archive.Entries.Any(entry => entry.FullName == message.Dokumentpakke.Hoveddokument.Filnavn));

                        foreach (var document in message.Dokumentpakke.Vedlegg)
                        {
                            Assert.True(archive.Entries.Any(entry => entry.FullName == document.Filnavn));
                        }
                    }
                }
            }