当前位置: 首页>>代码示例>>C#>>正文


C# Facade.GetTabsOfUser方法代码示例

本文整理汇总了C#中Facade.GetTabsOfUser方法的典型用法代码示例。如果您正苦于以下问题:C# Facade.GetTabsOfUser方法的具体用法?C# Facade.GetTabsOfUser怎么用?C# Facade.GetTabsOfUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facade的用法示例。


在下文中一共展示了Facade.GetTabsOfUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: User_can_signup_and_have_registered_user_template_tabs

        public void User_can_signup_and_have_registered_user_template_tabs()
        {
            var facade = default(Facade);
            var anonUserProfile = default(UserProfile);
            var newlyAddedWidgetId = default(int);
            var registeredUserName = default(string);
            var registeredUserPassword = default(string);

            var regUserName = default(string);
            var regUserTabs = default(List<Tab>);

            "Given registered user template is on and an anonymous user who has made some changes to the page".Context(() =>
                {
                    anonUserProfile = MembershipHelper.CreateNewAnonUser();
                    facade = new Facade(new Context.AppContext(anonUserProfile.UserName, anonUserProfile.UserName));

                    var userSetup = facade.FirstVisitHomeTab(anonUserProfile.UserName, string.Empty, true, false);
                    var newWidgetToAdd = facade.GetWidgetList(anonUserProfile.UserName, Data.Enumerations.WidgetType.PersonalTab).First();
                    var newlyAddedWidget = facade.AddWidgetInstance(newWidgetToAdd.ID, 0, 0, 0);
                    newlyAddedWidgetId = newlyAddedWidget.Id;

                    // Load the anonymous user pages and widgets
                    regUserName = facade.GetUserSettingTemplate().RegisteredUserSettingTemplate.UserName;
                    regUserTabs = facade.GetTabsOfUser(facade.GetUserGuidFromUserName(regUserName));
                });

            "When user signs up".Do(() =>
                {
                    registeredUserName = Guid.NewGuid().ToString();
                    registeredUserPassword = Guid.NewGuid().ToString();
                    facade.RegisterUser(registeredUserName, registeredUserPassword, registeredUserName, false);
                });

            "It should replace the users tabs with the tabs and widgets of the registered user template".Assert(() =>
                {
                    var revisitModel = facade.RepeatVisitHomeTab(registeredUserName, string.Empty, false, false);
                    regUserTabs.Each(regTab =>
                    {
                        var userTab = revisitModel.UserTabs.First(page =>
                                        page.Title == regTab.Title
                                        && page.OrderNo == regTab.OrderNo
                                        && page.PageType == regTab.PageType);

                        facade.GetColumnsInTab(regTab.ID).Each(regColumn =>
                        {
                            var userColumns = facade.GetColumnsInTab(userTab.ID);
                            var userColumn = userColumns.First(column =>
                                            column.ColumnNo == regColumn.ColumnNo);

                            var anonColumnWidgets = facade.GetWidgetInstancesInZoneWithWidget(regColumn.WidgetZone.ID);
                            var userColumnWidgets = facade.GetWidgetInstancesInZoneWithWidget(userColumn.WidgetZone.ID);

                            // Ensure the widgets from the anonymous user template's columns are 
                            // in the same column and row.
                            anonColumnWidgets.Each(anonWidget => Assert.True(userColumnWidgets.Where(userWidget =>
                                    userWidget.Title == anonWidget.Title
                                    && userWidget.Expanded == anonWidget.Expanded
                                    && userWidget.State == anonWidget.State
                                    && userWidget.Resized == anonWidget.Resized
                                    && userWidget.Height == anonWidget.Height
                                    && userWidget.OrderNo == anonWidget.OrderNo).Count() == 1));
                        });
                    });

                });

            "It should allow user to login to access the pages".Assert(() =>
                {
                    Assert.True(facade.Login(registeredUserName, registeredUserPassword));
                });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:71,代码来源:TestSignup.cs


注:本文中的Facade.GetTabsOfUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。