Exemplo n.º 1
0
 private static void copyNugetDeclarations(ProjectPlan originalPlan, ProjectPlan testPlan, CsProjFile original,
                                           CsProjFile testProject)
 {
     originalPlan.NugetDeclarations.Each(x => testPlan.NugetDeclarations.Fill(x));
     original.All <AssemblyReference>()
     .Where(x => x.HintPath.IsEmpty())
     .Each(x => testProject.Add <AssemblyReference>(x.Include));
 }
        public void should_apply_a_project_reference_to_the_original_project()
        {
            var reference = theTestingProject.All <ProjectReference>().Single();

            reference.ShouldNotBeNull();

            reference.Include.ShouldEqual(@"..\References\References.csproj");
            reference.ProjectName.ShouldEqual("References");
            reference.ProjectGuid.ShouldEqual(theOriginalProject.ProjectGuid);
        }
Exemplo n.º 3
0
        public void add_simple_class_to_root_of_project()
        {
            CodeFileTemplate.Class("Foo").Alter(theProject, thePlan);

            var file = "Templated".AppendPath("TemplatedProject", "Foo.cs");

            File.Exists(file).ShouldBeTrue();

            new FileSystem().ReadStringFromFile(file).ShouldEqualWithLineEndings(@"
namespace TemplatedProject
{
    public class Foo
    {

    }
}
".Trim());

            theProject.All <CodeFile>().Any(x => x.Include == "Foo.cs")
            .ShouldBeTrue();
        }
Exemplo n.º 4
0
 private static void copyNugetDeclarations(ProjectPlan originalPlan, ProjectPlan testPlan, CsProjFile original, CsProjFile testProject)
 {
     GenericEnumerableExtensions.Each <string>(originalPlan.NugetDeclarations, delegate(string x)
     {
         GenericEnumerableExtensions.Fill <string>(testPlan.NugetDeclarations, x);
     });
     GenericEnumerableExtensions.Each <AssemblyReference>(from x in original.All <AssemblyReference>()
                                                          where FubuCore.StringExtensions.IsEmpty(x.HintPath)
                                                          select x, delegate(AssemblyReference x)
     {
         testProject.Add <AssemblyReference>(x.Include);
     });
 }
Exemplo n.º 5
0
        public Project Map(CsProjFile project)
        {
            var result = new Project
            {
                Name = project.ProjectName,
                Path = Path.GetFullPath(project.FileName)
            };

            foreach (var item in project.All <CodeFile>())
            {
                ProjectFile mapped;
                if (item.Include.EndsWith("AssemblyInfo.cs"))
                {
                    var info = project.AssemblyInfo;
                    mapped = new AssemblyInfo()
                    {
                        Title                = info.AssemblyTitle,
                        Description          = info.AssemblyDescription,
                        FileVersion          = info.AssemblyFileVersion,
                        Version              = info.AssemblyVersion,
                        InformationalVersion = info.AssemblyInformationalVersion
                    };
                }
                else
                {
                    mapped = new ProjectFile();
                }

                mapped.Include       = _fileManager.GetPathForHostEnvironment(item.Include);
                mapped.RootDirectory = _fileManager.GetPathForHostEnvironment(result.Directory);

                result.Files.Add(mapped);
            }

            return(result);
        }