public void TestAddOptionalValue() { // Arrange var sut = new ParameterParserBuilder(); // Act sut.AddValue("Foo", shortName: "f", longName: "foo", optional: true); var result = sut.Build(); // Assert Assert.NotNull(result, "Result nullability"); Assert.AreEqual(1, result.GetRegisteredParameters().Length, "Count of parameters"); var param = result.GetRegisteredParameters().First(); Assert.AreEqual("Foo", param.Identifier, "Param identifier"); Assert.AreEqual("f", param.ShortNames.First(), "Param short name"); Assert.AreEqual("foo", param.LongNames.First(), "Param long name"); Assert.AreEqual(ParameterBehaviour.ValueOptional, param.Behaviour, "Param behaviour"); }
public void TestAddValue() { // Arrange var sut = new ParameterParserBuilder <SampleClass>(); // Act sut.AddValue(x => x.ValueProperty, shortName: "f", longName: "foo", optional: false); var result = sut.Build(); // Assert Assert.NotNull(result, "Result nullability"); Assert.AreEqual(1, result.GetRegisteredParameters().Length, "Count of parameters"); var param = result.GetRegisteredParameters().First(); Assert.AreEqual(Reflect.Property <SampleClass>(x => x.ValueProperty), param.Identifier, "Param identifier"); Assert.AreEqual("f", param.ShortNames.First(), "Param short name"); Assert.AreEqual("foo", param.LongNames.First(), "Param long name"); Assert.AreEqual(ParameterBehaviour.ValueRequired, param.Behaviour, "Param behaviour"); }