Questions tagged [nsubstitute]

Any question related to NSubstitute in Sitecore context can make use of this tag.

Filter by
Sorted by
Tagged with
1 vote
1 answer
127 views

Sitecore Unit Testing Trouble w/ NSubstitute and Nunit

I am newer to Sitecore and extremely new to its unit testing. been following examples online that mimic exactly what I am trying to accomplish but I seem to be getting an object reference(you will see ...
pet3r15's user avatar
  • 13
2 votes
1 answer
260 views

How to mock MediaManager in Sitecore using nSubstitute and xUnit

I am in the process of setting up some unit tests for a Sitecore project (using this guide as a starting point: https://www.codeflood.net/blog/2020/05/17/logicless-view-itemless-model/) I have come ...
Dean OBrien's user avatar
  • 1,258
3 votes
1 answer
452 views

How to mock an ImageField in Sitecore using nSubstitute and xUnit

I am in the process of setting up some unit tests for a Sitecore project (using this guide as a starting point: https://www.codeflood.net/blog/2020/05/17/logicless-view-itemless-model/) I have come ...
Dean OBrien's user avatar
  • 1,258
3 votes
1 answer
205 views

Unit testing a Sitecore component controller throws exception in mocked service

I'm using xUnit, NSubstitute, FluentAssertions and Sitecore FakeDb. Here is the controller that needs a test, public class TransactionsController : Controller { private readonly ...
Venu Vustipalli's user avatar
3 votes
1 answer
465 views

Unit Testing with GlassMapper and GetItemByIdOptions

I have some code that retrieves a glass item like this: var root = this.RequestContext.SitecoreService.GetItem<ILookupFolderTemplate>( new GetItemByIdOptions(new Guid("{...
Ethan Schofer's user avatar