CategoryDevelopment

Using Mediatr with Azure Functions

U

I’ve used Mediatr for some time, to reduce controller action bloat, and have spoken about it a few times, on how I use it to avoid the classic ‘xService’ pattern: Controller Action -> ‘Service’ -> Repo Lately, I’ve been doing a lot of work with Azure Functions, and would like to be able to use Mediatr, as I can in ASP.net Core. Up until recently, this has...

Reliably Processing Azure Service Bus Topics with Azure Functions

R

At ASOS, we’re currently migrating some of our message and event processing applications from Worker Roles (within classic Azure Cloud Services) to Azure Functions. A significant benefit of using Azure Functions to process our messages is the billing model. As an example, with our current approach, we use a Worker Role to listen to subscriptions to Azure Service Bus topics. These Worker Roles are...

Disable gzip responses in Azure Functions

D

By default, responses from Http Triggered Azure Functions are gzipped: Not all clients are able to handle this (although they should be) Turning it off isn’t particularly trivial. A change needs to be made to applicationhost.config – which is located in LocalSiteRoot/Config However, this file is readonly, so the change needs to be made via a xdt transform. In the Azure portal...

Better assertions when verifying Moq’d methods have been called

B
Man wearing fake glasses and moustache

Moq, according to its GitHub page, is “The most popular and friendly mocking framework for .NET”. Mocking frameworks allow you to create a ‘fake’ version of a dependency (typically an interface, or abstract class). With this fake, you can then instruct the methods return values, or invoke behaviour. Alternatively you can assert the methods were called, with a certain set...

Reversing hashes of PwnedPasswords api using number of breaches

R

I was recently working on a requirement to log the number of breached sites a password appeared on when customers were registering (if that password had been breached at all) Importantly, we are not logging the breached password itself (nor the hash of the password) – just the number of breaches that particular password appeared in (as per the Pwned Passwords data set) So, to log this, I’m...