Beispiel #1
0
        void visiting_home_page()
        {
            act = () => result = controller.Index();

            context["given user has games"] = () =>
            {
                before = () => GivenUserHasGame(user, GivenGame("Mirror's Edge"));

                it["view is notified that user has games"] = () => ((bool)result.ViewBag.HasGames).should_be_true();
            };

            context["given user hasn't provided a handle"] = () =>
            {
                it["user's handle is null"] = () => ((string)result.ViewBag.Handle).should_be(null);
            };

            context["user has a handle specified"] = () =>
            {
                before = () => controller.Handle(new { handle = "@amirrajan" });

                it["returns user's handle"] = () => ((string)result.ViewBag.Handle).should_be("@amirrajan");
            };

            context["user has friends"] = () =>
            {
                before = () =>
                {
                    var friendId = GivenUser("*****@*****.**");

                    Users users = new Users();

                    users.Single(user).AddFriend(users.Single(friendId));
                };

                it["view is notified that user has friends"] = () => ((bool)result.ViewBag.HasFriends).should_be_true();
            };
        }