Exemplo n.º 1
0
        public void project_name()
        {
            var directory = FileSystem.Combine("c:", "root", "src", "project1");
            var project = new Project(directory.AppendPath("packages.config"));

            project.ProjectName.ShouldEqual("project1");
        }
Exemplo n.º 2
0
        public void clean_should_clear_out_both_the_bin_and_obj_folders()
        {
            var system = MockRepository.GenerateMock<IFileSystem>();

            var directory = FileSystem.Combine("c:", "root", "src", "project1");
            var project = new Project(directory.AppendPath("packages.config"));

            project.Clean(system);

            system.AssertWasCalled(x => x.CleanDirectory(directory.AppendPath("bin")));
            system.AssertWasCalled(x => x.CleanDirectory(directory.AppendPath("obj")));
        }
Exemplo n.º 3
0
        public static Project ReadFrom(string file)
        {
            if (Path.GetExtension(file) != ".csproj")
            {
                throw new ArgumentOutOfRangeException("You can only use the csproj file here");
            }

            file = file.ToFullPath();
            var project = new Project(file);

            var packagesFile = project.PackagesFile();
            if (new FileSystem().FileExists(packagesFile))
            {
                project._nugetDependencies.AddRange(NugetDependency.ReadFrom(packagesFile));
            }

            return project;
        }
Exemplo n.º 4
0
        public static Project ReadFrom(string file)
        {
            var project = new Project(file);
            project._nugetDependencies.AddRange(NugetDependency.ReadFrom(file));

            var files = new FileSystem().FindFiles(file.ParentDirectory(), new FileSet(){
                Include = "*.csproj"
            });

            var csProjFile = files.FirstOrDefault();
            if (files.Count() > 1)
            {
                csProjFile = files.FirstOrDefault(x => x.StartsWith(project.ProjectName));
            }

            project.ProjectFile = csProjFile;

            return project;
        }