public void ConstructorTest() { var plusCode = new PlusCode("global", "local"); Assert.AreEqual("global", plusCode.GlobalCode); Assert.AreEqual("local", plusCode.LocalCode); }
public void ConstructorWhenPlusCodeTest() { var plusCode = new PlusCode("global", "local"); var location = new LocationEx(plusCode); Assert.AreEqual(plusCode.ToString(), location.String); }
public void ToStringTest() { var plusCode = new PlusCode("global", "local"); var toString = plusCode.ToString(); Assert.AreEqual($"{plusCode.GlobalCode}{plusCode.LocalCode}", toString); }
public void ConstructorWhenLocalCodeIsNullTest() { Assert.DoesNotThrow(() => { var plusCode = new PlusCode("global"); Assert.IsNotNull(plusCode); }); }
public void ConstructorWhenGlobalCodeIsNullTest() { Assert.Throws <ArgumentNullException>(() => { var plusCode = new PlusCode(null, "local"); Assert.IsNotNull(plusCode); }); }
/// <summary> /// Constructor /// </summary> /// <param name="node">Place node from response</param> public OnlineMapsGooglePlacesResult(OnlineMapsXML node) { List <Photo> photos = new List <Photo>(); List <string> types = new List <string>(); List <string> weekday_text = new List <string>(); foreach (OnlineMapsXML n in node) { if (n.name == "name") { name = n.Value(); } else if (n.name == "id") { id = n.Value(); } else if (n.name == "vicinity") { vicinity = n.Value(); } else if (n.name == "type") { types.Add(n.Value()); } else if (n.name == "geometry") { location = OnlineMapsXML.GetVector2FromNode(n[0]); } else if (n.name == "rating") { rating = n.Value <float>(); } else if (n.name == "icon") { icon = n.Value(); } else if (n.name == "reference") { reference = n.Value(); } else if (n.name == "place_id") { place_id = n.Value(); } else if (n.name == "scope") { scope = n.Value(); } else if (n.name == "price_level") { price_level = n.Value <int>(); } else if (n.name == "formatted_address") { formatted_address = n.Value(); } else if (n.name == "opening_hours") { open_now = n.Get <string>("open_now") == "true"; foreach (OnlineMapsXML wdt in n.FindAll("weekday_text")) { weekday_text.Add(wdt.Value()); } } else if (n.name == "photo") { photos.Add(new Photo(n)); } else if (n.name == "plus_code") { plus_code = new PlusCode(n); } else { Debug.Log(n.name); } } this.photos = photos.ToArray(); this.types = types.ToArray(); this.weekday_text = weekday_text.ToArray(); }
/// <summary> /// Constructor. /// </summary> /// <param name="plusCode">The <see cref="PlusCode"/>.</param> public LocationEx(PlusCode plusCode) { this.String = plusCode.ToString(); }