public void FromAssembly_NullArgument() { Assert.Throws(typeof(ArgumentNullException), () => { var target = AssemblyTarget.FromAssembly(null); }); }
public void FromAssembly_CurrentAssembly() { var assembly = Assembly.GetExecutingAssembly(); var target = AssemblyTarget.FromAssembly(assembly); Assert.NotNull(target); Assert.Equal(assembly.CodeBase, target.CodeBase.ToString()); Assert.Equal(assembly.Location, target.Location); Assert.Equal(assembly.FullName, target.FullName); }
public void if_you_have_the_assembly_directly_just_load() { var registration = MockRepository.GenerateMock <IAssemblyRegistration>(); var theAssembly = GetType().Assembly; var target = AssemblyTarget.FromAssembly(theAssembly); target.Load(registration); registration.AssertWasCalled(x => x.Use(theAssembly)); registration.AssertWasNotCalled(x => x.LoadFromFile(null, null), x => x.IgnoreArguments()); }
public void LoadTarget_NoRefAssembly_LoadBits() { using (var context = AppDomainContext.Create()) { var targetPath = Path.GetFullPath(NoRefsAssemblyPath); var assembly = Assembly.LoadFile(targetPath); var target = AssemblyTarget.FromAssembly(assembly); context.LoadTarget(LoadMethod.LoadBits, target); var actual = context.LoadedAssemblies.FirstOrDefault(x => x.FullName.Equals(target.FullName)); Assert.NotNull(actual); Assert.Equal(target.FullName, actual.FullName); Assert.Equal(string.Empty, actual.Location); Assert.Equal(target.CodeBase, target.CodeBase); } }
public void LoadTargetWithReferences_InternalReferences_LoadBitsNoPdbSpecified() { using (var context = AppDomainContext.Create()) { var prevNumAssemblies = context.LoadedAssemblies.Count(); // Add the correct resolver path for the test dir. context.RemoteResolver.AddProbePath(Path.GetFullPath(InternalRefsAssemblyDir)); var targetPath = Path.GetFullPath(InternalRefsAssemblyPath); var assembly = Assembly.LoadFile(targetPath); var target = AssemblyTarget.FromAssembly(assembly); var targets = context.LoadTargetWithReferences(LoadMethod.LoadBits, target); Assert.True(context.LoadedAssemblies.Count() > prevNumAssemblies); Assert.True(targets.Any(x => x.FullName.Contains(InternalRefsAssemblyName))); Assert.True(targets.Any(x => x.FullName.Contains(AssemblyAName))); Assert.True(targets.Any(x => x.FullName.Contains(AssemblyBName))); } }
public void FromAssembly_NullArgument() { var target = AssemblyTarget.FromAssembly(null); }