In my code I create a SharePoint site collection object (SPSite) using a url.
So I want to mock that site collection object, but I dont know how to swap out a thing like that which is not referenced to anything that I can call statically like SPContext.Current.Web. In TypeMock it would be something like this...
Thank you
using (var siteCollection = new SPSite(spWebAppUri + siteUrl)) { // more code... }So I want to mock that site collection object, but I dont know how to swap out a thing like that which is not referenced to anything that I can call statically like SPContext.Current.Web. In TypeMock it would be something like this...
// the next time a new instance of SPSite is created, use our fake one instead Isolate.Swap.NextInstance<SPSite>().With(fakeSite);Thank you