public SimSPList this[Guid listId] { get { SPList sPList = this.FirstOrDefault((SPList list) => list.ID == listId); if (sPList != null) { return(SimSPList.FromInstance(sPList)); } throw new SPException("listId"); } }
public SimSPWeb(SPWeb instance) : base(instance) { this.fields = new SimSPFieldCollection(); this.availableFields = new SimSPFieldCollection(); this.lists = new SimSPListCollection(); this.users = new SimSPUserCollection(); this.features = new SimSPFeatureCollection(); this.contentTypes = new SimSPContentTypeCollection(); this.availableContentTypes = new SimSPContentTypeCollection(); this.folders = new SimSPFolderCollection(); this.properties = new SimSPPropertyBag(); this.webs = new SimSPWebCollection(this); this.allProperties = new Hashtable(); this.Exists = true; this.lists.Web = this.Instance; this.features.ScopeParent = this.Instance; this.contentTypes.Web = this.Instance; this.fields.Web = this.Instance; var shimSPWeb = new ShimSPWeb(instance); shimSPWeb.IDGet = (() => this.ID); shimSPWeb.UrlGet = (() => this.Url); shimSPWeb.TitleGet = (() => this.Title); shimSPWeb.NameGet = (() => this.Name); shimSPWeb.ParentWebGet = (() => this.ParentWeb); shimSPWeb.ParentWebIdGet = (() => this.ParentWebId); shimSPWeb.RootFolderGet = (() => this.RootFolder.Instance); shimSPWeb.ServerRelativeUrlGet = (() => this.ServerRelativeUrl); shimSPWeb.ServerRelativeUrlSetString = (delegate(string value) { this.ServerRelativeUrl = value; }); shimSPWeb.SiteGet = (() => this.Site); shimSPWeb.CurrentUserGet = (() => this.CurrentUser); shimSPWeb.AllowUnsafeUpdatesGet = (() => this.AllowUnsafeUpdates); shimSPWeb.AllowUnsafeUpdatesSetBoolean = (delegate(bool value) { this.AllowUnsafeUpdates = value; }); shimSPWeb.ExistsGet = (() => this.Exists); shimSPWeb.LocaleGet = (() => this.Locale); shimSPWeb.ListsGet = (() => this.lists.Instance); shimSPWeb.UsersGet = (() => this.users.Instance); shimSPWeb.FeaturesGet = (() => this.features.Instance); shimSPWeb.ContentTypesGet = (() => this.contentTypes.Instance); shimSPWeb.AvailableContentTypesGet = (() => this.availableContentTypes.Instance); shimSPWeb.FieldsGet = (() => this.fields.Instance); shimSPWeb.AvailableFieldsGet = (() => this.availableFields.Instance); shimSPWeb.PropertiesGet = (() => this.properties.Instance); shimSPWeb.WebsGet = (() => this.webs.Instance); shimSPWeb.AllPropertiesGet = (() => this.allProperties); shimSPWeb.FoldersGet = (() => this.folders.Instance); shimSPWeb.GetFolderString = (delegate(string url) { using (IEnumerator <SPFolder> enumerator = ( from folder in this.folders where folder.Url == url select folder).GetEnumerator()) { if (enumerator.MoveNext()) { return(enumerator.Current); } } throw new ArgumentException(url); }); shimSPWeb.GetFolderGuid = (delegate(Guid id) { using (IEnumerator <SPFolder> enumerator = ( from folder in this.folders where folder.UniqueId == id select folder).GetEnumerator()) { if (enumerator.MoveNext()) { return(enumerator.Current); } } throw new ArgumentException(id.ToString()); }); shimSPWeb.Dispose = (delegate { this.DisposeCount++; }); shimSPWeb.Update = (delegate { this.Updated = true; }); shimSPWeb.SetPropertyObjectObject = (delegate(object name, object value) { this.AllProperties[name] = value; }); shimSPWeb.GetPropertyObject = ((object name) => this.AllProperties[name]); shimSPWeb.GetListString = ((string url) => ( from list in this.Lists let blist = SimSPList.FromInstance(list) where blist != null && blist.Url == url select list).FirstOrDefault <SPList>()); shimSPWeb.Delete = (new FakesDelegates.Action(this.Delete)); this.Fake = shimSPWeb; }