public void TestReadStringHappy() { string[] args = { "a:b", "c:d", "e:f" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); StringAssert.AreEqualIgnoringCase("b", properties.GetString("a", null)); }
public void TestReadStringDefaulted() { string[] args = { "a:b" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); string value = properties.GetString( "notexisting", // wasn't added and shouldn't be found "somedefaultvalue"); // default supplied should be returned StringAssert.AreEqualIgnoringCase("somedefaultvalue", value); }
public void TestReadStringMissingRequired() { string[] args = { "a:b" }; ArgumentProperties properties = new ArgumentProperties(args, ":"); try { string value = properties.GetString( "notexisting", // wasn't added and shouldn't be found null); // no default supplied means required } catch (ArgumentException) { Assert.Pass(); } Assert.Fail("Expected ArgumentException"); }