public void TestGetDictionary() { var mNestedDict = new MutableDictionaryObject(); mNestedDict.SetLong("key1", 1L); mNestedDict.SetString("key2", "Hello"); mNestedDict.SetValue("key3", null); var mDict = new MutableDictionaryObject(); mDict.SetLong("key1", 1L); mDict.SetString("key2", "Hello"); mDict.SetValue("key3", null); mDict.SetDictionary("nestedDict", mNestedDict); using (var mDoc = new MutableDocument("test")) { mDoc.SetDictionary("dict", mDict); using (var doc = Db.Save(mDoc)) { var dict = doc.GetDictionary("dict"); dict.Should().NotBeNull(); dict.GetDictionary("not-exists").Should().BeNull(); var nestedDict = dict.GetDictionary("nestedDict"); nestedDict.Should().NotBeNull(); nestedDict.ToDictionary().ShouldBeEquivalentTo(mNestedDict.ToDictionary()); } } }
protected override DictionaryObject DoPrediction(DictionaryObject input) { var numbers = input.GetArray("numbers"); if (numbers == null) { return(null); } var output = new MutableDictionaryObject(); output.SetLong("sum", numbers.Cast <long>().Sum()); output.SetLong("min", numbers.Cast <long>().Min()); output.SetLong("max", numbers.Cast <long>().Max()); output.SetDouble("avg", numbers.Cast <long>().Average()); return(output); }
public MutableDictionaryObject DocumentInitialize() { MutableDictionaryObject dico = new MutableDictionaryObject(); dico.SetString("table", Table); if (Num != null) { dico.SetLong("num", Num ?? 0); } dico.SetString("libelle", Libelle); dico.SetString("localite", Localite); dico.SetString("depCode", DepCode); dico.SetLong("petNumero", PetNumero); dico.SetString("etat", Etat); return(dico); }
public MutableDictionaryObject DocumentInitialize() { MutableDictionaryObject dico = new MutableDictionaryObject(); dico.SetString("table", Table); if (Num != null) { dico.SetLong("num", Num ?? 0); } dico.SetLong("pgrNum", PgrNum); dico.SetString("code", Code); dico.SetDouble("surface", Surface); dico.SetDouble("surfacePlancher", SurfacePlancher); dico.SetString("facade", Facade); dico.SetString("letCode", LetCode); dico.SetString("etat", Etat); dico.SetDouble("prixVenteConseille", PrixVenteConseille ?? 0); return(dico); }