Exemplo n.º 1
0
        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));
            });
        }
Exemplo n.º 2
0
        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));
                });
        }
Exemplo n.º 3
0
        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));
            });
        }
Exemplo n.º 4
0
        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);
                }
            });

        }
Exemplo n.º 5
0
        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);
                    }
                });

        }
Exemplo n.º 6
0
        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);
                }
            });
        }
Exemplo n.º 7
0
        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);
                }
            });
        }
Exemplo n.º 8
0
        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));
                });
        }
Exemplo n.º 9
0
        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));
                });
        }
Exemplo n.º 10
0
        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));
            });
        }