Beispiel #1
0
        public void DocumentStream_Write_WritesDataCorrectly(byte[] data)
        {
            var path     = GetTempFileName();
            var filename = RandomFileName();

            using (var writable = V8Container.Create(path))
            {
                var file = writable.CreateFile(filename);
                using (var stream = file.Open())
                {
                    stream.Write(data.AsSpan());
                }
            }

            using (var readable = V8Container.Open(path))
            {
                var file         = readable.GetFile(filename);
                var expectedHash = Hash.ComputeHash(data);

                using (var stream = file.Open())
                {
                    var hash = Hash.ComputeHash(stream);

                    using (var scope = new AssertionScope())
                    {
                        stream.Length.Should().Be(data.Length);
                        hash.Should().Equal(expectedHash);
                    }
                }
            }
        }
Beispiel #2
0
        protected V8Container ReadOnlyContainer()
        {
            var container = V8Container.Open(ReadOnlyContainerPath);

            _disposables.Add(container);

            return(container);
        }
Beispiel #3
0
 public void V8Container_Open_OpensContainer()
 {
     using (var container = V8Container.Open(ReadOnlyContainerPath))
     {
         container.Should().NotBeNull();
         container.Files.Should().NotBeNullOrEmpty();
     }
 }