コード例 #1
0
        public ActionResult AddRobotForm(RobotActivationCode activationCode)
        {
            var robot = _robotManager.GetRobotByActivationCode(activationCode.Code);

            _robotManager.BindRobotToUser(robot, FakeSession.User);
            FakeSession.RobotIds.Add(robot.RobotID);
            return(RedirectToAction("ShowMyRobots", "Robot", new { category = "My Robots" }));
        }
コード例 #2
0
        public void BindRobotToUserLogicTest()
        {
            var user  = data.Users.Data.First();
            var robot = data.Robots.Data.First();

            robot.UserID = 0;
            _manager.BindRobotToUser(robot, user);
            Assert.AreNotEqual(0, robot.UserID);
            Assert.AreEqual(robot.UserID, user.UserID);
        }