public void AssemblyLoading() { StringBuilder sb = new StringBuilder(); var directory = Temp.CreateDirectory(); var alphaDll = Temp.CreateDirectory().CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var betaDll = Temp.CreateDirectory().CreateFile("Beta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta); var gammaDll = Temp.CreateDirectory().CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma); var deltaDll = Temp.CreateDirectory().CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta); var loader = new DesktopAnalyzerAssemblyLoader(); loader.AddDependencyLocation(alphaDll.Path); loader.AddDependencyLocation(betaDll.Path); loader.AddDependencyLocation(gammaDll.Path); loader.AddDependencyLocation(deltaDll.Path); Assembly alpha = loader.LoadFromPath(alphaDll.Path); var a = alpha.CreateInstance("Alpha.A"); a.GetType().GetMethod("Write").Invoke(a, new object[] { sb, "Test A" }); Assembly beta = loader.LoadFromPath(betaDll.Path); var b = beta.CreateInstance("Beta.B"); b.GetType().GetMethod("Write").Invoke(b, new object[] { sb, "Test B" }); var expected = @"Delta: Gamma: Alpha: Test A Delta: Gamma: Beta: Test B "; var actual = sb.ToString(); Assert.Equal(expected, actual); }
public void AddDependencyLocationThrowsOnNull() { var loader = new DesktopAnalyzerAssemblyLoader(); Assert.Throws <ArgumentNullException>("fullPath", () => loader.AddDependencyLocation(null)); Assert.Throws <ArgumentException>("fullPath", () => loader.AddDependencyLocation("a")); }
public void AddDependencyLocationThrowsOnNull() { var loader = new DesktopAnalyzerAssemblyLoader(); Assert.Throws<ArgumentNullException>("fullPath", () => loader.AddDependencyLocation(null)); Assert.Throws<ArgumentException>("fullPath", () => loader.AddDependencyLocation("a")); }
public void ThrowsForMissingFile() { var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".dll"); var loader = new DesktopAnalyzerAssemblyLoader(); Assert.ThrowsAny <Exception>(() => loader.LoadFromPath(path)); }
public void ThrowsForMissingFile() { var path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".dll"); var loader = new DesktopAnalyzerAssemblyLoader(); Assert.ThrowsAny<Exception>(() => loader.LoadFromPath(path)); }
private static int MainCore(string[] args) { #if NET472 var loader = new DesktopAnalyzerAssemblyLoader(); #else var loader = new CoreClrAnalyzerAssemblyLoader(); #endif return(DesktopBuildClient.Run(args, RequestLanguage.CSharpCompile, Csc.Run, loader)); }
public void BasicLoad() { var directory = Temp.CreateDirectory(); var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var loader = new DesktopAnalyzerAssemblyLoader(); Assembly alpha = loader.LoadFromPath(alphaDll.Path); Assert.NotNull(alpha); }
public void BasicLoad() { var directory = Temp.CreateDirectory(); var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var loader = new DesktopAnalyzerAssemblyLoader(); Assembly alpha = loader.LoadFromPath(alphaDll.Path); Assert.NotNull(alpha); }
private static int MainCore(string[] args) { #if BOOTSTRAP ExitingTraceListener.Install(); #endif #if NET472 var loader = new DesktopAnalyzerAssemblyLoader(); #else var loader = new CoreClrAnalyzerAssemblyLoader(); #endif return(DesktopBuildClient.Run(args, RequestLanguage.VisualBasicCompile, Vbc.Run, loader)); }
public void AssemblyLoading() { StringBuilder sb = new StringBuilder(); var directory = Temp.CreateDirectory(); var alphaDll = Temp.CreateDirectory().CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var betaDll = Temp.CreateDirectory().CreateFile("Beta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta); var gammaDll = Temp.CreateDirectory().CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma); var deltaDll = Temp.CreateDirectory().CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta); var loader = new DesktopAnalyzerAssemblyLoader(); loader.AddDependencyLocation(alphaDll.Path); loader.AddDependencyLocation(betaDll.Path); loader.AddDependencyLocation(gammaDll.Path); loader.AddDependencyLocation(deltaDll.Path); Assembly alpha = loader.LoadFromPath(alphaDll.Path); var a = alpha.CreateInstance("Alpha.A"); a.GetType().GetMethod("Write").Invoke(a, new object[] { sb, "Test A" }); Assembly beta = loader.LoadFromPath(betaDll.Path); var b = beta.CreateInstance("Beta.B"); b.GetType().GetMethod("Write").Invoke(b, new object[] { sb, "Test B" }); var expected = @"Delta: Gamma: Alpha: Test A Delta: Gamma: Beta: Test B "; var actual = sb.ToString(); Assert.Equal(expected, actual); }