public void Test_Find_Path_Should_Exit_After_Four_Iterations() { //Act var actual = AssemblyFinderHelper.FindPath("Nothing", StartPath); //Assert Assert.AreEqual(@"c:\Root1", actual); }
public void Test_FindPath() { //Act var actual = AssemblyFinderHelper.FindPath("FakeB", StartPath); //Assert Assert.AreEqual(SourcePath2, actual); }
public void TestFindPathShouldExitAfterFourIterations() { //Arrange //Act var actual = AssemblyFinderHelper.FindPath("Nothing", StartPath); //Assert Assert.AreEqual(@"c:\Root1\", actual); }
/// <summary> /// Gets the assembly location. If an assembly is loaded at Runtime or it's loaded within a IIS context Assembly.Location property could be null /// This method reads the original location of the assembly that was LINQBridged /// </summary> /// <param name="type">The Type.</param> /// <param name="vsVersion">The Visual Studio version.</param> /// <returns></returns> private static string GetAssemblyLocation(Type @type, string vsVersion) { var registryKeyPath = string.Format(@"Software\LINQBridgeVs\{0}\Solutions", vsVersion); using (var key = Registry.CurrentUser.OpenSubKey(registryKeyPath)) { if (key != null) { var values = key.GetSubKeyNames(); var registryKey = key; foreach (var value in values) { var subKey = registryKey.OpenSubKey(value); if (subKey == null) { continue; } var name = subKey.GetValueNames().FirstOrDefault(p => { if ([email protected]) { return(p == @type.Assembly.GetName().Name); } var genericType = @type.GetGenericArguments()[0]; if (AssemblyFinderHelper.IsSystemAssembly(genericType.Assembly.GetName().Name)) { return(false); } return(p == genericType.Assembly.GetName().Name); }); if (string.IsNullOrEmpty(name)) { continue; } var keyValues = (string[])subKey.GetValue(name); Log.Write("Assembly Location Found: ", keyValues[1]); return(keyValues[1]);//At Position 1 there's the Assembly Path previously saved (When project was initially LINQBridged) } } } Log.Write("Assembly Location Found None"); return(string.Empty); }