public void GetMergeFilesFromProject_Execute_Postaction_LocallyAvailable()
        {
            var templateName      = "Test";
            var relSourceFilePath = @"Source.cs";
            var sourceFile        = Path.GetFullPath(@".\temp\Source.cs");
            var mergeFile         = Path.GetFullPath(@".\temp\Source_postaction.cs");
            var outputPath        = Path.GetFullPath(@".\temp\Project");
            var destPath          = Path.GetFullPath(@".\DestinationPath\Project");

            Directory.CreateDirectory(outputPath);
            File.Copy(Path.Combine(Environment.CurrentDirectory, $"TestData\\Merge\\Source.cs"), sourceFile, true);
            File.Copy(Path.Combine(Environment.CurrentDirectory, $"TestData\\Merge\\Source_postaction.cs"), mergeFile, true);

            GenContext.Current = new FakeContextProvider()
            {
                DestinationPath      = destPath,
                GenerationOutputPath = outputPath,
            };

            var mergePostAction = new GetMergeFilesFromProjectPostAction(templateName, mergeFile);

            mergePostAction.Execute();

            Directory.Delete(Directory.GetParent(outputPath).FullName, true);

            Assert.False(GenContext.Current.MergeFilesFromProject.ContainsKey(relSourceFilePath));
        }
Ejemplo n.º 2
0
        public void Execute_Postaction()
        {
            var templateName      = "Test";
            var relSourceFilePath = @"Source.cs";
            var mergeFile         = Path.GetFullPath(@".\temp\Source_postaction.cs");
            var path = Path.GetFullPath(@".\temp");

            Directory.CreateDirectory(path);
            File.Copy(Path.Combine(Environment.CurrentDirectory, $"TestData\\Merge\\Source_postaction.cs"), mergeFile, true);

            GenContext.Current = new FakeContextProvider()
            {
                DestinationPath       = Path.GetFullPath(@".\DestinationPath\Project"),
                OutputPath            = path,
                TempGenerationPath    = path,
                DestinationParentPath = Path.GetFullPath(@".\DestinationPath"),
            };

            var mergePostAction = new GetMergeFilesFromProjectPostAction(templateName, mergeFile);

            mergePostAction.Execute();

            Directory.Delete(path, true);

            Assert.True(GenContext.Current.MergeFilesFromProject.ContainsKey(relSourceFilePath));
        }