lundi 4 juillet 2016

How to mock OwinContext.Request.Query

I am trying to unit test a method which checks for Query in OwinContext.Request.Query and alters it

public static async Task SetUpQuery(IOwinContext context, IClientStore clientConfig)
{
    // Get the ClientId from Querystring
    var clientIdQs = context.Request.Query.Where(x => x.Key == Constants.AuthorizeRequest.ClientId).Select(x => x.Value).FirstOrDefault();
    // Some more code here
}

I am using Moq to mock the context. How do I mock Query object which is of type IReadableStringCollection

Aucun commentaire:

Enregistrer un commentaire