public void DifferentSourceNamespace_CreatesTargetClassWithDifferentNamespace()
            {
                var sourceProject = new SourceWebProject
                {
                    WebPageList = new List <SourceWebPage>()
                    {
                        new SourceWebPage
                        {
                            ClassFullName = "SomeOtherNamespace.Test1.TestItem",
                            PageUrl       = "TestWebPage.aspx"
                        }
                    },
                    RootNamespace = "TestSourceNamespace"
                };

                var targetProject = new TargetProject
                {
                    RootNamespace = "TestTargetNamespace"
                };
                var targetModelGenerator = new TargetModelGenerator();
                var projectResult        = targetModelGenerator.CompareProject(targetProject, sourceProject);

                Assert.AreEqual(1, projectResult.ClassesToAdd.Count);
                Assert.AreEqual(0, projectResult.ClassesToUpdate.Count);
                TestValidators.ValidateTargetClassComparisonResult(projectResult.ClassesToAdd[0],
                                                                   @"Client\Pages\SomeOtherNamespace\Test1\TestItemPageClient.designer.cs",
                                                                   @"Client\Pages\SomeOtherNamespace\Test1\TestItemPageClient.cs",
                                                                   @"SomeOtherNamespace.Test1.TestItem",
                                                                   @"TestTargetNamespace.Client.Pages.SomeOtherNamespace.Test1.TestItemPageClient",
                                                                   EnumSourceObjectType.WebPage,
                                                                   "TestWebPage.aspx");
            }
            public void MatchingSourceNamespace_CreatesTargetClassWithSameNamespace()
            {
                var sourceProject = new SourceWebProject
                {
                    WebPageList = new List <SourceWebPage>()
                    {
                        new SourceWebPage
                        {
                            ClassFullName = "TestTargetNamespace.Test1.TestItem",
                            PageUrl       = "TestWebPage.aspx"
                        }
                    },
                    RootNamespace = "TestSourceNamespace"
                };

                var targetProject = new TargetProject
                {
                    RootNamespace = "TestTargetNamespace.Test1"
                };
                var targetModelGenerator = new TargetModelGenerator();
                var projectResult        = targetModelGenerator.CompareProject(targetProject, sourceProject);

                Assert.AreEqual(1, projectResult.ClassesToAdd.Count);
                Assert.AreEqual(0, projectResult.ClassesToUpdate.Count);
                TestValidators.ValidateTargetClassComparisonResult(classResult: projectResult.ClassesToAdd[0],
                                                                   designerFileRelativePath: @"Client\Pages\TestTargetNamespace\Test1\TestItemPageClient.designer.cs",
                                                                   userFileRelativePath: @"Client\Pages\TestTargetNamespace\Test1\TestItemPageClient.cs",
                                                                   sourceClassFullName: @"TestTargetNamespace.Test1.TestItem",
                                                                   targetClassFullName: @"TestTargetNamespace.Test1.Client.Pages.TestTargetNamespace.Test1.TestItemPageClient",
                                                                   targetObjectType: EnumSourceObjectType.WebPage,
                                                                   expectedUrl: "TestWebPage.aspx");
            }
Beispiel #3
0
        public override void SaveToFile()
        {
            var dlg = new SaveFileDialog()
            {
                Filter = "back testing project|*.btproject|(*.*)|*.*"
            };

            if (dlg.ShowDialog() == true)
            {
                SaveInfo();
                TargetProject.SerialObject();
                CommonLib.CommonProc.SaveObjToFile(TargetProject, dlg.FileName);
            }
        }
            public void ExistingTargetClassWithDifferentName_ShouldUpdateExistingTargetClass()
            {
                var sourceProject = new SourceWebProject
                {
                    WebPageList = new List <SourceWebPage>()
                    {
                        new SourceWebPage
                        {
                            ClassFullName = "TestSourceNamespace.Test1.TestItem",
                            PageUrl       = "TestWebPage.aspx"
                        }
                    },
                    RootNamespace = "TestSourceNamespace"
                };

                var targetProject = new TargetProject
                {
                    RootNamespace   = "TestTargetNamespace",
                    TargetClassList = new List <TargetClass>()
                    {
                        new TargetClass
                        {
                            SourceClassFullName      = "TestSourceNamespace.Test1.TestItem",
                            DesignerFileRelativePath = @"SomeOtherLocation\SomeOtherClassName.designer.cs",
                            UserFileRelativePath     = @"SomeOtherLocation\SomeOtherClassName.cs",
                            TargetClassFullName      = "SomeOtherLocation.SomeOtherClassName",
                            SourceObjectType         = EnumSourceObjectType.WebPage,
                            ExpectedUrl = "TestWebPage.aspx"
                        }
                    }
                };
                var targetModelGenerator = new TargetModelGenerator();
                var projectResult        = targetModelGenerator.CompareProject(targetProject, sourceProject);

                Assert.AreEqual(0, projectResult.ClassesToAdd.Count);
                Assert.AreEqual(1, projectResult.ClassesToUpdate.Count);
                TestValidators.ValidateTargetClassComparisonResult(projectResult.ClassesToUpdate[0],
                                                                   @"SomeOtherLocation\SomeOtherClassName.designer.cs",
                                                                   @"SomeOtherLocation\SomeOtherClassName.cs",
                                                                   "TestSourceNamespace.Test1.TestItem",
                                                                   "SomeOtherLocation.SomeOtherClassName",
                                                                   EnumSourceObjectType.WebPage,
                                                                   "TestWebPage.aspx");
            }
