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


C# Facade.FirstVisitHomeTab方法代码示例

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


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

示例1: User_should_be_able_change_page_title

        public void User_should_be_able_change_page_title()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var userSetup = default(UserSetup);
            var newName = Guid.NewGuid().ToString();
            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user changes title of current page".Do(() =>
            {
                facade.ChangeTabName(newName);
            });

            "It should persist and on next visit the new page title should reflect".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);
                Assert.Equal(newName, userTabSetup.CurrentTab.Title);
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:25,代码来源:TestPageStuff.cs

示例2: 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

示例3: 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

示例4: User_should_be_able_to_add_new_page

        public void User_should_be_able_to_add_new_page()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);

            "Given a new user".Context(() =>
                {
                    profile = MembershipHelper.CreateNewAnonUser();
                    facade = new Facade(new AppContext(string.Empty, profile.UserName));

                    facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
                });

            "When user adds a new page".Do(() =>
                {
                    var newTab = facade.CreateTab("Some New Tab", 0);
                });

            "It should add a new blank page as current page".Assert(() =>
                {
                    var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);
                    Assert.Equal("Some New Tab", userTabSetup.CurrentTab.Title);
                });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:24,代码来源:TestPageStuff.cs

示例5: 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

示例6: 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

示例7: 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

示例8: User_should_be_able_delete_a_page

        public void User_should_be_able_delete_a_page()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var userSetup = default(UserSetup);
            var deletedTabId = default(int);

            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user deletes the current page".Do(() =>
            {
                facade.DeleteTab(userSetup.CurrentTab.ID);
            });

            "It should not appear on next visit".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);
                Assert.DoesNotContain<int>(deletedTabId, 
                    facade.GetTabsOfUser(userTabSetup.CurrentUserId).Select(p => p.ID));
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:27,代码来源:TestPageStuff.cs

示例9: User_should_not_be_able_to_use_same_page_title_in_more_than_one_page

        public void User_should_not_be_able_to_use_same_page_title_in_more_than_one_page()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var userSetup = default(UserSetup);
            var newName = Guid.NewGuid().ToString();
            var newTitle = default(string);
            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user changes title of one page to the title of another page".Do(() =>
            {
                // Create a new page
                var newTab = facade.CreateTab(Guid.NewGuid().ToString(), 0);
                newTitle = newTab.Title;
                // Change back to the old page
                facade.SetCurrentTab(facade.GetUserGuidFromUserName(profile.UserName), userSetup.CurrentTab.ID);
                // Set the same title as the newly created page
                facade.ChangeTabName(newTitle);
            });

            "It should automatically change the title to some unique title by adding some number".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);
                Assert.NotEqual(newTitle, userTabSetup.CurrentTab.Title);
                
                // Ensure there's no two pages with same title
                Assert.False(userTabSetup.UserTabs.Exists(p1 => userTabSetup.UserTabs.Exists(p2 => p1.Title == p2.Title 
                    && p1.ID != p2.ID)));
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:36,代码来源:TestPageStuff.cs

示例10: User_can_signup_to_save_changes_made_to_anon_pages

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

            "Given registered user template is off 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;
                });

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

            "It should preserve the tabs and changes made to the tabs upon revisit".Assert(() =>
                {
                    var revisitModel = facade.RepeatVisitHomeTab(registeredUserName, string.Empty, false, false);
                    var firstColumnWidgetZone = facade.GetColumnsInTab(revisitModel.CurrentTab.ID).First().WidgetZone;
                    var widgets = facade.GetWidgetInstancesInZoneWithWidget(firstColumnWidgetZone.ID);

                    Assert.NotNull(widgets.First(w => w.Id == newlyAddedWidgetId));
                });

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

示例11: 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

