示例#1
0
        public SimWebCollection(WebCollection instance, SimWeb parent)
            : base(instance)
        {
            Parent = parent;

            this.Fake.AddWebCreationInformation = (options) => AddWeb(options).Instance;

            new SimClientObjectCollection(this.Instance);
        }
示例#2
0
        public SimWeb AddWeb(WebCreationInformation options)
        {
            var url = new Uri(Parent.Url.TrimEnd('/') + '/' + options.Url);

            var simWeb = new SimWeb
            {
                Title             = options.Title,
                Url               = url.AbsoluteUri.TrimEnd('/'),
                ServerRelativeUrl = url.AbsolutePath,
                Description       = options.Description
            };

            // todo: add other properties
            this.Add(simWeb.Instance);

            return(simWeb);
        }
示例#3
0
        internal SimSite(Site instance, Uri siteUrl)
            : base(instance)
        {
            Fake.AllowCreateDeclarativeWorkflowGet        = () => AllowCreateDeclarativeWorkflow;
            Fake.AllowCreateDeclarativeWorkflowSetBoolean = (b) => AllowCreateDeclarativeWorkflow = b;
            Fake.AllowDesignerGet                                 = () => AllowDesigner;
            Fake.AllowDesignerSetBoolean                          = (b) => AllowDesigner = b;
            Fake.AllowMasterPageEditingGet                        = () => AllowMasterPageEditing;
            Fake.AllowMasterPageEditingSetBoolean                 = (b) => AllowMasterPageEditing = b;
            Fake.AllowRevertFromTemplateGet                       = () => AllowRevertFromTemplate;
            Fake.AllowRevertFromTemplateSetBoolean                = (b) => AllowRevertFromTemplate = b;
            Fake.AllowSaveDeclarativeWorkflowAsTemplateGet        = () => AllowSaveDeclarativeWorkflowAsTemplate;
            Fake.AllowSaveDeclarativeWorkflowAsTemplateSetBoolean = (b) => AllowSaveDeclarativeWorkflowAsTemplate = b;
            Fake.AllowSavePublishDeclarativeWorkflowGet           = () => AllowSavePublishDeclarativeWorkflow;
            Fake.AllowSavePublishDeclarativeWorkflowSetBoolean    = (b) => AllowSavePublishDeclarativeWorkflow = b;
            Fake.AllowSelfServiceUpgradeEvaluationGet             = () => AllowSelfServiceUpgradeEvaluation;
            Fake.AllowSelfServiceUpgradeEvaluationSetBoolean      = (b) => AllowSelfServiceUpgradeEvaluation = b;
            Fake.AllowSelfServiceUpgradeGet                       = () => AllowSelfServiceUpgrade;
            Fake.AllowSelfServiceUpgradeSetBoolean                = (b) => AllowSelfServiceUpgrade = b;
            Fake.AuditGet = () => this.Audit;
            Fake.AuditLogTrimmingRetentionGet      = () => AuditLogTrimmingRetention;
            Fake.AuditLogTrimmingRetentionSetInt32 = (i) => AuditLogTrimmingRetention = i;
            Fake.CanUpgradeGet         = () => CanUpgrade;
            Fake.CompatibilityLevelGet = () => CompatibilityLevel;
            Fake.EventReceiversGet     = () => this.EventReceivers;
            Fake.FeaturesGet           = () => this.Features;
            Fake.GetCatalogInt32       = (typeCatalog) => this.GetCatalog(typeCatalog);
            Fake.IdGet           = () => Id;
            Fake.OpenWebByIdGuid = (id) =>
            {
                return(OpenWeb((w) => w.Id == id));
            };
            Fake.OpenWebString = (url) =>
            {
                return(OpenWeb((w) => w.Url == url));
            };
            Fake.OwnerGet      = () => Owner;
            Fake.OwnerSetUser  = (u) => this.Owner = u;
            Fake.PrimaryUriGet = () => PrimaryUri;
            Fake.RootWebGet    = () => RootWeb.Instance;
            //Fake.ServerRelativeUrlGet = () => ServerRelativeUrl;
            //Fake.UrlGet = () => Url;
            Fake.UserCustomActionsGet = () => UserCustomActions;

            this.CurrentWeb = new SimWeb
            {
                Site              = Fake,
                Title             = "Team Site",
                Url               = siteUrl.AbsoluteUri.TrimEnd('/'),
                ServerRelativeUrl = siteUrl.AbsolutePath
            };
            _webs = new SimWebCollection(CurrentWeb);
            _webs.Add(CurrentWeb.Instance);

            if (UrlUtility.IsUrlRootWeb(siteUrl))
            {
                this.RootWeb = CurrentWeb;
            }
            else
            {
                var rootUrl = UrlUtility.GetRootWebUri(siteUrl);
                this.RootWeb = new SimWeb
                {
                    Site              = Fake,
                    Title             = "Team Site",
                    Url               = rootUrl.AbsoluteUri.TrimEnd('/'),
                    ServerRelativeUrl = rootUrl.AbsolutePath
                };

                _webs.Add(RootWeb.Instance);
            }
        }
示例#4
0
 public SimWebCollection(SimWeb parent)
     : this(ShimRuntime.CreateUninitializedInstance <WebCollection>(), parent)
 {
 }