public void SupportsHandlerInjection()
{
// Setup
using (var server = CreateImageServer())
{
var transaction = new PretendRequestInfo(ServerBase.ServerUrlWithBloomPrefixEndingInSlash + "api/thisWontWorkWithoutInjectionButWillWithIt");
server.CurrentCollectionSettings = new CollectionSettings();
EndpointHandler testFunc = (request) =>
{
Assert.That(request.LocalPath(), Is.StringContaining("thisWontWorkWithoutInjection"));
Assert.That(request.CurrentCollectionSettings, Is.EqualTo(server.CurrentCollectionSettings));
request.ReplyWithText("Did It!");
};
server.RegisterEndpointHandler("thisWontWorkWithoutInjection", testFunc);
// Execute
server.MakeReply(transaction);
// Verify
Assert.That(transaction.ReplyContents, Is.EqualTo("Did It!"));
}
}