Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
                });
            });
        }