public void GetIdentifier_ReturnsNull_ForNullRelativePath() { // Arrange var sourceDocument = RazorSourceDocument.Create("content", new RazorSourceDocumentProperties("Test.cshtml", null)); var codeDocument = RazorCodeDocument.Create(sourceDocument); var feature = new DefaultMetadataIdentifierFeature() { Engine = CreateProjectEngine().Engine, }; // Act var result = feature.GetIdentifier(codeDocument, sourceDocument); // Assert Assert.Null(result); }
public void GetIdentifier_SanitizesRelativePath(string relativePath, string expected) { // Arrange var sourceDocument = RazorSourceDocument.Create("content", new RazorSourceDocumentProperties("Test.cshtml", relativePath)); var codeDocument = RazorCodeDocument.Create(sourceDocument); var feature = new DefaultMetadataIdentifierFeature() { Engine = RazorEngine.Create(), }; // Act var result = feature.GetIdentifier(codeDocument, sourceDocument); // Assert Assert.Equal(expected, result); }