public void GetChecksum_ReturnsCopiedChecksum() { // Arrange var content = "Hello World!"; var document = new StringSourceDocument(content, 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 content = "Hello World!"; var document = new StringSourceDocument(content, Encoding.UTF32, RazorSourceDocumentProperties.Default); var expectedChecksum = new byte[] { 8, 149, 159, 15, 242, 255, 115, 227, 219, 78, 61, 53, 127, 239, 77, 239, 215, 140, 248, 44 }; // Act var checksum = document.GetChecksum(); // Assert Assert.Equal(expectedChecksum, checksum); }
public void GetChecksum_ComputesCorrectChecksum_UTF8() { // Arrange var content = "Hello World!"; var document = new StringSourceDocument(content, Encoding.UTF8, RazorSourceDocumentProperties.Default); var expectedChecksum = new byte[] { 46, 247, 189, 230, 8, 206, 84, 4, 233, 125, 95, 4, 47, 149, 248, 159, 28, 35, 40, 113 }; // Act var checksum = document.GetChecksum(); // Assert Assert.Equal(expectedChecksum, checksum); }
public void SourceTextSourceDocument_GetChecksum_WorksAsExpected() { // Arrange var sourceDocumentProperties = RazorSourceDocumentProperties.Default; var stringSourceDocument = new StringSourceDocument(SourceText.ToString(), Encoding.UTF8, sourceDocumentProperties); var stringSourceDocumentChecksum = stringSourceDocument.GetChecksum(); var sourceTextSourceDocument = SourceText.GetRazorSourceDocument(sourceDocumentProperties.FilePath, sourceDocumentProperties.RelativePath); // Act var sourceTextSourceDocumentChecksum = sourceTextSourceDocument.GetChecksum(); // Assert Assert.Equal(stringSourceDocumentChecksum, sourceTextSourceDocumentChecksum); }