Beispiel #1
0
 void before_each()
 {
     session = new Dictionary<string, dynamic>();
     seedController = new SeedController();
     seedController.DeleteAllRecords();
     Users = new Users();
 }
Beispiel #2
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();
            };
        }
Beispiel #3
0
        public BaseController()
        {
            users = new Users();

            Email = () => base.User.Identity.Name;
        }
Beispiel #4
0
        private void SeedFriend(string from, string to)
        {
            var users = new Users();

            var user = users.ForHandle("@" + from);

            var friend = users.ForHandle("@" + to);

            user.AddFriend(friend);
        }