public void WriteDocumentAndLoad() { var array = new byte[Constants.PAGE_SIZE_INCL_HEADER * 5]; UnitTestHelper.FillArray(ref array, 0x00); Memory <byte> documentSlice = new Memory <byte>(array, 500, (int)Constants.PAGE_SIZE); Core.Document.Document document = new Core.Document.Document(documentSlice, 1); string testString = "This is a test! This is a test! This is a test! This is a test! This is a test! This is a test! This is a test! This is a test!"; byte[] testContent = Encoding.UTF8.GetBytes(testString); document.Update(testContent); document = null; Core.Document.Document document2 = new Core.Document.Document(documentSlice); var content = document2.GetContent(); content.Should().BeEquivalentTo(testContent); }
public void SetAndGetContentTest() { var array = new byte[Constants.PAGE_SIZE_INCL_HEADER * 2]; UnitTestHelper.FillArray(ref array, 0x00); Memory <byte> documentSlice = new Memory <byte>(array, 500, (int)Constants.PAGE_SIZE); Core.Document.Document document = new Core.Document.Document(documentSlice, 0); string testString = "This is a test! This is a test! This is a test! This is a test! This is a test! This is a test! This is a test! This is a test!"; byte[] testContent = Encoding.UTF8.GetBytes(testString); document.SetContent(testContent); document.Header.ContentLength.Should().Be((uint)testContent.Length); var val = document.GetContent(); val.Should().BeEquivalentTo(testContent); output.WriteLine($"Content org is {testContent.Length} and saved {document.Header.ContentLength}"); }