tiagodaraujo / HttpContextMoq

MIT License
34 stars 14 forks source link

Support for setting and accessing HttpContext.Items #7

Closed mebymyself closed 1 year ago

mebymyself commented 1 year ago

Hello, I am working on multitenant application and crucial part of the tenant resolution is to store the resolved tenant Id in context.Items within my middleware and retrive it later.

How can I set up HttpContextMoq to actually store the items?

tiagodaraujo commented 1 year ago

Hi @mebymyself

Yes, you can! In the latest version, I created a test sample to show how to set up a HttpContext with fake Items.

Please check the sample here: https://github.com/tiagodaraujo/HttpContextMoq/blob/master/tests/HttpContextMoq.Samples/HttpContextItems.cs

Thank you for opening an issue with your question. Hope this answer helps you.

mebymyself commented 1 year ago

@tiagodaraujo Thank you! my tests are passing now