static void Main() { //string inputProject = @"C:\Users\admin\Dropbox\Code\screwturn-screwturn-wiki-4-cf9155b27d4c\WebApplication\WebApplication.csproj"; string inputProjectPath = @"..\..\..\..\BugNet\src\BugNET_WAP\BugNET_WAP.csproj"; //string outputProjectPath = @"C:\Users\admin\Dropbox\Code\MMDB.UITest\ScrewturnWikiProxySample\ScrewturnWikiProxySample.csproj"; string outputProjectPath = @"..\..\..\BugNetProxySample\BugNetProxySample.csproj"; var sourceProjectFile = new ProjectParser().ParseFile(inputProjectPath); var sourceModel = new SourceWebModelParser().LoadFromProjectFile(sourceProjectFile, inputProjectPath); var targetProjectFile = new ProjectParser().ParseFile(outputProjectPath); var targetModel = new TargetModelParser().LoadFromProjectFile(targetProjectFile, outputProjectPath); var comparison = new TargetModelGenerator().CompareProject(targetModel, sourceModel); new TargetModelWriter().ApplyChanges(comparison, outputProjectPath); //ProxyGenerator.UpdateProxyProject(outputProjectPath, sourceProject); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
public void BasicTest() { CSProjectFile projectFile = new CSProjectFile() { RootNamespace = "Test.Namespace", ClassList = new List<CSClass> { new CSClass { ClassFullName="Test1.TestClass1", FileRelativePathList=new List<string> {"TestClass1.aspx"} }, new CSClass { ClassFullName="Test1.TestMaster", FileRelativePathList=new List<string> {"TestMasterPage.Master"} }, new CSClass { ClassFullName="Test1.TestUserControl", FileRelativePathList=new List<string> {"TestUserControl.ascx"} } }, WebFormContainers = new List<WebFormContainer>() { new WebFormContainer { ClassFullName="Test1.TestClass1", CodeBehindFile="TestClass1.aspx.cs", ContainerType=EnumWebFormContainerType.WebPage, FilePath="C:\\Test\\TestClass1.aspx"}, new WebFormContainer { ClassFullName="Test1.TestMasterPage", CodeBehindFile="TestMasterPage.Master.cs", ContainerType=EnumWebFormContainerType.MasterPage, FilePath="C:\\Test\\TestMasterPage.Master"}, new WebFormContainer { ClassFullName="Test1.TestUserControl", CodeBehindFile="TestUserControl.ascx.cs", ContainerType=EnumWebFormContainerType.UserControl, FilePath="C:\\Test\\TestUserControl.ascx" } }, ClassFileDependencyList = new List<ClassFileDependency> { new ClassFileDependency { ClassFullName="Test1.TestClass1", DependentUponFile="TestClass1.aspx" }, new ClassFileDependency { ClassFullName="Test1.TestMasterPage", DependentUponFile="TestMasterPage.Master" }, new ClassFileDependency { ClassFullName="Test1.TestUserControl", DependentUponFile="TestUserControl.ascx" } } }; SourceWebModelParser parser = new SourceWebModelParser(); SourceWebProject result = parser.LoadFromProjectFile(projectFile, "C:\\Test\\Test.csproj"); Assert.IsNotNull(result); Assert.AreEqual(projectFile.RootNamespace, result.RootNamespace); Assert.AreEqual(1, result.WebPageList.Count); Assert.AreEqual("Test1.TestClass1", result.WebPageList[0].ClassFullName); Assert.AreEqual("/TestClass1.aspx", result.WebPageList[0].PageUrl); Assert.AreEqual(1, result.MasterPageList.Count); Assert.AreEqual("Test1.TestMasterPage", result.MasterPageList[0].ClassFullName); Assert.AreEqual("/TestMasterPage.Master", result.MasterPageList[0].PageUrl); Assert.AreEqual(1, result.UserControlList.Count); Assert.AreEqual("Test1.TestUserControl", result.UserControlList[0].ClassFullName); }
public void BasicPageControls() { CSProjectFile projectFile = new CSProjectFile() { ClassList = new List<CSClass>() { new CSClass { ClassFullName = "Test1.TestClass1", FieldList = new List<CSField>() { new CSField { FieldName="form1", ProtectionLevel=EnumProtectionLevel.Protected, TypeFullName="global::System.Web.UI.HtmlControls.HtmlForm"}, new CSField { FieldName="_lblTest", ProtectionLevel=EnumProtectionLevel.Protected, TypeFullName="global::System.Web.UI.WebControls.Label" } } } }, WebFormContainers = new List<WebFormContainer>() { new WebFormContainer { ClassFullName="Test1.TestClass1", CodeBehindFile="TestClass.aspx.cs", FilePath="C:\\Test\\TestClass.aspx", ContainerType= EnumWebFormContainerType.WebPage, Controls = new List<WebFormServerControl>() { new WebFormServerControl { TagName="form", ControlID="form1" }, new WebFormServerControl { TagName="asp:label", ControlID="_lblTest" } } } }, ClassFileDependencyList = new List<ClassFileDependency>() { new ClassFileDependency { ClassFullName="Test1.TestClass1", DependentUponFile="TestClass.aspx"} } }; var parser = new SourceWebModelParser(); var result = parser.LoadFromProjectFile(projectFile, "C:\\Test\\Test.csproj"); Assert.AreEqual(1, result.WebPageList.Count); Assert.AreEqual("/TestClass.aspx", result.WebPageList[0].PageUrl); Assert.AreEqual("Test1.TestClass1", result.WebPageList[0].ClassFullName); Assert.AreEqual(2, result.WebPageList[0].Controls.Count); Assert.AreEqual("System.Web.UI.HtmlControls.HtmlForm", result.WebPageList[0].Controls[0].ClassFullName); Assert.AreEqual("form1", result.WebPageList[0].Controls[0].FieldName); Assert.AreEqual("System.Web.UI.WebControls.Label", result.WebPageList[0].Controls[1].ClassFullName); Assert.AreEqual("_lblTest", result.WebPageList[0].Controls[1].FieldName); }