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


C# Facade.GetWidgetInstancesInZoneWithWidget方法代码示例

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


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

示例1: Widget_should_be_able_to_move_to_another_column

        public void Widget_should_be_able_to_move_to_another_column()
        {
            var profile = default(UserProfile);
            UserSetup userVisitModel = default(UserSetup);
            var facade = default(Facade);
            var widgetInstance = default(WidgetInstance);
            var userColumns = default(List<Column>);
            var secondColumn = default(Column);
            var noOfWidgetsOnSeconColumn = default(int);

            "Given a new user and a widget on user's page".Context(() =>
                {
                    profile = MembershipHelper.CreateNewAnonUser();
                    facade = new Facade(new AppContext(string.Empty, profile.UserName));
                    userVisitModel = facade.FirstVisitHomeTab(profile.UserName, "Test", true, false);

                    userColumns = facade.GetColumnsInTab(userVisitModel.CurrentTab.ID);
                    var firstColumn = userColumns.First();
                    var widgetsOnColumn = facade.GetWidgetInstancesInZoneWithWidget(firstColumn.WidgetZone.ID);

                    widgetInstance = widgetsOnColumn.First();
                });

            "When the widget is moved to another column".Do(() =>
                {
                    secondColumn = userColumns.ElementAt(1);
                    noOfWidgetsOnSeconColumn = facade.GetWidgetInstancesInZoneWithWidget(secondColumn.WidgetZone.ID).Count();
            
                    facade.MoveWidgetInstance(widgetInstance.Id, secondColumn.WidgetZone.ID, 1);                    
                });

            "It should remain there permanently".Assert(() =>
                {
                    var newWidgetsOnSecondColumn = facade.GetWidgetInstancesInZoneWithWidget(secondColumn.WidgetZone.ID);

                    var widgetAfterMove = newWidgetsOnSecondColumn.Where(wi => wi.OrderNo == 1).FirstOrDefault();
                    Assert.NotNull(widgetAfterMove);
                    Assert.Equal(widgetInstance.Id, widgetAfterMove.Id);
                });

            "It should push down other widgets where it is dropped".Assert(() =>
                {
                    var newWidgetsOnSecondColumn = facade.GetWidgetInstancesInZoneWithWidget(secondColumn.WidgetZone.ID);
                    // There should be 1 widget before it
                    Assert.Equal(1, newWidgetsOnSecondColumn.Where(wi => wi.OrderNo < 1).Count());
                    // There should be N-1 widgets after it where N = before move number of columns
                    Assert.Equal(noOfWidgetsOnSeconColumn - 1, newWidgetsOnSecondColumn.Where(wi => wi.OrderNo > 1).Count());
                });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:49,代码来源:TestWidgetStuff.cs


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