Beispiel #1
0
        public void GenerateFileQuoted()
        {
            var expectedFile = TestUtility.GetExpectedCustomerFileTSqlQuery(true);

            var tableSpec = TestUtility.GetCustomerTableSpec();

            var generator = new TSqlQueryFileGenerator {
                QuoteIdentifiers = true
            };

            var file = generator.GenerateFile(tableSpec);

            Assert.AreEqual(expectedFile.FileName, file.FileName);
            Assert.AreEqual(expectedFile.FileType, file.FileType);
            Assert.AreEqual(expectedFile.FileContents, file.FileContents);
        }
Beispiel #2
0
        /// <summary>
        /// Adds all active file generators to the given service using the given configuration.
        /// </summary>
        /// <param name="fgService">Target file generation service.</param>
        /// <param name="appConfig">Configuration object to take settings from.</param>
        private static void AddFileGenerators(ref IFileGenerationService fgService, ApplicationConfiguration appConfig)
        {
            if (appConfig.CSharpModelConfiguration.Active)
            {
                var csharpGenerator = new CSharpModelFileGenerator
                {
                    ModelNameSpace = appConfig.CSharpModelConfiguration.ModelNameSpace,
                    AddAnnotations = appConfig.CSharpModelConfiguration.AddAnnotations,
                    OnlyExactMatchForAnnotations = appConfig.CSharpModelConfiguration.OnlyExactMatchForAnnonations
                };
                fgService.AddFileGenerator(csharpGenerator);
            }

            if (appConfig.TSqlQueryConfiguration.Active)
            {
                var tsqlGenerator = new TSqlQueryFileGenerator()
                {
                    QuoteIdentifiers = appConfig.TSqlQueryConfiguration.QuoteIdentifiers
                };
                fgService.AddFileGenerator(tsqlGenerator);
            }
        }
Beispiel #3
0
        public void OutputFileType()
        {
            var generator = new TSqlQueryFileGenerator();

            Assert.AreEqual(GeneratedFileType.TSqlQuery, generator.OutputFileType);
        }