public void AddItemToContext_Execute_Replacement() { var templateName = "Test"; var relativeFile = @".\Project\Source.cs"; var destPath = Path.GetFullPath(@".\DestinationPath"); var finalFile = Path.GetFullPath(@".\DestinationPath\Project\Source.cs"); GenContext.Current = new TestContextProvider() { DestinationPath = destPath, GenerationOutputPath = destPath, }; List <FakeCreationPath> testPrimaryOutputs = new List <FakeCreationPath>(); testPrimaryOutputs.Add(new FakeCreationPath() { Path = relativeFile }); var genParams = new Dictionary <string, string>(); genParams.Add("wts.projectName", "Project"); var mergePostAction = new AddItemToContextPostAction(templateName, testPrimaryOutputs, genParams, destPath); mergePostAction.Execute(); Assert.Contains(finalFile, GenContext.Current.ProjectInfo.ProjectItems); }
public void Execute() { var templateName = "Test"; var relativeFile = @".\Source.cs"; var destPath = Path.GetFullPath(@".\DestinationPath\Project"); var finalFile = Path.GetFullPath(@".\DestinationPath\Project\Source.cs"); GenContext.Current = new FakeContextProvider() { DestinationPath = destPath, OutputPath = destPath, }; List <FakeCreationPath> testPrimaryOutputs = new List <FakeCreationPath>(); testPrimaryOutputs.Add(new FakeCreationPath() { Path = relativeFile }); var mergePostAction = new AddItemToContextPostAction(templateName, testPrimaryOutputs, new Dictionary <string, string>()); mergePostAction.Execute(); Assert.True(GenContext.Current.ProjectItems.Contains(finalFile)); }