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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
using Microsoft.FSharp.Core;
using Mono.Documentation.Updater;
using NUnit.Framework;
namespace mdoc.Test
{
[TestFixture]
[Category("FSharp")]
public class FSharpUsageFormatterTests : BasicFSharpFormatterTests<FSharpUsageFormatter>
{
private static readonly FSharpUsageFormatter fSharpUsageFormatter = new FSharpUsageFormatter();
protected override FSharpUsageFormatter formatter => fSharpUsageFormatter;
#region Usage
[Test]
[Category("Usage")]
[Category("Properties")]
public void PropertyUsage_0() =>
TestPropertySignature(typeof(Properties.MyPropertyClass2),
@"Properties.MyPropertyClass2.Property1",
nameof(Properties.MyPropertyClass2.Property1));
[Test]
[Category("Usage")]
[Category("Properties")]
[Category("DiscriminatedUnions")]
public void PropertyUsage_1() =>
TestPropertySignature(
typeof(DiscriminatedUnions.SizeUnion),
"DiscriminatedUnions.SizeUnion.Small",
nameof(DiscriminatedUnions.SizeUnion.Small));
[Test]
[Category("Usage")]
[Category("Methods")]
public void MethodUsage_0() =>
TestMethodSignature(typeof(Methods.SomeType),
@"someType.SomeMethod (a, b, c)",
nameof(Methods.SomeType.SomeMethod));
[Test]
[Category("Usage")]
[Category("Methods")]
public void MethodUsage_1() =>
TestMethodSignature(typeof(Methods.SomeType),
@"Methods.SomeType.SomeStaticMethod (a, b, c)",
nameof(Methods.SomeType.SomeStaticMethod));
[Test]
[Category("Usage")]
[Category("Methods")]
public void MethodUsage_2() =>
TestMethodSignature(typeof(Methods.SomeType),
@"Methods.SomeType.SomeOtherStaticMethod2 a b c",
nameof(Methods.SomeType.SomeOtherStaticMethod2));
[Test]
[Category("Usage")]
[Category("Methods")]
public void MethodUsage_3() =>
TestMethodSignature(typeof(Methods.SomeType),
@"Methods.SomeType.SomeOtherStaticMethod3 (a, b) c d",
nameof(Methods.SomeType.SomeOtherStaticMethod3));
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_4() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"v * a",
"op_Multiply");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_5() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"- v",
"op_UnaryNegation");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_6() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"~~~ v",
"op_LogicalNot");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_7() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"start .. finish",
"op_Range");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_8() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"start .. step .. finish",
"op_RangeStep");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_9() =>
TestMethodSignature(typeof(OperatorsOverloading.Vector),
"a |+-+ v",
"op_BarPlusMinusPlus");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_10() =>
TestMethodSignature(typeof(Operators),
"(arg1, arg2, arg3) |||> func",
"op_PipeRight3");
[Test]
[Category("Usage")]
[Category("Operators")]
public void MethodUsage_11() =>
TestMethodSignature(typeof(Operators),
"func <||| (arg1, arg2, arg3)",
"op_PipeLeft3");
[Test]
[Category("Usage")]
[Category("Methods")]
public void MethodUsage_12() =>
TestMethodSignature(typeof(PatternMatching.PatternMatchingExamples),
"PatternMatching.PatternMatchingExamples.countValues list value",
"countValues");
[Test]
[Category("Usage")]
[Category("Operators")]
public void ConstructorUsage_0() =>
TestMethodSignature(typeof(AbstractClasses.Circle),
"new AbstractClasses.Circle (x, y, radius)",
".ctor");
#endregion
}
}
|