Esempio n. 1
0
        public void GivenOnePathToOneDirectory_WhenInThisDirectoryIsNotAnySolution_ThenOneDirectoryNotFoundException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();
            var cut            = new ProjectDependencyResolver(mockFileSystem, Mock.Of <IEnvironment>());

            Action action = () => cut.ResolveDependencies(@"c:\foo\bar\");

            action.Should().Throw <DirectoryNotFoundException>();
        }
Esempio n. 2
0
 public Program(UriCorrector uriCorrector, LicenseLocator licenseLocator, IFileSystem fileSystem,
                ProjectDependencyResolver projectDependencyResolver, LicenseDownloader licenseDownloader, IReporter reporter)
 {
     _uriCorrector              = uriCorrector;
     _licenseLocator            = licenseLocator;
     _fileSystem                = fileSystem;
     _projectDependencyResolver = projectDependencyResolver;
     _downloader                = licenseDownloader;
     _reporter = reporter;
 }
        public void When_loading_project_references_then_correct_paths_must_be_returned()
        {
            //// Arrange
            var path = "../../../MyToolkit.Extended.Wp8/MyToolkit.Extended.Wp8.csproj";

            //// Act
            var projects = ProjectDependencyResolver.GetProjectReferences(path);

            //// Assert
            Assert.AreEqual(1, projects.Count());
        }
Esempio n. 4
0
 public Program(UriCorrector uriCorrector, PackageLocator packageLocator, IFileSystem fileSystem,
                ProjectDependencyResolver projectDependencyResolver, LicenseDownloader licenseDownloader, IReporter reporter, IEntryPointLocator entryPointLocator)
 {
     _uriCorrector              = uriCorrector;
     _packageLocator            = packageLocator;
     _fileSystem                = fileSystem;
     _projectDependencyResolver = projectDependencyResolver;
     _downloader                = licenseDownloader;
     _reporter          = reporter;
     _entryPointLocator = entryPointLocator;
 }
Esempio n. 5
0
        public void GivenOnePathToOneProjectFile_WhenInThisFileDoesNotExist_ThenOneDirectoryNotFoundException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddDirectory(@"c:\foo\bar");
            var cut = new ProjectDependencyResolver(mockFileSystem, Mock.Of <IEnvironment>());

            Action action = () => cut.ResolveDependencies(@"c:\foo\bar\aa.fooproj");

            action.Should().Throw <FileNotFoundException>();
        }
Esempio n. 6
0
        public void GivenOnePathToOneDirectory_WhenThisDirectoryContainsTwoSolutionFiles_ThenOneException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddFile(@"c:\foo\bar\xyz.sln", new MockFileData(""));
            mockFileSystem.AddFile(@"c:\foo\bar\g.sln", new MockFileData(""));
            var cut = new ProjectDependencyResolver(mockFileSystem, Mock.Of <IEnvironment>());

            Action action = () => cut.ResolveDependencies(@"c:\foo\bar\");

            action.Should().Throw <InvalidOperationException>();
        }
        public void When_generating_build_order_then_project_with_no_references_should_be_first()
        {
            //// Arrange
            var paths = new string[]
            {
                "../../../MyToolkit.Extended.Wp8/MyToolkit.Extended.Wp8.csproj",
                "../../../MyToolkit/MyToolkit.csproj",
            };

            //// Act
            var buildOrder = ProjectDependencyResolver.GetBuildOrder(paths).ToArray();

            //// Assert
            Assert.AreEqual(2, buildOrder.Length);
            Assert.IsTrue(buildOrder[0].Contains("MyToolkit.csproj"));
            Assert.IsTrue(buildOrder[1].Contains("MyToolkit.Extended.Wp8.csproj"));
        }
Esempio n. 8
0
        private void RemoveProjectsFromSolution(List <ProjectModel> projectsToDelete)
        {
            if (RemoveProjects)
            {
                var pathsOfProjectsToRemove = projectsToDelete.Select(p => p.Path);
                var projectBuildOrder       = ProjectDependencyResolver.GetBuildOrder(pathsOfProjectsToRemove).ToList();
                var orderedProjectsToRemove = projectsToDelete
                                              .OrderByDescending(p => projectBuildOrder.IndexOf(p.Path)).Distinct().ToList();

                foreach (var project in orderedProjectsToRemove)
                {
                    if (project != null)
                    {
                        project.RemoveFromSolution(Application.Solution);
                    }
                }
            }
        }
Esempio n. 9
0
        public async Task GivenOnePathToOneExistingProjectFile_WhenThisProjectDoesHaveOneProjectAssetsFileProperty_ThenNoException_ShouldBeThrown()
        {
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.AddFile(@"c:\foo\bar\xyz.csproj", new MockFileData(@"<Project Sdk=""Microsoft.NET.Sdk"">
  <PropertyGroup>
    <TargetFrameworks>netstandard1.6;net462;net452</TargetFrameworks>
    <AssemblyName>Lokad.AzureEventStore</AssemblyName>
    <RuntimeIdentifiers>win</RuntimeIdentifiers>
    <OutputType>Library</OutputType>
    <Company>Lokad</Company>
    <Copyright>Copyright © Lokad 2019</Copyright>
    <AssemblyVersion>2.1.0.0</AssemblyVersion>
    <FileVersion>2.1.0.0</FileVersion>
    <PackageId>Lokad.AzureEventStore</PackageId>
    <PackageVersion>2.1.0.0</PackageVersion>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Authors>Lokad</Authors>
    <Description>Simple, low-maintenance event sourcing backed by Azure Blob Storage.</Description>
    <PackageLicenseUrl>https://github.com/Lokad/AzureEventStore/blob/master/LICENSE.txt</PackageLicenseUrl>
    <PackageProjectUrl>https://github.com/Lokad/AzureEventStore</PackageProjectUrl>
    <PackageIconUrl>https://raw.githubusercontent.com/Lokad/AzureEventStore/master/lokad.png</PackageIconUrl>
    <Version>2.1.0</Version>
<ProjectAssetsFile Condition="" '$(ProjectAssetsFile)' == '' "">c:\foo\bar\obj\project.assets.json</ProjectAssetsFile>
  </PropertyGroup>
  <ItemGroup Condition=""'$(TargetFramework)'=='netstandard1.6'"">
    <PackageReference Include=""System.Diagnostics.Contracts"" Version=""4.3.0"" />
    <PackageReference Include=""System.Diagnostics.TraceSource"" Version=""4.3.0"" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include=""Microsoft.Azure.Storage.Blob"" Version=""9.4.1"" />
    <PackageReference Include=""Newtonsoft.Json"" Version=""12.0.1"" />
  </ItemGroup>
</Project>"));

            var entryPoint = new EntryPoint(mockFileSystem.FileInfo.FromFileName(@"c:\foo\bar\xyz.csproj"), EntryPointType.Project);
            var cut        = new ProjectDependencyResolver(mockFileSystem, Mock.Of <IEnvironment>());

            mockFileSystem.AddFile(@"c:\foo\bar\obj\project.assets.json", new MockFileData(""));

            Func <Task> action = async() => await cut.ResolveDependenciesAsync(entryPoint);

            await action.Should().NotThrowAsync();
        }