London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hello Everyone,
I updated EPiServer today from version 7.14.1 to 7.18.0 and now all my unit tests are failing!
EPiServer.ServiceLocation.ActivationExceptionActivation error occurred while trying to get instance of type ILanguageBranchRepository, key ""
I seem to be unable to create a fake ContentLanguage instance now in order to set ContentLanguage.Instance before my tests can run. It also does not seem possible to create a fake ILanguageBranchRepository. Previously it was fine to run
new ContentLanguage()
That constructor seems to be removed now and the new one requires an instance of an ILanguageBranchRepository.
new ContentLanguage(A.Fake<ILanguageBranchRepository>())
fails with the same error message though.
Here's my code that worked previously:
public CmsContext() { //ContentReference.StartPage = new PageReference(4); this.StartPageUrl = "/"; GlobalizationSettings.CultureLanguageCode = GlobalizationSettings.UICultureLanguageCode = MasterCulture.Name; ContentLanguage.Instance = A.Fake<ContentLanguage>(); // THIS DOES NOT WORK ANYMORE IN EPI 7.18!!! A.CallTo(() => ContentLanguage.Instance.FinalFallbackCulture).Returns(MasterCulture); Context.Current = A.Fake<IContext>(); A.CallTo(() => Context.Current.RequestTime).Returns(DateTime.Now); ServiceLocator.SetLocator(A.Fake<IServiceLocator>()); this.ContentLoader = A.Fake<IContentLoader>(); this.UrlResolver = A.Fake<UrlResolver>(); this.TemplateResolver = A.Fake<TemplateResolver>(); A.CallTo(() => ServiceLocator.Current.GetInstance<TemplateResolver>()).Returns(this.TemplateResolver); A.CallTo(() => this.UrlResolver.GetUrl(ContentReference.StartPage)).Returns(this.StartPageUrl); }