Fix EPi 9 Breaking Changes for Unit Test setup


I'm looking at a Unit Test project where some things were setup with these lines.

EPiServer.BaseLibrary.ClassFactory.Instance = new EPiServer.DefaultBaseLibraryFactory(string.Empty);
EPiServer.BaseLibrary.ClassFactory.RegisterClass(typeof(EPiServer.BaseLibrary.IRuntimeCache), typeof(EPiServer.Implementation.DefaultRuntimeCache));

How would I convert this to something that works with 9.0.3?

Sep 24, 2015 15:00

Shouldn't you remove those entirely? Which classes/methods do you want to use?


Sep 24, 2015 15:45

At first I thought the error was due to commenting those lines out and not replacing them with anything.

But I soon found it was an issue with DataLibrary in the FakeMaker library referenced.

I cloned the source from and commented out these lines and nuget-updated EPi in there as well.

////var fakeEpiBaseLibraryContext = new Mock<IContext>();
////    .Setup(fake => fake.RequestTime)
////    .Returns(DateTime.Now);

////var fakeBaseFactory = new Mock<IBaseLibraryFactory>();
////    .Setup(factory => factory.CreateContext())
////    .Returns(fakeEpiBaseLibraryContext.Object);

////ClassFactory.Instance = fakeBaseFactory.Object;

Now my tests are succeeding again.

Edited, Sep 25, 2015 10:30

FakeMaker is now updated with EPi 9 binaries and the rows that caused the build failure (EPi 9 breaking changes) are now removed from the code. Please let me know if you run into any issues!


Feb 05, 2016 21:55
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.