Esempio n. 1
0
        public void RetirementTest(string sex, int age)
        {
            IMessageStrategy strategies = new RetirementMessageStrategy();
            DateTime         birthday   = new DateTime(2010, 10, 10);
            Person           person     = new Person("N", "N", sex, age, birthday);
            string           massage    = $"Hello { person.FirstName } you already enjoy your retirement";

            strategies.Execute(person);

            Assert.Equal(massage, strategies.Message);
        }
Esempio n. 2
0
        public void CompositeTest(int age)
        {
            IMessageStrategy retirement = new RetirementMessageStrategy();
            IMessageStrategy old        = new OldMessageStrategy();
            IMessageStrategy strategies = new CompositeMessageStrategy(retirement, old);
            DateTime         birthday   = new DateTime(2010, 10, 10);

            Person person  = new Person("N", "N", "F", age, birthday);
            string massage = $"Hello { person.FirstName } you already enjoy your retirement Hello! Mr. { person.FirstName }, how did you manage to live to such an age";

            strategies.Execute(person);

            Assert.Equal(massage, strategies.Message);
        }