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


C# Facade.CreateTab方法代码示例

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


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

示例1: User_changes_3_column_view_to_1_column_view

        public void User_changes_3_column_view_to_1_column_view()
        {
            var facade = default(Facade);
            var user = default(UserProfile);
            var userSetup = default(UserSetup);
            var widgets = default(List<Widget>);

            var threeColumnLayoutNo = 0;
            var oneColumnLayoutNo = 4;

            var widgetMap = new Dictionary<int, List<int>>();

            "Given a page with 3 columns and widgets on all 3 columns".Context(() =>
            {
                user = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(user.UserName, user.UserName));

                userSetup = facade.FirstVisitHomeTab(user.UserName, string.Empty, true, false);
                facade.CreateTab("Test Tab for Widget Delete", threeColumnLayoutNo);

                // Add all the widgets on each column
                widgets = facade.GetWidgetList(user.UserName, Data.Enumerations.WidgetType.PersonalTab);
                for (int columnNo = 0; columnNo < 3; columnNo++)
                {
                    widgetMap[columnNo] = new List<int>();
                    for (int i = 0; i < widgets.Count; i++)
                    {
                        var wi = facade.AddWidgetInstance(widgets[i].ID, i, columnNo, 0);
                        widgetMap[columnNo].Add(wi.Id);
                    }
                }
            });

            "When the page is switched to 2 column mode".Do(() =>
            {
                facade.ModifyTabLayout(oneColumnLayoutNo);
            });

            "It should move all the widgets on 3rd column to 2nd column after the existing 2nd column widgets".Assert(() =>
            {
                userSetup = facade.RepeatVisitHomeTab(user.UserName, string.Empty, true, false);
                Assert.Equal(1, userSetup.CurrentTab.ColumnCount);

                var columns = facade.GetColumnsInTab(userSetup.CurrentTab.ID);
                Assert.Equal(1, columns.Count);

                var firstColumn = columns[0];
                
                // Ensure first column has the same number of widgets as it was created
                var firstColumnWidgets = facade.GetWidgetInstancesInZoneWithWidget(firstColumn.WidgetZone.ID);
                Assert.Equal(widgetMap[0].Count + widgetMap[1].Count + widgetMap[2].Count,
                    firstColumnWidgets.Count());

                var idEnumerator = Enumerable.Concat(
                    Enumerable.Concat(widgetMap[0].AsEnumerable(), widgetMap[1].AsEnumerable()),
                    widgetMap[2].AsEnumerable()).GetEnumerator();

                var firstColumnWidgetEnumerator = firstColumnWidgets.GetEnumerator();
                while (idEnumerator.MoveNext())
                {
                    firstColumnWidgetEnumerator.MoveNext();
                    Assert.Equal(idEnumerator.Current, firstColumnWidgetEnumerator.Current.Id);
                }
            });

        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:66,代码来源:TestPageStuff.cs

