Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var ruleMethodDefination = GetRuleMethodDefination();
            var inputProperties      = GetInputProperties();
            var outputProperties     = GetOutputProperties();

            var inputCsvData    = GetCsvInputValues();
            var columns         = inputCsvData.FirstOrDefault().Select(e => e.Key).ToList();
            var randomOuputData = GetRandomOutputData(columns);


            var x = randomOuputData.Select(e => e.Count);

            var summaryData = new SummaryData
            {
                Total      = randomOuputData.Sum(e => e.Count),
                Passed     = randomOuputData.Sum(e => e.Count(f => f.IsTestCasePass)),
                Regulation = 151651,
                Sequence   = 17
            };

            var excelResult = new Excel
            {
                InputData   = inputCsvData,
                OutputData  = randomOuputData,
                SummaryData = summaryData
            };


            //var csvInputValues = GetCsvInputValues();
            //var T4Template = new RuleTextTemplate(ruleMethodDefination, inputProperties, outputProperties, csvInputValues);
            //var ruleCode = T4Template.TransformText();


            var T4Template1 = new RuntimeTextTemplate1(ruleMethodDefination, "", inputProperties, outputProperties, new Dictionary <string, Type> {
                { "W1", typeof(int) }
            });
            var ruleCode1 = T4Template1.TransformText();


            PrintCalculationRuleResult(ruleCode1);


            WriteExcel.WriteExcelFile(excelResult);
        }
Exemplo n.º 2
0
        private static void PrefillSummarySheet(ExcelWorksheet summary, SummaryData summaryData)
        {
            summary.Cells[1, 1].Value  = "Date";
            summary.Cells[2, 1].Value  = "Time";
            summary.Cells[3, 1].Value  = "Regulation";
            summary.Cells[4, 1].Value  = "Sequence Number";
            summary.Cells[7, 1].Value  = "Overall test result";
            summary.Cells[9, 1].Value  = "Total number of tests";
            summary.Cells[10, 1].Value = "Number of tests passing";
            summary.Cells[11, 1].Value = "Number of tests failing";

            summary.Cells[1, 2].Value  = summaryData.Date;
            summary.Cells[2, 2].Value  = summaryData.Time;
            summary.Cells[3, 2].Value  = summaryData.Regulation;
            summary.Cells[4, 2].Value  = summaryData.Sequence;
            summary.Cells[7, 2].Value  = summaryData.Result;
            summary.Cells[9, 2].Value  = summaryData.Total;
            summary.Cells[10, 2].Value = summaryData.Passed;
            summary.Cells[11, 2].Value = summaryData.Failed;
        }