/* * ExcelReaderTest.cs 0.1 * * Copyright 2006 Ian Escarro. All rights reserved. * PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ using System; using NUnit.Framework; using RuralNet.Shinobi.Data; using RuralNet.Shinobi.Data.Java.NinJava; using RuralNet.Shinobi.Data.Java; namespace RuralNet.Shinobi.Test { /// /// /// [TestFixture] public class ExcelReaderTest { /// /// Creates a new instance of ExcelReaderTest. /// public ExcelReaderTest() {} [Test] public void Test() { SolutionBuilder b = new NinJavaSolutionBuilder(); Project p = new NinJavaProject(); p.Name = "NinJavaProject"; p.Directory = @"D:\ian\projects\java\NinJavaProjectTest"; ExcelReader e = new ExcelReader(@"D:\ian\projects\csharp\shinobi\Documents\hris_org_profile\hris_specs.xls", "Forms"); Assert.AreEqual(e.FileName, @"D:\ian\projects\csharp\shinobi\Documents\hris_org_profile\hris_specs.xls"); e.Worksheet = "Forms"; Assert.AreEqual("Forms", e.Worksheet); ExcelRow r = e.First(); HtmlForm form = new HtmlForm(); JavaServerPage jsp = new JavaServerPage(); if (r != null) jsp = new JavaServerPage(p, "", r[2] + ".jsp"); while (r != null) { if (r[0] != "") { form.Name = r[2]; form.Action = ""; if (r[3] != "") form.AddControl(new HtmlControlFactory().GetHtmlControl(r[5], r[3], r[4], r[6])); } else { jsp.AddForm(form); // Console.WriteLine(jsp.ToString() + "\n---------------------------------------"); p.AddUserInterface(jsp); r = e.Next(); if (r != null) { jsp = new JavaServerPage(p, "", r[2] + ".jsp"); form = new HtmlForm(); } } r = e.Next(); } b.Solution.AddProject(p); new ShinobiDa().Construct(b); } } }