示例2: User_can_change_page_layout_from_1_to_2

        public void User_can_change_page_layout_from_1_to_2()
        {
            var user = default(UserProfile);
            var facade = default(Facade);
            var userSetup = default(UserSetup);

            var oneColumnLayoutNo = 4;
            var twoColumnLayoutNo = 2;

            "Given a user with a one column page layout".Context(() =>
                {
                    user = MembershipHelper.CreateNewAnonUser();
                    facade = new Facade(new AppContext(user.UserName, user.UserName));

                    userSetup = facade.FirstVisitHomeTab(user.UserName, string.Empty, true, false);
                    facade.CreateTab("Test Tab 1 column", oneColumnLayoutNo);
                });

            "When user changes the page layout to two columns".Do(() =>
                {
                    facade.ModifyTabLayout(twoColumnLayoutNo);
                });

            "It should introduce a blank column after the two columns".Assert(() =>
                {
                    userSetup = facade.RepeatVisitHomeTab(user.UserName, string.Empty, true, false);
                    var columns = facade.GetColumnsInTab(userSetup.CurrentTab.ID);
                    Assert.Equal(2, columns.Count);

                    var secondColumn = columns[1];
                    var widgetsOnSecondColumn = facade.GetWidgetInstancesInZoneWithWidget(secondColumn.WidgetZone.ID);
                    Assert.Equal(0, widgetsOnSecondColumn.Count());
                });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:34,代码来源:TestPageStuff.cs

示例3: User_changes_3_column_view_to_2_column_view

        public void User_changes_3_column_view_to_2_column_view()
        {
            var facade = default(Facade);
            var user = default(UserProfile);
            var userSetup = default(UserSetup);
            var widgets = default(List<Widget>);

            var threeColumnLayoutNo = 0;
            var twoColumnLayoutNo = 2;

            var widgetMap = new Dictionary<int, List<int>>();

            "Given a page with 3 columns and widgets on all 3 columns".Context(() =>
                {
                    user = MembershipHelper.CreateNewAnonUser();
                    facade = new Facade(new AppContext(user.UserName, user.UserName));

                    userSetup = facade.FirstVisitHomeTab(user.UserName, string.Empty, true, false);
                    facade.CreateTab("Test Tab for Widget Delete", threeColumnLayoutNo);

                    // Add all the widgets on each column
                    widgets = facade.GetWidgetList(user.UserName, Data.Enumerations.WidgetType.PersonalTab);
                    for (int columnNo = 0; columnNo < 3; columnNo++)
                    {
                        widgetMap[columnNo] = new List<int>();
                        for (int i = 0; i < widgets.Count; i++)
                        {
                            var wi = facade.AddWidgetInstance(widgets[i].ID, i, columnNo, 0);
                            widgetMap[columnNo].Add(wi.Id);
                        }
                    }                    
                });

            "When the page is switched to 2 column mode".Do(() =>
                {
                    facade.ModifyTabLayout(twoColumnLayoutNo);                    
                });

            "It should move all the widgets on 3rd column to 2nd column after the existing 2nd column widgets".Assert(() =>
                {
                    userSetup = facade.RepeatVisitHomeTab(user.UserName, string.Empty, true, false);
                    Assert.Equal(2, userSetup.CurrentTab.ColumnCount);

                    var columns = facade.GetColumnsInTab(userSetup.CurrentTab.ID);
                    Assert.Equal(2, columns.Count);

                    var firstColumn = columns[0];
                    var secondColumn = columns[1];

                    // Ensure column widgets are all correct                    

                    // Ensure first column has the same number of widgets as it was created
                    var firstColumnWidgets = facade.GetWidgetInstancesInZoneWithWidget(firstColumn.WidgetZone.ID);
                    Assert.Equal(widgetMap[firstColumn.ColumnNo].Count, firstColumnWidgets.Count());
                    firstColumnWidgets.Each(wi => Assert.True(widgetMap[firstColumn.ColumnNo].Contains(wi.Id)));

                    // Ensure second column has both second and third column widgets
                    var secondColumnWidgets = facade.GetWidgetInstancesInZoneWithWidget(secondColumn.WidgetZone.ID);
                    Assert.Equal(widgetMap[secondColumn.ColumnNo].Count + widgetMap[2].Count,
                        secondColumnWidgets.Count());

                    var secondColumnIdEnumerator = widgetMap[secondColumn.ColumnNo].GetEnumerator();
                    var secondColumnWidgetEnumerator = secondColumnWidgets.GetEnumerator();

                    // Ensure the second column's original widgets are in the exact same position
                    while (secondColumnIdEnumerator.MoveNext())
                    {
                        secondColumnWidgetEnumerator.MoveNext();
                        Assert.Equal(secondColumnIdEnumerator.Current, secondColumnWidgetEnumerator.Current.Id);
                    }

                    // Ensure the third column widgets are added after the second column widgets
                    var thirdColumnIdEnumerator = widgetMap[2].GetEnumerator();
                    while (thirdColumnIdEnumerator.MoveNext())
                    {
                        secondColumnWidgetEnumerator.MoveNext();
                        Assert.Equal(thirdColumnIdEnumerator.Current, secondColumnWidgetEnumerator.Current.Id);
                    }
                });

        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:81,代码来源:TestPageStuff.cs


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