public static CurrentDirectory ( ) : string | ||
Résultat | string |
public TaskTests() { beforeAssemblyPath = Path.GetFullPath(@"..\..\..\AssemblyToProcess\bin\Debug\AssemblyToProcess.dll"); #if (!DEBUG) beforeAssemblyPath = beforeAssemblyPath.Replace("Debug", "Release"); #endif afterAssemblyPath = beforeAssemblyPath.Replace(".dll", "2.dll"); File.Copy(beforeAssemblyPath, afterAssemblyPath, true); var moduleDefinition = ModuleDefinition.ReadModule(afterAssemblyPath); var currentDirectory = AssemblyLocation.CurrentDirectory(); var weavingTask = new ModuleWeaver { ModuleDefinition = moduleDefinition, AddinDirectoryPath = currentDirectory, SolutionDirectoryPath = currentDirectory, AssemblyFilePath = afterAssemblyPath, SvnHelper = new MockSvnHelper(), }; weavingTask.Execute(); moduleDefinition.Write(afterAssemblyPath); weavingTask.AfterWeaving(); assembly = Assembly.LoadFile(afterAssemblyPath); }
public void ToFriendlyName() { var currentDirectory = AssemblyLocation.CurrentDirectory().ToLowerInvariant() .Replace(@"bin\debug", string.Empty) .Replace(@"bin\release", string.Empty); try { ThrowException1(); } catch (Exception exception) { var friendlyString = exception.ToFriendlyString().ToLowerInvariant(); friendlyString = friendlyString .Replace(currentDirectory, string.Empty); // ReSharper disable StringLiteralTypo var expected = @"an unhandled exception occurred: exception: foo stacktrace: at tofriendlystringtests.throwexception2() in tofriendlystringtests.cs:line 60 at tofriendlystringtests.throwexception1() in tofriendlystringtests.cs:line 55 at tofriendlystringtests.tofriendlyname() in tofriendlystringtests.cs:line 15 source: fodycommon.tests targetsite: void throwexception2() "; // ReSharper restore StringLiteralTypo Assert.AreEqual(expected, friendlyString); } }
static IEnumerable <string> GetPaths() { var currentDirectory = AssemblyLocation.CurrentDirectory(); yield return(Path.Combine(currentDirectory, @"ProjectWeaversReaderTests\FodyWeavers1.xml")); yield return(Path.Combine(currentDirectory, @"ProjectWeaversReaderTests\FodyWeavers2.xml")); yield return(Path.Combine(currentDirectory, @"ProjectWeaversReaderTests\FodyWeavers3.xml")); }
AppDomain CreateDomain() { Logger.LogInfo("Creating a new AppDomain"); var appDomainSetup = new AppDomainSetup { ApplicationBase = AssemblyLocation.CurrentDirectory(), }; return(AppDomain.CreateDomain(string.Format("Fody Domain for '{0}'", SolutionDirectoryPath), null, appDomainSetup)); }
static ContainsTypeChecker() { var appDomainSetup = new AppDomainSetup { ApplicationBase = AssemblyLocation.CurrentDirectory(), }; var appDomain = AppDomain.CreateDomain("Fody.ContainsTypeChecker", null, appDomainSetup); var instanceAndUnwrap = appDomain.CreateInstanceAndUnwrap("FodyIsolated", "IsolatedContainsTypeChecker"); containsTypeChecker = (IContainsTypeChecker)instanceAndUnwrap; }
public void AddCurrentFodyDirectoryToAddinSearch() { Logger.LogInfo(string.Format("SolutionDirectoryPath: {0}", SolutionDirectoryPath)); var fodyParentDirectory = Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName; if (!Directory.Exists(fodyParentDirectory)) { Logger.LogInfo(string.Format("Skipped scanning '{0}' for weavers since it doesn't exist.", fodyParentDirectory)); return; } AddWeaversFromDir(fodyParentDirectory); }
/// <summary> /// Initializes the module. /// </summary> public static void Initialize() { Logger.WriteInfo = s => Trace.WriteLine(s); var nativeBinaries = Path.Combine(AssemblyLocation.CurrentDirectory(), "NativeBinaries", GetProcessorArchitecture()); var existingPath = Environment.GetEnvironmentVariable("PATH"); if (existingPath.Contains(nativeBinaries)) { return; } var newPath = string.Concat(nativeBinaries, Path.PathSeparator, existingPath); Environment.SetEnvironmentVariable("PATH", newPath); }
public void AddToolsAssemblyLocationToAddinSearch() { var parent = Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName; var assemblyLocationToolsDirectory = Path.GetFullPath(Path.Combine(parent, "Tools")); if (Directory.Exists(assemblyLocationToolsDirectory)) { AddinSearchPaths.Add(assemblyLocationToolsDirectory); } else { Logger.LogInfo(string.Format("Could not search for addins in '{0}' because it does not exist", assemblyLocationToolsDirectory)); } }
public void Simple() { var path = Path.Combine(Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName, "Tools"); Directory.CreateDirectory(path); var logger = new Mock <BuildLogger>().Object; var processor = new AddinFinder { Logger = logger, SolutionDir = "Solution" }; processor.AddToolsAssemblyLocationToAddinSearch(); var searchPaths = processor.AddinSearchPaths; Assert.AreEqual(path, searchPaths[0]); }
public void Found() { var currentDirectory = AssemblyLocation.CurrentDirectory(); var combine = Path.Combine(currentDirectory, @"..\..\WeaversProjectFileFinder\WithWeaver"); var loggerMock = new Mock <BuildLogger>(); loggerMock.Setup(x => x.LogInfo(It.IsAny <string>())); var processor = new Processor { SolutionDirectoryPath = combine, Logger = loggerMock.Object }; processor.FindWeaverProjectFile(); Assert.IsTrue(processor.FoundWeaverProjectFile); loggerMock.Verify(); }
public void Foo() { var currentDirectory = AssemblyLocation.CurrentDirectory(); Debug.WriteLine(currentDirectory); }
public void Setup() { var path = Path.Combine(AssemblyLocation.CurrentDirectory(), "CosturaAssemblyToReference.dll"); File.Delete(path); }
public void Existing() { var fodyDir = FodyDirectoryFinder.TreeWalkForToolsFodyDir(AssemblyLocation.CurrentDirectory()); Assert.IsTrue(Directory.Exists(fodyDir)); }