本文整理汇总了C#中Facade.AssignWidgetRoles方法的典型用法代码示例。如果您正苦于以下问题:C# Facade.AssignWidgetRoles方法的具体用法?C# Facade.AssignWidgetRoles怎么用?C# Facade.AssignWidgetRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facade
的用法示例。
在下文中一共展示了Facade.AssignWidgetRoles方法的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));
});
}