示例12: User_should_be_able_to_delete_an_widget_from_page

        public void User_should_be_able_to_delete_an_widget_from_page()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var wiId = default(int);
            var userSetup = default(UserSetup);
            
            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user adds a new page".Do(() =>
            {
                var widgets = facade.GetWidgetInstancesInZoneWithWidget(
                    facade.GetColumnsInTab(userSetup.CurrentTab.ID).First().WidgetZone.ID);

                wiId = widgets.First().Id;
                facade.DeleteWidgetInstance(wiId);
            });

            "It should add a new blank page as current page".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);

                var widgets = facade.GetWidgetInstancesInZoneWithWidget(
                    facade.GetColumnsInTab(userSetup.CurrentTab.ID).First().WidgetZone.ID);

                Assert.Equal(0, widgets.Where(wi => wi.Id == wiId).Count());
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:34,代码来源:TestWidgetStuff.cs

示例13: User_should_be_add_a_new_widget_on_a_column_which_will_push_down_other_widets

        public void User_should_be_add_a_new_widget_on_a_column_which_will_push_down_other_widets()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var userSetup = default(UserSetup);
            var newState = Guid.NewGuid().ToString();
            var addedWidgetInstance = default(WidgetInstance);
            var widgetToAdd = default(Widget);

            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user adds a new widget on a column".Do(() =>
            {
                var widgets = facade.GetWidgetList(profile.UserName, Enumerations.WidgetType.PersonalTab);
                widgetToAdd = widgets.First();
                //var columns = facade.GetColumnsInTab(userSetup.CurrentTab.ID);
                //var firstColumn = columns.First();

                //addedWidgetInstance = facade.AddWidgetInstance(widgets.First().ID, 0, firstColumn.ColumnNo, firstColumn.WidgetZone.ID);
                addedWidgetInstance = facade.AddWidgetInstance(widgetToAdd.ID, 0, 0, 0);

            });

            "It should add the widget at the first position and push down other widgets and the widget is visible".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);

                var widgets = facade.GetWidgetInstancesInZoneWithWidget(
                    facade.GetColumnsInTab(userSetup.CurrentTab.ID).First().WidgetZone.ID);

                Assert.Equal(addedWidgetInstance.Id, widgets.First().Id);
                Assert.Equal(addedWidgetInstance.Widget.ID, widgetToAdd.ID);
                Assert.Equal(true, addedWidgetInstance.Expanded);
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:41,代码来源:TestWidgetStuff.cs

示例14: User_should_be_able_to_change_widget_state

        public void User_should_be_able_to_change_widget_state()
        {
            var facade = default(Facade);
            var profile = default(UserProfile);
            var wiId = default(int);
            var userSetup = default(UserSetup);
            var newState = Guid.NewGuid().ToString();

            "Given a new user".Context(() =>
            {
                profile = MembershipHelper.CreateNewAnonUser();
                facade = new Facade(new AppContext(string.Empty, profile.UserName));

                userSetup = facade.FirstVisitHomeTab(profile.UserName, string.Empty, true, false);
            });

            "When user changes a widget's state and saves it".Do(() =>
            {
                var widgets = facade.GetWidgetInstancesInZoneWithWidget(
                    facade.GetColumnsInTab(userSetup.CurrentTab.ID).First().WidgetZone.ID);

                var widgetInstance = widgets.First();
                wiId = widgetInstance.Id;

                widgetInstance.State = newState;
            });

            "It should preserve the state on the next visit".Assert(() =>
            {
                var userTabSetup = facade.RepeatVisitHomeTab(profile.UserName, string.Empty, true, false);

                var widgets = facade.GetWidgetInstancesInZoneWithWidget(
                    facade.GetColumnsInTab(userSetup.CurrentTab.ID).First().WidgetZone.ID);

                var widgetInstance = widgets.Where(wi => wi.Id == wiId).First();
                Assert.Equal(newState, widgetInstance.State);
            });
        }
开发者ID:modulexcite,项目名称:dropthings,代码行数:38,代码来源:TestWidgetStuff.cs


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