public void ShouldInjectParameterValues() { var sut = new ParameterFormatter(); var values = new Dictionary <string, byte[]> { { "P1", "val1".ToUtf8EncodedBytes() }, { "P2", "val2".ToUtf8EncodedBytes() }, }; var result = sut.Format("pre $P1 $P2 $$P1 post", values); Assert.That(result, Is.EqualTo("pre val1 val2 $P1 post")); }
public void TestUrlFormatter() { var formatter = new ParameterFormatter(); Assert.AreEqual("auto", formatter.Format(Unit.Auto, null, typeof(Unit))); Assert.AreEqual("uk2", formatter.Format(Unit.Uk2, null, typeof(Unit))); Assert.AreEqual("us", formatter.Format(Unit.Us, null, typeof(Unit))); Assert.AreEqual("AUD", formatter.Format(CurrencyCode.Aud, null, typeof(CurrencyCode))); Assert.AreEqual("ar", formatter.Format(Language.Ar, null, typeof(Language))); Assert.AreEqual("x-pig-latin", formatter.Format(Language.XPigLatin, null, typeof(Language))); Assert.AreEqual("zh-tw", formatter.Format(Language.ZhTw, null, typeof(Language))); Assert.AreEqual("original", formatter.Format(IconPack.Original, null, typeof(IconPack))); Assert.AreEqual("currently", formatter.Format(ReportType.Currently, null, typeof(ReportType))); Assert.AreEqual("hourly", formatter.Format(ReportType.Hourly, null, typeof(ReportType))); Assert.AreEqual("all", formatter.Format(Span.All, null, typeof(Span))); Assert.AreEqual("month", formatter.Format(Span.Month, null, typeof(Span))); Assert.AreEqual("year", formatter.Format(Span.Year, null, typeof(Span))); }