public void ProjectDomainDetailsUserControlUnitTest_Test()
        {
            ScaffoldConfig.Load();

            ProjectDomainDetailsUserControl control =
                new ProjectDomainDetailsUserControl
            {
                ApplicationService =
                    new ProjectDefinitionApplicationServiceFile()
            };

            control.ApplicationService.AddDomain();

            // Todo:Add Back
            control.ApplicationService.ProjectDefinition.Domains[0].DriverId =
                new Guid(ScaffoldConfig.Drivers[0].Metadata["ValueMetaData"].ToString());

            // control.ApplicationService.ProjectDefinition.Domains[0].DriverTypeId;
            // new Guid(ScaffoldConfig.LanguageOutputs[0].Metadata["ValueMetaData"].ToString())
            control.SelectedDomain = control.ApplicationService.ProjectDefinition.Domains[0];

            Assert.AreEqual(1, control.ReturnDriverTypes().Length, "There should 1 DriverType");
            Assert.AreEqual(3, control.ReturnNamingConventions().Length, "Three should 3 NamingConventionId");
            Assert.AreEqual(1, control.ReturnSourceTypes().Length, "There should 1 Sourcetype");
        }
예제 #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     ScaffoldConfig.Load();
     Application.Run(new Form1());
 }
        public void Load(string dllPath = "")
        {
            Logger.Trace($"Started Load() - Path: {this.FilePersistenceOptions.Path}");
            this.ProjectDefinition = ObjectXMLSerializer <ProjectDefinition> .Load(this.FilePersistenceOptions.Path);

            ScaffoldConfig.Load(dllPath);
            foreach (var domain in this.ProjectDefinition.Domains)
            {
                // Todo: The fix shouldn't come from the SourceType
                var sourceType = ScaffoldConfig.ReturnSourceType(domain.SourceTypeId);
                sourceType.Fix(domain.Tables);
            }

            Logger.Trace($"Completed Load() - Path: {this.FilePersistenceOptions.Path}");
        }
        /// <summary>
        /// Create test values.
        /// </summary>
        /// <param name="applicationService">
        /// The application Service.
        /// </param>
        protected void CreateTestValues(IConfigurationApplicationService applicationService)
        {
            List <DataType> dataTypes = new List <DataType>();

            dataTypes.Add(new DataType {
                Id = Guid.NewGuid(), Name = "Context"
            });
            dataTypes.Add(new DataType {
                Id = Guid.NewGuid(), Name = "Entity"
            });
            dataTypes.Add(new DataType {
                Id = Guid.NewGuid(), Name = "Repository"
            });
            dataTypes.Add(new DataType {
                Id = Guid.NewGuid(), Name = "Application Service"
            });
            dataTypes.Add(new DataType {
                Id = Guid.NewGuid(), Name = "ViewModel"
            });
            applicationService.ApplicationSettings.DataTypes = dataTypes;

            ScaffoldConfig.Load();

            Template template = new Template
            {
                ConfigLocation   = ConfigLocation.Data,
                DataType         = Guid.Empty,
                Id               = Guid.NewGuid(),
                Name             = "Template",
                Version          = 1,
                TemplatePath     = "Test.t4",
                LanguageOutputId =
                    new Guid(
                        ScaffoldConfig.LanguageOutputs[0].Metadata["ValueMetaData"]
                        .ToString()),
                GeneratorTypeId = new Guid(
                    ScaffoldConfig.OutputGenerators[0].Metadata["ValueMetaData"]
                    .ToString())
            };

            applicationService.ApplicationSettings.Templates.Add(template);
        }