public virtual void FillNonstaticField() { ArgumentParserTest.NonstaticClass x = new ArgumentParserTest.NonstaticClass(); NUnit.Framework.Assert.AreEqual(-1, x.staticOption); ArgumentParser.FillOptions(x, "-option.nonstatic", "42"); NUnit.Framework.Assert.AreEqual(42, x.staticOption); }
public static void Main(string[] args) { try { Properties props = StringUtils.ArgsToPropertiesWithResolve(args); ArgumentParser.FillOptions(typeof(GoogleNGramsSQLBacked), props); Connect(); //if(populateTables) // populateTablesInSQL(dataDir, ngramsToPopulate); //testing System.Console.Out.WriteLine("For head,the count is " + GetCount("head")); //System.out.println(getCount("what the heck")); //System.out.println(getCount("my name is john")); System.Console.Out.WriteLine(GetCounts(Arrays.AsList("cancer", "disease"))); System.Console.Out.WriteLine("Get count 1 gram " + GetTotalCount(1)); if (props.GetProperty("phrase") != null) { string p = props.GetProperty("phrase"); System.Console.Out.WriteLine("count for phrase " + p + " is " + GetCount(p)); } if (props.GetProperty("rank") != null) { string p = props.GetProperty("rank"); System.Console.Out.WriteLine("Rank of " + p + " is " + Get1GramRank(p)); } CloseConnection(); } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } }
public virtual void FillMixedFieldsNoInstanceGiven() { ArgumentParserTest.MixedClass x = new ArgumentParserTest.MixedClass(); NUnit.Framework.Assert.AreEqual(-1, ArgumentParserTest.MixedClass.staticOption); NUnit.Framework.Assert.AreEqual(-1, x.nonstaticOption); ArgumentParser.FillOptions(typeof(ArgumentParserTest.MixedClass), "-option.nonstatic", "42", "-option.static", "43"); NUnit.Framework.Assert.AreEqual(43, ArgumentParserTest.MixedClass.staticOption); NUnit.Framework.Assert.AreEqual(-1, x.nonstaticOption); }
public virtual void TestFillStaticFieldFromProperties() { NUnit.Framework.Assert.AreEqual(-1, ArgumentParserTest.StaticClass.staticOption); Properties props = new Properties(); props.SetProperty("option.static", "42"); ArgumentParser.FillOptions(typeof(ArgumentParserTest.StaticClass), props); NUnit.Framework.Assert.AreEqual(42, ArgumentParserTest.StaticClass.staticOption); }
public virtual void FillNonstaticFieldFromProperties() { ArgumentParserTest.NonstaticClass x = new ArgumentParserTest.NonstaticClass(); NUnit.Framework.Assert.AreEqual(-1, x.staticOption); Properties props = new Properties(); props.SetProperty("option.nonstatic", "42"); ArgumentParser.FillOptions(x, props); NUnit.Framework.Assert.AreEqual(42, x.staticOption); }
public virtual void CheckOptionsOverrideProperties() { ArgumentParserTest.NonstaticClass x = new ArgumentParserTest.NonstaticClass(); NUnit.Framework.Assert.AreEqual(-1, x.staticOption); Properties props = new Properties(); props.SetProperty("option.nonstatic", "78"); ArgumentParser.FillOptions(x, props, "-option.nonstatic", "42"); NUnit.Framework.Assert.AreEqual(42, x.staticOption); }
public virtual void TestFillStaticField() { NUnit.Framework.Assert.AreEqual(-1, ArgumentParserTest.StaticClass.staticOption); ArgumentParser.FillOptions(typeof(ArgumentParserTest.StaticClass), "-option.static", "42"); NUnit.Framework.Assert.AreEqual(42, ArgumentParserTest.StaticClass.staticOption); }