public SPWebSubstitute(Arg args) { WebsCollections = new WebsCollections(); Webs = new WebsSubstitute(this); Lists = new ListsSubstitute(this); if (args == null) { var site = new SPSiteSubstitute(Arg.Any()); site.OpenWeb().Returns(this); } Webs.Returns(WebsCollections); }
public void Returns(WebsCollections websCollections) { Substitute.Actions.Add(delegate { SetFakesDelegate(() => { var shim = new ShimSPWebCollection(); var webs = websCollections.SpWebs.Select(x => x.SpType); shim.ItemGetInt32 = i => websCollections.SpWebs[i].SpType; shim.Bind(webs); return(shim); }); }); }