Пример #1
0
        public void Should_resolve_message()
        {
            var john = new Person {Name = "John", Gender = Gender.Male, Age = 20};
            var grace = new Person {Name = "Grace", Gender = Gender.Female, Age = 18};

            var johnConfig = MessagePicker.GetMessageConfig(john);
            johnConfig.Message.ShouldEqual("John");

            var graceConfig = MessagePicker.GetMessageConfig(grace);
            graceConfig.Message.ShouldEqual("18");
        }
Пример #2
0
 public static MessageConfig GetMessageConfig(Person person)
 {
     var config = Configs.Single(c => c.Gender == person.Gender);
     return config.Compile(person);
 }
Пример #3
0
 internal MessageConfig Compile(Person person)
 {
     Message = _messageFunc(person);
     return this;
 }