November Happy Hour will be moved to Thursday December 5th.

Fix EPi 9 Breaking Changes for Unit Test setup

Vote:
 

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?

#138980
Sep 24, 2015 15:00
Vote:
 

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

/Q

#138998
Sep 24, 2015 15:45
Vote:
 

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 https://github.com/DavidVujic/EPiServer-FakeMaker/ and commented out these lines and nuget-updated EPi in there as well.

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

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

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


Now my tests are succeeding again.

#139100
Edited, Sep 25, 2015 10:30
Vote:
 

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!

https://github.com/DavidVujic/EPiServer-FakeMaker/

/David

#144108
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.