Beispiel #5
0
 public IEnumerator<KeyValuePair<IVersionedItem, IVersionedItem>> GetEnumerator()
 {
     foreach (KeyValuePair<Guid, Guid> keyValuePair in copyDictionaryGuid)
     {
         ExolutioObject objectKey = SourceProject.TranslateComponent<ExolutioObject>(keyValuePair.Key);
         if (objectKey is ProjectVersion)
         {
             continue;
         }
         ExolutioObject objectValue = TargetProject.TranslateComponent<ExolutioObject>(keyValuePair.Value);
         if (objectKey.GetType() != objectValue.GetType())
         {
             throw new ExolutioModelException();
         }
         IVersionedItem keyItem = (IVersionedItem) objectKey;
         IVersionedItem valueItem = (IVersionedItem) objectValue;
         yield return new KeyValuePair<IVersionedItem, IVersionedItem>(keyItem, valueItem);
     }
 }
        private TargetProject ConvertTargetProject(ProjectInSolution project)
        {
            var assembly     = GetProjectAssembly(project);
            var dependencies = new List <TargetDependency>();

            if (assembly != null)
            {
                var referencedAssemblies = assembly.GetReferencedAssemblies();

                dependencies.AddRange(referencedAssemblies.Select(x => ConvertTargetDependency(x)));
            }

            var result = new TargetProject()
            {
                AbsolutePath = project.AbsolutePath,
                ProjectName  = project.ProjectName,
                Dependencies = dependencies
            };

            return(result);
        }
            public void ExistingTargetClassWithExpectedNameAndLocation_ShouldUpdateExistingClass()
            {
                var sourceProject = new SourceWebProject
                {
                    WebPageList = new List <SourceWebPage>()
                    {
                        new SourceWebPage
                        {
                            ClassFullName = "TestSourceNamespace.Test1.TestItem",
                            PageUrl       = "TestWebPage.aspx"
                        }
                    },
                    RootNamespace = "TestSourceNamespace"
                };

                var targetProject = new TargetProject
                {
                    RootNamespace   = "TestTargetNamespace",
                    TargetClassList = new List <TargetClass>()
                    {
                        new TargetClass
                        {
                            SourceClassFullName      = "TestSourceNamespace.Test1.TestItem",
                            DesignerFileRelativePath = @"Client\Pages\Test1\TestItemPageClient.designer.cs",
                            UserFileRelativePath     = @"Client\Pages\Test1\TestItemPageClient.cs",
                            TargetClassFullName      = "TestTargetNamespace.Client.Pages.Test1.TestItemPageClient",
                            SourceObjectType         = EnumSourceObjectType.WebPage,
                            ExpectedUrl = "TestWebPage.aspx"
                        }
                    }
                };
                var targetModelGenerator = new TargetModelGenerator();
                var projectResult        = targetModelGenerator.CompareProject(targetProject, sourceProject);

                Assert.AreEqual(0, projectResult.ClassesToAdd.Count);
                Assert.AreEqual(1, projectResult.ClassesToUpdate.Count);
            }
 public ProjectTaskRunner(TargetProject project, ProjectTaskCreator taskCreator)
 {
     _project     = project;
     _taskCreator = taskCreator;
 }