-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnippets.cs
More file actions
55 lines (43 loc) · 1.52 KB
/
Copy pathSnippets.cs
File metadata and controls
55 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#if NET48
// ReSharper disable UnusedTypeParameter
// ReSharper disable once EmptyConstructor
#region Target
namespace MyNamespace
{
public class Parent<T>;
public class Target<K> : Parent<int>
{
public Target()
{
}
public string Property { get; set; } = null!;
public string field = null!;
public void Method<Y, D>(List<D> parameter)
{
}
}
}
#endregion
public class Snippets
{
[Fact]
public void WriteMarkdown()
{
var md = Path.Combine(ProjectFiles.SolutionDirectory, "sample.include.md");
File.Delete(md);
using var writer = File.CreateText(md);
var type = typeof(Target<int>);
writer.WriteLine("| | |");
writer.WriteLine("| - | - |");
writer.WriteLine($"| Type | `{type.SimpleName()}` |");
writer.WriteLine($"| | Compared to `Type.FullName` of<br> `{type.FullName!.Replace("`", "'")}` |");
var method = type.GetMethod("Method")!.MakeGenericMethod(typeof(string), typeof(bool));
var constructorInfos = type.GetConstructors();
writer.WriteLine($"| Constructor | `{constructorInfos.Single().SimpleName()}` |");
writer.WriteLine($"| Method | `{method.SimpleName()}` |");
writer.WriteLine($"| Parameter | `{method.GetParameters().First().SimpleName()}` |");
writer.WriteLine($"| Field | `{type.GetField("field").SimpleName()}` |");
writer.WriteLine($"| Property | `{type.GetProperty("Property")!.SimpleName()}` |");
}
}
#endif