Pregunta

I trying to figure out how to mole the

Microsoft.Practices.SharePoint.Common.ServiceLocation.SharePointServiceLocator.GetCurrentFarmLocator

because I trying to use

 Microsoft.Practices.SharePoint.Common.Logging.SharePointLogger.WriteToDeveloperTrace

some help or example?

No hay solución correcta

Otros consejos

I found a solution by myself using the SharePointServiceLocator. Basically I implemented this on my code:

            var replaceLocator = new ActivatingServiceLocator ( );
            SharePointServiceLocator.ReplaceCurrentServiceLocator ( replaceLocator );
            replaceLocator.RegisterTypeMapping < ILogger, MockLogger > ( InstantiationType.AsSingleton );
            replaceLocator.RegisterTypeMapping < ITraceLogger, MockLogger > ( InstantiationType.AsSingleton );
            replaceLocator.RegisterTypeMapping < IEventLogLogger, MockLogger > ( InstantiationType.AsSingleton );
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top