public void Replace_multiple_placeholders() { var v = new Dictionary<string, string>(); v.Add("[Artist.Name]", "solar system"); v.Add("[Track.Name]", "world"); var p = new PlaceholderParser(); var d = p.Replace(v, "Hello, [Artist.Name]'s [Track.Name]!"); Assert.AreEqual(1, d.Length); Assert.AreEqual("Hello, solar system's world!", d[0]); }
public void Replace_depth2_placeholder() { var v = new Dictionary<string, string>(); v.Add("[Track.AlbumId.Title]", "album world"); var p = new PlaceholderParser(); var d = p.Replace(v, "Hello, [Track.AlbumId.Title]!"); Assert.AreEqual(1, d.Length); Assert.AreEqual("Hello, album world!", d[0]); }
public void Replace_one_placeholder_two_strings() { var v = new Dictionary<string, string>(); v.Add("[Track.Name]", "world"); v.Add("[Album.Title]", "universe"); var p = new PlaceholderParser(); var d = p.Replace(v, "Hello, [Track.Name]!", "Hello, [Album.Title]!"); Assert.AreEqual(2, d.Length); Assert.AreEqual("Hello, world!", d[0]); Assert.AreEqual("Hello, universe!", d[1]); }
public void Replace_one_placeholder_no_values() { var p = new PlaceholderParser(); var d = p.Replace(new Dictionary<string, string>(), "Hello, [Track.Name]!"); Assert.AreEqual(1, d.Length); Assert.AreEqual("Hello, !", d[0]); }
public void Replace_one_placeholder() { var v = new Dictionary<string, string>(); v.Add("[Track.Name]", "world"); var p = new PlaceholderParser(); var d = p.Replace(v, "Hello, [Track.Name]!"); Assert.AreEqual(1, d.Length); Assert.AreEqual("Hello, world!", d[0]); }
public void Replace_non_existant_placeholder() { var v = new Dictionary<string, string>(); v.Add("[Track.Name]", "world"); var p = new PlaceholderParser(); var d = p.Replace(v, "Hello, [Does.Not.Exist]!"); Assert.AreEqual(1, d.Length); Assert.AreEqual("Hello, !", d[0]); }