Hi,
How I can test the code below:
public static void ActivateWebFeature(SPWeb web, Guid featureId)
{
if (web.Features[featureId] == null) // check if the feature is enabled
{
web.Features.Add(featureId, true);
web.Update();
}
}
The problem is that "web.Features[featureId]" part is always null.
I've tried with
Guid featureId = Guid.NewGuid();
var feature = Isolate.Fake.Instance<SPFeature>(Members.ReturnRecursiveFakes);
Isolate.WhenCalled(() => web.Features[featureId]).WillReturn(feature);
but no luck. Please advise.