private static void ShimSpSiteObject() { var shimRootWeb = new ShimSPWeb(); shimRootWeb.TitleGet = () => RootWebTitle; var webList = new List <SPWeb>() { new ShimSPWeb() { TitleGet = () => WebTitle01 }.Instance }; var shimAllWebs = new ShimSPWebCollection() { CountGet = () => webList.Count }; var shimAllWebsBase = new ShimSPBaseCollection(shimAllWebs.Instance) { GetEnumerator = () => webList.GetEnumerator() }; ShimSPSite.AllInstances.RootWebGet = _ => shimRootWeb.Instance; ShimSPSite.AllInstances.AllWebsGet = _ => shimAllWebs.Instance; ShimSPSite.AllInstances.UrlGet = _ => SiteUrl; }
private void SetupProcessSecurityGroupsShims() { var groupList = new List <SPGroup>(); var shimSpGroupCollection = new ShimSPGroupCollection(); var shimSpBaseGroupCollection = new ShimSPBaseCollection(shimSpGroupCollection.Instance) { GetEnumerator = () => groupList.GetEnumerator() }; var userList = new List <SPUser>(); var shimSpUserCollection = new ShimSPUserCollection() { GetByIDInt32 = userId => new ShimSPUser() { IDGet = () => userId, GroupsGet = () => shimSpGroupCollection.Instance } }; var shimSpBaseUserCollection = new ShimSPBaseCollection(shimSpUserCollection.Instance) { GetEnumerator = () => userList.GetEnumerator() }; var shimRootWeb = new ShimSPWeb(_spShims.SiteShim.Instance.RootWeb) { SiteGroupsGet = () => shimSpGroupCollection.Instance, SiteUsersGet = () => shimSpUserCollection.Instance }; ShimSqlBulkCopy.AllInstances.WriteToServerDataTable = (_1, _2) => { }; }
private ShimSPFieldCollection CreateShimSpFieldCollection() { var fieldsDictionary = new Dictionary <string, SPField>(); var shimFields = new ShimSPFieldCollection(); shimFields.ContainsFieldString = fieldName => fieldsDictionary.ContainsKey(fieldName); shimFields.ItemGetString = fieldName => fieldsDictionary[fieldName]; shimFields.AddSPField = spField => { fieldsDictionary.Add(spField.TypeDisplayName, spField); return(spField.TypeDisplayName); }; shimFields.AddStringSPFieldTypeBoolean = (displayName, fieldType, required) => { var spField = CreateSpField(displayName, fieldType, fieldsDictionary.Count); fieldsDictionary.Add(displayName, spField); return(displayName); }; shimFields.CreateNewFieldStringString = (typeName, displayName) => { SPField spField; if (typeName == SPFieldType.Text.ToString()) { var spFieldText = new ShimSPFieldText(); spField = CreateSpField(displayName, SPFieldType.Text, fieldsDictionary.Count, spFieldText.Instance); } else { spField = CreateSpField(displayName, SPFieldType.Invalid, fieldsDictionary.Count); } return(spField); }; var shimBaseCollection = new ShimSPBaseCollection(shimFields.Instance); shimBaseCollection.GetEnumerator = () => fieldsDictionary.Values.ToList().GetEnumerator(); return(shimFields); }
internal static void Initialize() { ShimSPAutoSerializingObject.BehaveAsNotImplemented(); ShimSPBaseCollection.BehaveAsNotImplemented(); ShimSPWebCollection.BehaveAsNotImplemented(); }