public void TransformWebConfig_ReturnDefaultWebConfig() { string projectFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); string fileName = "unrelated.txt"; try { //Arrange CreateDummyFile(projectFolder, fileName); var transformWebConfigTask = new TransformWebConfig(); var projectFile = Path.Combine(projectFolder, "Test.csproj"); //Act var webConfig = transformWebConfigTask.GetWebConfigFileOrDefault(projectFile, "web.config"); //Assert Assert.Equal(Path.Combine(projectFolder, "web.config"), webConfig); } finally { if (File.Exists(Path.Combine(projectFolder, fileName))) { File.Delete(Path.Combine(projectFolder, fileName)); } } }
public void TransformWebConfig_FindWebConfig(string webConfigToSearchFor) { string projectFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); try { //Arrange CreateDummyFile(projectFolder, webConfigToSearchFor); var transformWebConfigTask = new TransformWebConfig(); var projectFile = Path.Combine(projectFolder, "Test.csproj"); //Act var webConfig = transformWebConfigTask.GetWebConfigFileOrDefault(projectFile, "web.config"); //Assert Assert.Equal(Path.Combine(projectFolder, webConfigToSearchFor), webConfig); } finally { if (File.Exists(Path.Combine(projectFolder, webConfigToSearchFor))) { File.Delete(Path.Combine(projectFolder, webConfigToSearchFor)); } } }