Join Discord
Powered by
Mocking IUmbracoContextFactory and EnsureUmbracoCo...
# help-with-umbraco
a
Abra
12/21/2023, 8:55 AM
Trying to figure out the best way to mocking EnsureUmbracoContext in IUmbracoContextFactory in a unit test. Does anyone have an example of how to do this in a nice way?
j
Jemayn
12/21/2023, 9:15 AM
Umbracos own code has a bunch of tests, have you looked in there`? Fx this:
https://github.com/umbraco/Umbraco-CMS/blob/422218ea1599e961385eca4ec92a5cafb8fbe5f2/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackgroundJobs/Jobs/ScheduledPublishingJobTests.cs#L59
a
Abra
12/21/2023, 9:21 AM
Ah, of course. Didn't think about looking there. Thanks
10
Views
Previous
Next