示例#1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Initializing DB structure...");
            using (var context = new PCExpertContext("dbToFill",
                                                     new DropCreateDatabaseAlways <PCExpertContext>(),
                                                     new DomainValidatorFactory()))
            {
                Console.WriteLine("DB structure initialized");
                Console.WriteLine("Generating test data");

                var workplace   = new EfWorkplace(new TestDbContextProvider(context));
                var dataCreator = new TestDataGenerator();
                dataCreator.CreateRandomData(workplace);

                context.SaveChanges();

                Console.WriteLine("Test data generated");
            }
        }
示例#2
0
 public TestDbContextProvider(PCExpertContext context)
 {
     PCExpertContext = context;
 }
 public void EstablishContext()
 {
     _validatorFactory = new Mock <IValidatorFactory>();
     _context          = TestContextCreator.Create(_validatorFactory.Object).PCExpertContext;
 }