public void GetBirthData_Test()
        {
            string firstName   = "Sloth";
            char   lastInitial = 'F';
            var    theData     = TheModel.GetBirthData(
                USERNAME,
                new Dictionary <string, object>
            {
                { "names", new Name[] { new Name {
                                            FirstName = firstName, LastInitial = lastInitial
                                        } } }
            }
                );

            Assert.That(theData.Any(), "Didn't get any birthdata, but should have.");

            foreach (BirthData birthData in theData)
            {
                string failMessage = string.Format("Was trying to retrieve birthday of someone named '{0}', but somehow got birthday of someone named '{1}'.", firstName, birthData.Name.FirstName);
                Assert.That(Regex.IsMatch(birthData.Name.FirstName, "^" + firstName + "$"), failMessage);

                failMessage = string.Format("Was trying to retrieve birthday of someone with last initial '{0}', but somehow got birthday of someone with last initial '{1}'.", lastInitial, birthData.Name.LastInitial);
                Assert.That(Regex.IsMatch(birthData.Name.LastInitial.ToString(), "^" + lastInitial.ToString() + "$"), failMessage);
            }
        }
예제 #2
0
        public IEnumerable <BirthData> GetForPeople(Name[] names)
        {
            var searchObject = new Dictionary <string, object> {
                { "names", names }
            };

            return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name, searchObject));
        }
예제 #3
0
        /**
         * @apiGroup Birthday
         * @api {Get} /Birthday/GetThisMonth Get birthdays for this month belonging to current user
         * @apiSuccess {object[]} return				The object returned by the API
         * @apiSuccess {object} return.name			Name Info
         * @apiSuccess {string} return.name.firstname	The person's first name
         * @apiSuccess {string} return.name.lastinitial	The person's last initial
         * @apiSuccess {string} return.birthday			The person's birthday
         * @apiSuccess {string} return.birthdayformat	The format of the birthday
         */
        public IEnumerable <BirthData> GetThisMonth()
        {
            var searchObject = new Dictionary <string, object> {
                { "month", DateTime.Now.Month }
            };

            return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name, searchObject));
        }
예제 #4
0
 /**
  * @apiGroup Birthday
  * @api {Get} /Birthday Get all birthdays for current user
  * @apiSuccess {object[]} return				The object returned by the API
  * @apiSuccess {object} return.name			Name Info
  * @apiSuccess {string} return.name.firstname	The person's first name
  * @apiSuccess {string} return.name.lastinitial	The person's last initial
  * @apiSuccess {string} return.birthday			The person's birthday
  * @apiSuccess {string} return.birthdayformat	The format of the birthday
  */
 public IEnumerable <BirthData> Get()
 {
     return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name));
 }