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


C# Facade.AddWidget方法代码示例

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


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

示例1: Admin_user_can_delete_a_newly_created_widget

        public void Admin_user_can_delete_a_newly_created_widget()
        {
            var facade = default(Facade);
            var newWidget = default(Widget);
            var userFacade = default(Facade);
            var someNewUser = default(UserProfile);
            var addedWidgetInstance = default(WidgetInstance);

            "Given admin user and a newly created widget assigned to some roles and users using the widget".Context(() =>
                {
                    facade = new Facade(new AppContext(string.Empty, ADMIN_USER));

                    newWidget = facade.AddWidget("Test Widget",
                        "omaralzabir.com", string.Empty, "Test widget",
                        string.Empty, false, false, 0, "guest",
                        (int)Enumerations.WidgetType.PersonalTab);
                    facade.AssignWidgetRoles(newWidget.ID, new string[] { GUEST_ROLE });

                    someNewUser = MembershipHelper.CreateNewAnonUser();
                    userFacade = new Facade(new AppContext(someNewUser.UserName, someNewUser.UserName));
                    var userSetup = userFacade.FirstVisitHomeTab(someNewUser.UserName, string.Empty, true, false);
                    addedWidgetInstance = userFacade.AddWidgetInstance(newWidget.ID, 0, 0, 0);
                    Assert.NotNull(addedWidgetInstance);
                });

            "When admin user deletes the widget".Do(() =>
                {
                    facade.DeleteWidget(newWidget.ID);
                });

            "It should delete the widget completely from all users pages".Assert(() =>
                {
                    Assert.False(facade.GetAllWidgets().Exists(w => w.ID == newWidget.ID));
                    Assert.False(userFacade.GetAllWidgets().Exists(w => w.ID == newWidget.ID));
                    // OMAR: Turning off as this comes from cache, not from database
                    // Assert.Throws<InvalidOperationException>(() => userFacade.GetWidgetInstanceById(addedWidgetInstance.Id));
                });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:38,代码来源:TestAdminStuff.cs


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