Exemplo n.º 1
0
        public void MockContextBuilder_Uses_Overwrites_ClassSeederBuilder()
        {
            var builder = new MockContextBuilder <SimpleContext>();

            builder.CustomizeClassSeeder(c => c.Customers)
            .UseRandomDataPropertySeeder(r => r.Id, new List <int> {
                100
            });

            builder.CustomizeClassSeeder(c => c.Customers)
            .UseRandomDataPropertySeeder(r => r.Id, new List <int> {
                999
            });

            var db = builder.BuildDatabase();

            Assert.IsTrue(db.Customers.All(c => c.Id == 999));
        }
Exemplo n.º 2
0
        public void MockContextBuilder_Can_Add_RandomDataPropertySeeders()
        {
            var builder = new MockContextBuilder <SimpleContext>();

            builder.CustomizeClassSeeder(c => c.Customers)
            .UseRandomDataPropertySeeder(r => r.Id, new List <int> {
                1001
            })
            .UseRandomDataPropertySeeder(r => r.FirstName, new List <string> {
                "Name"
            });


            var db = builder.BuildDatabase();

            Assert.IsTrue(db.Customers.All(i => i.Id == 1001));
            Assert.IsTrue(db.Customers.All(c => c.FirstName == "Name"));
        }