Example #1
0
        public void FakerConfig_TestNumberOfSmallLetters()
        {
            DictionaryOfGenerators dict = new DictionaryOfGenerators();
            var config = new FakerConfig(dict);

            config.Add <TestClass1, string, StringConfigGenerator>(TestClass1 => TestClass1.str);
            Faker.Faker faker = new Faker.Faker(dict);
            TestClass1  obj   = faker.Create <TestClass1>();
            var         a     = from b in obj.str.ToLower()
                                where b >= 'a' && b <= 'z'
                                select b;

            Assert.AreEqual(obj.str.Length, a.Count());
        }
Example #2
0
        public void Faker_TestClassWithFakerConfig()
        {
            DictionaryOfGenerators dict = new DictionaryOfGenerators();
            var config = new FakerConfig(dict);

            config.Add <TestClass1, string, StringConfigGenerator>(TestClass1 => TestClass1.str);
            Faker.Faker faker = new Faker.Faker(dict);
            TestClass1  obj   = faker.Create <TestClass1>();
            var         a     = from b in obj.str
                                where b >= '0' && b <= '9'
                                select b;

            Assert.AreEqual(0, a.Count());
        }
Example #3
0
 public FakerConfig(DictionaryOfGenerators dictionaryOfGenerators)
 {
     _generator = dictionaryOfGenerators;
     dictionary = new Dictionary <Type, Tuple <string, IGenerator> >();
 }
Example #4
0
 public Faker(DictionaryOfGenerators generator)
 {
     _generator = generator;
     f          = this;
 }