public void GetChecksum_ReturnsCopiedChecksum() { // Arrange var contentString = "Hello World"; var stream = TestRazorSourceDocument.CreateStreamContent(contentString); var reader = new StreamReader(stream, detectEncodingFromByteOrderMarks: true); var document = new LargeTextSourceDocument(reader, 5, Encoding.UTF8, RazorSourceDocumentProperties.Default); // Act var firstChecksum = document.GetChecksum(); var secondChecksum = document.GetChecksum(); // Assert Assert.Equal(firstChecksum, secondChecksum); Assert.NotSame(firstChecksum, secondChecksum); }
public void GetChecksum_ComputesCorrectChecksum_UTF32() { // Arrange var contentString = "Hello World"; var stream = TestRazorSourceDocument.CreateStreamContent(contentString, Encoding.UTF32); var reader = new StreamReader(stream, detectEncodingFromByteOrderMarks: true); var document = new LargeTextSourceDocument(reader, 5, Encoding.UTF32, RazorSourceDocumentProperties.Default); var expectedChecksum = new byte[] { 108, 172, 130, 171, 42, 19, 155, 176, 211, 80, 224, 121, 169, 133, 25, 134, 48, 228, 199, 141 }; // Act var checksum = document.GetChecksum(); // Assert Assert.Equal(expectedChecksum, checksum); }
public void GetChecksum_ComputesCorrectChecksum_UTF8() { // Arrange var contentString = "Hello World"; var stream = TestRazorSourceDocument.CreateStreamContent(contentString); var reader = new StreamReader(stream, detectEncodingFromByteOrderMarks: true); var document = new LargeTextSourceDocument(reader, 5, Encoding.UTF8, RazorSourceDocumentProperties.Default); var expectedChecksum = new byte[] { 10, 77, 85, 168, 215, 120, 229, 2, 47, 171, 112, 25, 119, 197, 216, 64, 187, 196, 134, 208 }; // Act var checksum = document.GetChecksum(); // Assert Assert.Equal(expectedChecksum, checksum); }