示例#1
0
 void AssertPositionalParameter(Parameter parameter, string expectedDescription, int expectedPosition, string expectedPropertyName, params string[] expectedExamples)
 {
     AssertParameter(expectedDescription, parameter, expectedPropertyName);
     Assert.AreEqual(expectedPosition, parameter.Position);
     Assert.IsTrue(parameter.ArgumentAttribute is PositionalArgumentAttribute, "Expected PositionalArgumentAttribute, was {0}", parameter.ArgumentAttribute.GetType().Name);
     AssertExamples(parameter, expectedExamples);
 }
示例#2
0
 void AssertNamedParameter(Parameter parameter, string expectedDescription, string expectedPropertyName, string expectedArgumentName, string expectedArgumentShorthand, params string[] expectedExamples)
 {
     AssertParameter(expectedDescription, parameter, expectedPropertyName);
     Assert.IsTrue(parameter.ArgumentAttribute is NamedArgumentAttribute, "Expected NamedArgumentAttribute, was {0}", parameter.ArgumentAttribute.GetType().Name);
     Assert.AreEqual(expectedArgumentName, ((NamedArgumentAttribute)parameter.ArgumentAttribute).Name);
     Assert.AreEqual(expectedArgumentShorthand, ((NamedArgumentAttribute) parameter.ArgumentAttribute).ShortHand);
     AssertExamples(parameter, expectedExamples);
 }
示例#3
0
 void AssertParameter(string expectedDescription, Parameter para, string expectedPropertyName)
 {
     Assert.AreEqual(expectedDescription, para.Description);
     Assert.AreEqual(expectedPropertyName, para.PropertyInfo.Name);
 }
示例#4
0
 void AssertExamples(Parameter parameter, IEnumerable<string> examples)
 {
     Assert.IsTrue(parameter.Examples.OrderBy(e => e.Text).Select(e => e.Text).SequenceEqual(examples.OrderBy(s => s)));
 }