Skip to content

Commit 83fbacc

Browse files
committed
Add string test to verify %601 conversion to {T}
1 parent 7bc2ff2 commit 83fbacc

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/PortToTripleSlash/tests/PortToTripleSlash/PortToTripleSlash.Strings.Tests.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,76 @@ public interface MyInterface
19361936
return TestWithStringsAsync(data, skipRemarks);
19371937
}
19381938

1939+
[Fact]
1940+
public Task Class_Convert_Percent601_MarkdownRemarks()
1941+
{
1942+
string docMyGenericType = @"<Type Name=""MyGenericType&lt;T&gt;"" FullName=""MyNamespace.MyGenericType&lt;T&gt;"">
1943+
<TypeSignature Language=""DocId"" Value=""T:MyNamespace.MyGenericType`1"" />
1944+
<AssemblyInfo>
1945+
<AssemblyName>MyAssembly</AssemblyName>
1946+
</AssemblyInfo>
1947+
<Docs>
1948+
<summary>This is the MyGenericType{T} class summary.</summary>
1949+
<remarks>
1950+
<format type=""text/markdown""><![CDATA[
1951+
## Remarks
1952+
Contains the nested class <xref:MyNamespace.MyGenericType%601.Enumerator>.
1953+
]]></format>
1954+
</remarks>
1955+
</Docs>
1956+
</Type>
1957+
";
1958+
1959+
string docMyGenericTypeEnumerator = @"<Type Name=""MyGenericType&lt;T&gt;+Enumerator"" FullName=""MyNamespace.MyGenericType&lt;T&gt;+Enumerator"">
1960+
<TypeSignature Language=""DocId"" Value=""T:MyNamespace.MyGenericType`1.Enumerator"" />
1961+
<AssemblyInfo>
1962+
<AssemblyName>MyAssembly</AssemblyName>
1963+
</AssemblyInfo>
1964+
<Docs>
1965+
<summary>This is the MyGenericType{T}.Enumerator class summary.</summary>
1966+
</Docs>
1967+
</Type>
1968+
";
1969+
1970+
string originalCode = @"using System;
1971+
1972+
namespace MyNamespace
1973+
{
1974+
// Original MyGenericType<T> class comments with information for maintainers, must stay.
1975+
public class MyGenericType<T>
1976+
{
1977+
// Original MyGenericType<T>.Enumerator class comments with information for maintainers, must stay.
1978+
public class Enumerator { }
1979+
}
1980+
}";
1981+
1982+
string expectedCode = @"using System;
1983+
1984+
namespace MyNamespace
1985+
{
1986+
// Original MyGenericType<T> class comments with information for maintainers, must stay.
1987+
/// <summary>This is the MyGenericType{T} class summary.</summary>
1988+
/// <remarks>Contains the nested class <see cref=""MyNamespace.MyGenericType{T}.Enumerator"" />.</remarks>
1989+
public class MyGenericType<T>
1990+
{
1991+
// Original MyGenericType<T>.Enumerator class comments with information for maintainers, must stay.
1992+
/// <summary>This is the MyGenericType{T}.Enumerator class summary.</summary>
1993+
public class Enumerator { }
1994+
}
1995+
}";
1996+
1997+
List<string> docFiles = new() { docMyGenericType, docMyGenericTypeEnumerator };
1998+
List<string> originalCodeFiles = new() { originalCode };
1999+
Dictionary<string, string> expectedCodeFiles = new()
2000+
{
2001+
{ "T:MyNamespace.MyGenericType`1", expectedCode },
2002+
{ "T:MyNamespace.MyGenericType`1.Enumerator", expectedCode }
2003+
};
2004+
StringTestData data = new(docFiles, originalCodeFiles, expectedCodeFiles, false);
2005+
2006+
return TestWithStringsAsync(data, skipRemarks: false);
2007+
}
2008+
19392009
private static string GetRemarks(bool skipRemarks, string apiName, string spacing = "")
19402010
{
19412011
return skipRemarks ? @"

0 commit comments

Comments
 (0)