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); }
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); }
void AssertParameter(string expectedDescription, Parameter para, string expectedPropertyName) { Assert.AreEqual(expectedDescription, para.Description); Assert.AreEqual(expectedPropertyName, para.PropertyInfo.Name); }
void AssertExamples(Parameter parameter, IEnumerable<string> examples) { Assert.IsTrue(parameter.Examples.OrderBy(e => e.Text).Select(e => e.Text).SequenceEqual(examples.OrderBy(s => s))); }