public void TryResolveAssemblyDependency_ResolveKnownAssembly_Success() { // arrange DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig(); DependencyResolver dr = new DependencyResolver( dcMock ); Assembly expectedAssembly = Assembly.GetExecutingAssembly(); string path = Path.GetDirectoryName( expectedAssembly.Location ); string assemblyName = expectedAssembly.FullName; dr.AddProbingPath( path, false ); Assembly resolvedAssembly = null; // act resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName ); // assert Assert.IsNotNull( resolvedAssembly ); Assert.AreEqual( expectedAssembly, resolvedAssembly ); }
public void TryResolveAssemblyDependency_TypeNameNull_RaiseArgumentNulLException() { // arrange DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig(); DependencyResolver dr = new DependencyResolver( dcMock ); Assembly expectedAssembly = Assembly.GetExecutingAssembly(); string path = Path.GetDirectoryName( expectedAssembly.Location ); string assemblyName = null; dr.AddProbingPath( path, false ); Assembly resolvedAssembly = null; // act resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName ); // assert }
public void TryResolveAssemblyDependency_ResolveKnownAssembly_RaiseBadImageFormatException() { // arrange DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig(); DependencyResolver dr = new DependencyResolver( dcMock ); Assembly expectedAssembly = Assembly.GetExecutingAssembly(); string path = Path.GetDirectoryName( expectedAssembly.Location ); string assemblyName = "InvalidDLL"; dr.AddProbingPath( path, false ); Assembly resolvedAssembly = null; // act resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName ); // assert }