Exemple #1
0
        public void TestTheName()
        {
            var        cpu = new Subject("CPU", Gender.Neuter, false);
            ITextMacro sut = new TheName();

            Assert.That(sut.CapitalizedFormat(cpu), Is.EqualTo("The CPU"));
            Assert.That(sut.Format(cpu), Is.EqualTo("the CPU"));
            Assert.That(sut.Format(male), Is.EqualTo(male.Name));
        }
Exemple #2
0
        public ActionResult Index(string userName, string guessedName)
        {
            if (Request.IsAuthenticated)
            {
                userName = System.Web.HttpContext.Current.User.Identity.Name;
            }

            if (IsErrorInPost(userName, guessedName))
            {
                return(View());
            }

            ViewBag.YourName    = userName;
            ViewBag.GuessedName = guessedName;

            var theName = new TheName();

            ViewBag.GuessResult = theName.MakeGuess(userName, guessedName);

            return(Index());
        }
        //http://mvcguessmysonsname.apphb.com/
        //http://mvcguessmysonsname.apphb.com/api/names/getisname?name=x
        // GET api/names/getisname?name=
        public bool GetIsName(string name)
        {
            var theName = new TheName();

            return(theName.MakeGuess(name));
        }