Beispiel #1
0
        private async Task CollectSolutionInformationAsync()
        {
            var solutionReader     = new SolutionReferenceParser();
            var solutionReferences = solutionReader.Process(await Context.Options.FileSystem.ReadAsync(Context.SolutionPath));

            foreach (var solutionReference in solutionReferences)
            {
                var solutionHistory    = new HistoryInformation();
                var solutionPathMapper = new PathMapper(Context.SolutionPath);
                solutionHistory.Before.AbsolutePath = solutionPathMapper.GetAbsolutePath(solutionReference.RelativePath);
                solutionHistory.Before.RelativePath = solutionReference.RelativePath;

                if (Context.Projects.Contains(solutionHistory.Before.AbsolutePath))
                {
                    // reference will be moved
                    solutionHistory.After.AbsolutePath = Context.Options.ProjectPathTransformer.AbsolutePath(solutionPathMapper.GetSuggestedPath(solutionHistory.Before.AbsolutePath, Context.DestinationPath));
                    solutionHistory.After.RelativePath = Context.Options.ProjectPathTransformer.RelativePath(solutionPathMapper.GetRelativePath(solutionHistory.After.AbsolutePath));
                }
                else
                {
                    solutionHistory.After.AbsolutePath = Context.Options.ProjectPathTransformer.AbsolutePath(solutionPathMapper.GetAbsolutePath(solutionReference.RelativePath));
                    solutionHistory.After.RelativePath = Context.Options.ProjectPathTransformer.RelativePath(solutionReference.RelativePath);
                }

                SolutionReferences.Add(solutionHistory);
            }
        }
Beispiel #2
0
        public async Task Case1Integrity()
        {
            var processor  = new SolutionReferenceParser();
            var references = processor.Process(await EmbeddedTestFileUtility.GetFileStream("MoveTests.Before.solution.sln").ReadToEndAsync());

            references.Count.ShouldBe(2);

            var expected = new[]
            {
                new SolutionReference("EF.Attempt1.EntityFramework", @"EF.Attempt1\EF.Attempt1.EntityFramework\EF.Attempt1.EntityFramework.csproj"),
                new SolutionReference("EF.Attempt1.Entities", @"EF.Attempt1\EF.Attempt1.Entities\EF.Attempt1.Entities.csproj"),
            };

            for (int i = 0; i < expected.Length; i++)
            {
                references.ShouldContain(expected[i]);
            }
        }