Beispiel #1
0
        public static void CompareFiles(byte[] fileToImport, byte[] readAndWrittenFile)
        {
            // Check that archive file contents are present
            ArchiveFilesCompareTool.CompareZipArchiveFileEntries(fileToImport, readAndWrittenFile);
            var expectedFile = BCFv21Container.ReadStream(new MemoryStream(fileToImport));
            var actualFile   = BCFv21Container.ReadStream(new MemoryStream(readAndWrittenFile));

            CompareContainers(expectedFile, actualFile, new ZipArchive(new MemoryStream(fileToImport)), new ZipArchive(new MemoryStream(readAndWrittenFile)));
        }
Beispiel #2
0
        public void ReadExtensionSchema()
        {
            using (var memStream = new MemoryStream())
            {
                CreatedContainer.WriteStream(memStream);
                memStream.Position = 0;

                var readContainer = BCFv21Container.ReadStream(memStream);

                Assert.NotNull(readContainer.ProjectExtensions);
            }
        }
Beispiel #3
0
                public void SimpleExtensions()
                {
                    var originalContainer = new BCFv21Container();

                    originalContainer.ProjectExtensions = new ProjectExtensions();
                    originalContainer.ProjectExtensions.UserIdType.Add("Some user");
                    using (var memStream = new MemoryStream())
                    {
                        originalContainer.WriteStream(memStream);
                        var readContainer = BCFv21Container.ReadStream(memStream);
                        Assert.NotNull(readContainer.ProjectExtensions);
                        Assert.Equal("Some user", readContainer.ProjectExtensions.UserIdType.First());
                        Assert.Equal("extensions.xsd", readContainer.BcfProject.ExtensionSchema);
                    }
                }
Beispiel #4
0
        public void WriteReadAgainAndCompare()
        {
            using (var memStream = new MemoryStream())
            {
                CreatedContainer.WriteStream(memStream);
                memStream.Position = 0;

                var readContainer = BCFv21Container.ReadStream(memStream);

                var readMemStream = new MemoryStream();
                readContainer.WriteStream(readMemStream);
                var writtenZipArchive = new ZipArchive(readMemStream);

                CompareTool.CompareContainers(CreatedContainer, readContainer, CreatedArchive, writtenZipArchive);
            }
        }
Beispiel #5
0
            public void AppendSnapshotInfoToMarkup()
            {
                var instance = new BCFv21Container();

                instance.Topics.Add(new BCFTopic());
                instance.Topics.First().Viewpoints.Add(new VisualizationInfo());
                instance.Topics.First().AddOrUpdateSnapshot(instance.Topics.First().Viewpoints.First().Guid, new byte[] { 15, 15, 15, 15, 15, 15 });

                using (var memStream = new MemoryStream())
                {
                    instance.WriteStream(memStream);
                    memStream.Position = 0;
                    var readAgain = BCFv21Container.ReadStream(memStream);
                    Assert.False(string.IsNullOrWhiteSpace(readAgain.Topics.First().Markup.Viewpoints.First().Viewpoint));
                    Assert.True(readAgain.Topics.First().ViewpointSnapshots.Any());
                }
            }