internal GenderDeterminator(RulesProvider rulesLoader = null)
 {
     var genderRules = (rulesLoader ?? new RulesProvider(new EmbeddedResourceLoader())).GenderRules;
     _lastNameDet = new RuleSetDeterminator(genderRules.LastName);
     _firstNameDet = new RuleSetDeterminator(genderRules.FirstName);
     _middleNameDet = new RuleSetDeterminator(genderRules.MiddleName);
 }
        public void Should_automatically_load_rules()
        {
            var loader = new Mock<IRulesLoader>();
            loader.Setup(l => l.Load()).Returns(new Rules.Data.Rules());

            var provider = new RulesProvider(loader.Object);
            var rules = provider.Rules;

            loader.Verify(l => l.Load(), Times.AtLeastOnce);
        }        
        public void Should_load_rules_only_once()
        {
            var loader = new Mock<IRulesLoader>();
            loader.Setup(l => l.Load()).Returns(new Rules.Data.Rules());

            var provider = new RulesProvider(loader.Object);
            var rules = provider.Rules;
            var rules2 = provider.Rules;

            loader.Verify(l => l.Load(), Times.Exactly(1));
        }
示例#4
0
 public Petrovich(IRulesLoader rulesLoader = null)
 {
     loader = rulesLoader ?? new EmbeddedResourceLoader();
     provider = new RulesProvider(loader);
 }
示例#5
0
 internal CaseInflection(RulesProvider provider, Gender gender)
 {
     this.provider = provider;
     this.gender = gender;
 }
 public void FixtureSetUp()
 {
     var loader = new YamlRulesLoader("rules.yml");
     provider = new RulesProvider(loader);
 }
示例#7
0
 public Petrovich(IRulesLoader rulesLoader = null)
 {
     loader = rulesLoader;
     provider = loader != null? new RulesProvider(loader): EmbeddedResourceLoader;
     _genderDeterminator = rulesLoader == null ? GenderUtils.Determinator : new GenderDeterminator(provider);
 }
 public void FixtureSetUp()
 {
     var loader = new EmbeddedResourceLoader();
     provider = new RulesProvider(loader);
 }
示例#9
0
 public Petrovich(IRulesLoader rulesLoader = null)
 {
     loader = rulesLoader ?? new YamlRulesLoader("rules.yml");
     provider = new RulesProvider(loader);
 }