/*
         * Don't Repeat Yourself
         *
         * "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system"
         *
         * Good examples: Work flows, Objects/exceptions formatting, utility methods, Template methods/LINQ
         *
         */
        public static string CheckEligibilityAndFormatEmailHeader(Person person)
        {
            if (person.BirthDate.Date == DateTime.Now.AddYears(-18).Date)
            {
                return(MarkEligibility(person));
            }

            return(PersonFormatter.Format(person));
        }
Ejemplo n.º 2
0
        public void Format_PersonWithFirstAndLastName_StringFirstAndLastNameWithDashBetween()
        {
            Person person = new Person
            {
                FirstName = "Bob",
                LastName  = "Martin"
            };

            PersonFormatter formatter = new PersonFormatter();

            var result = formatter.Format(person);

            Assert.AreEqual(s);
        }
 private static string MarkEligibility(Person person)
 {
     // TODO: Mark Eligibility in some db or system
     return(PersonFormatter.Format(person.ToString()));
 }