Пример #1
0
        public CourseCreate.Request CreateValidRequest(params Action <CourseCreate.Request>[] updates)
        {
            var commandModel = EntityGenerator.Create <CourseCreate.CommandModel>();

            var request = new CourseCreate.Request("UserId", commandModel);

            updates.ToList().ForEach(func => func(request));
            return(request);
        }
        public void CheckFilter()
        {
            var entities = new[]
            {
                EntityGenerator.Create <Item>(p => p.Item1 = "xyz"),
                EntityGenerator.Create <Item>(p => p.Item2 = "xxx"),
                EntityGenerator.Create <Item>(),
                EntityGenerator.Create <Item>(),
            };

            var repository = new InMemoryRepository(entities);
            var items      = repository.GetEntities <Item>(
                new TextSearchSpecificationStrategy <Item>("x", p => p.Item1, p => p.Item2));

            items.Count().ShouldEqual(2);
        }
Пример #3
0
 public static Contracts.IEntityGenerator GetEntityGenerator(string solutionPath)
 {
     return(EntityGenerator.Create(SolutionProperties.Create(solutionPath)));
 }
 public void CheckGeneratrionWhenNoDefaultCtor()
 {
     var entity = EntityGenerator.Create <MyTestClass>();
 }
Пример #5
0
        static void Main(string[] args)
        {
            SolutionProperties   solutionProperties   = SolutionProperties.Create();
            EntityGenerator      entityGenerator      = EntityGenerator.Create(solutionProperties);
            DataContextGenerator dataContextGenerator = DataContextGenerator.Create(solutionProperties);
            ControllerGenerator  controllerGenerator  = ControllerGenerator.Create(solutionProperties);
            FactoryGenerator     factoryGenerator     = FactoryGenerator.Create(solutionProperties);
            TransferGenerator    transferGenerator    = TransferGenerator.Create(solutionProperties);

            List <string> lines = new List <string>();

            Console.WriteLine("Create Modules-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreateModulesEntities());
            WriteAllLines(solutionProperties.EntitiesModulesFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreateBusinesssEntities());
            WriteAllLines(solutionProperties.EntitiesBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Entities...");
            lines.Clear();
            lines.AddRange(entityGenerator.CreatePersistenceEntities());
            WriteAllLines(solutionProperties.EntitiesPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create DataContext-DbContext...");
            lines.Clear();
            lines.AddRange(dataContextGenerator.CreateDbContext());
            WriteAllLines(solutionProperties.DataContextPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Controllers...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreatePersistenceControllers());
            WriteAllLines(solutionProperties.ControllersPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Controllers...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreateBusinessControllers());
            WriteAllLines(solutionProperties.ControllersBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Factory...");
            lines.Clear();
            lines.AddRange(factoryGenerator.CreateLogicFactory());
            WriteAllLines(solutionProperties.LogicFactoryFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Modules-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreateModulesTransfers());
            WriteAllLines(solutionProperties.TransferModulesFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Business-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreateBusinessTransfers());
            WriteAllLines(solutionProperties.TransferBusinessFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Persistence-Transfer...");
            lines.Clear();
            lines.AddRange(transferGenerator.CreatePersistenceTransfers());
            WriteAllLines(solutionProperties.TransferPersistenceFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Controllers-WebApi...");
            lines.Clear();
            lines.AddRange(controllerGenerator.CreateWebApiControllers());
            WriteAllLines(solutionProperties.WebApiControllersFilePath, FormatCSharp(lines));

            Console.WriteLine("Create Adapters...");
            lines.Clear();
            lines.AddRange(factoryGenerator.CreateAdapterFactory());
            WriteAllLines(solutionProperties.AdaptersFactoryFilePath, FormatCSharp(lines));
        }