public void GetFormatter_Returns_Null_If_Key_In_Ignore_List() { //Given var options = new TracingMiddlewareOptions().Ignore("nastykey"); //When var result = options.GetFormatter("nastykey", typeof (string)); //Then Assert.Null(result); }
public void GetFormatter_Returns_Null_If_Key_Predicate_Returns_True() { //Given var options = new TracingMiddlewareOptions().Ignore(key => key.StartsWith("nasty")); //When var result = options.GetFormatter("nastykey", typeof(string)); //Then Assert.Null(result); }
public void GetFormatter_Returns_Specified_Formatter() { //Given var options = new TracingMiddlewareOptions().ForType<int>(i => "custom formatter " + i); //When var formatter = options.GetFormatter("key", typeof(int)); var result = formatter(1); //Then Assert.Equal("custom formatter 1", result); }
public void GetFormatter_Returns_Default_Type_Formatter_If_None_Found() { //Given var options = new TracingMiddlewareOptions(); //When var formatter = options.GetFormatter("key", typeof(string)); var result = formatter("stringvalue"); //Then Assert.Equal("stringvalue",result); }