private static Func <HttpContext, HealthReport, Task> CreateResponse(string assemblyName = null, bool responseAsJson = false) { var theAssembly = !string.IsNullOrWhiteSpace(assemblyName) ? Assembly.Load(assemblyName) : Assembly.GetExecutingAssembly(); var version = FileVersionInfo.GetVersionInfo(theAssembly.Location).FileVersion; if (responseAsJson) { return(ResponseWriters.AsJson(version)); } return(ResponseWriters.AsText(version)); }
private T AddResponseWriter <T>(Func <ResponseWriterContext, Task <HttpResponseMessage> > write, Func <ResponseWriterContext, bool> configAppliesTo, Func <ResponseWriterContext, bool> instanceAppliesTo) where T : TestResponseWriter, new() { Configuration.ResponseWriters.Append <T>(configAppliesTo); var writer = new T { AppliesToFunc = instanceAppliesTo, WriteFunc = write }; ResponseWriters.Add(writer); return(writer); }