public void ShouldReturnTheAssemblyIfItWasLoaded( [Frozen] Mock <IAssemblyUtility> assemblyUtilityMock, [Frozen] IDictionary <string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; var args = new ResolveEventArgs(_assemblyName.Name); var assembly = resolver.AssemblyResolve(this, args); assembly.ShouldEqual(_info.Assembly); }
public void ShouldLogTheAssemblyThatIsBeingResolved( [Frozen] Mock <IAssemblyUtility> assemblyUtilityMock, [Frozen] Mock <ILog> loggerMock, [Frozen] IDictionary <string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); loggerMock.Verify( l => l.DebugFormat("Resolving from: {0} to: {1}", _assemblyName.Name, It.Is <AssemblyName>(n => n.ToString().Equals(_assemblyName.ToString())))); }
public void ShouldLogTheAssemblyThatIsBeingResolved( [Frozen] Mock <IAssemblyUtility> assemblyUtilityMock, [Frozen] TestLogProvider logProvider, [Frozen] IDictionary <string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); logProvider.Output.ShouldContain( "DEBUG: Resolving from: " + _assemblyName.Name + " to: " + _assemblyName.ToString()); }
public void ShouldRetrieveTheMappedAssemblyInfo() { var assemblyUtilityMock = new Mock <IAssemblyUtility>(); var assemblyInfoMapMock = new Mock <IDictionary <string, AssemblyInfo> >(); assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); AssemblyInfo foundInfo = null; assemblyInfoMapMock.Setup(m => m.TryGetValue(It.IsAny <string>(), out foundInfo)).Returns(false); var resolver = new AppDomainAssemblyResolver( Mock.Of <ILog>(), Mock.Of <IFileSystem>(), Mock.Of <IAssemblyResolver>(), assemblyUtilityMock.Object, assemblyInfoMapMock.Object ); resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); assemblyInfoMapMock.Verify(m => m.TryGetValue(_assemblyName.Name, out foundInfo)); }
public void ShouldReturnTheAssemblyIfItWasLoaded( [Frozen] Mock<IAssemblyUtility> assemblyUtilityMock, [Frozen] IDictionary<string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; var args = new ResolveEventArgs(_assemblyName.Name); var assembly = resolver.AssemblyResolve(this, args); assembly.ShouldEqual(_info.Assembly); }
public void ShouldLogTheAssemblyThatIsBeingResolved( [Frozen] Mock<IAssemblyUtility> assemblyUtilityMock, [Frozen] TestLogProvider logProvider, [Frozen] IDictionary<string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); logProvider.Output.ShouldContain( "DEBUG: Resolving from: " + _assemblyName.Name + " to: " + _assemblyName.ToString()); }
public void ShouldRetrieveTheMappedAssemblyInfo() { var assemblyUtilityMock = new Mock<IAssemblyUtility>(); var assemblyInfoMapMock = new Mock<IDictionary<string, AssemblyInfo>>(); assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); AssemblyInfo foundInfo = null; assemblyInfoMapMock.Setup(m => m.TryGetValue(It.IsAny<string>(), out foundInfo)).Returns(false); var resolver = new AppDomainAssemblyResolver( new TestLogProvider(), Mock.Of<IFileSystem>(), Mock.Of<IAssemblyResolver>(), assemblyUtilityMock.Object, assemblyInfoMapMock.Object ); resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); assemblyInfoMapMock.Verify(m => m.TryGetValue(_assemblyName.Name, out foundInfo)); }
public void ShouldLogTheAssemblyThatIsBeingResolved( [Frozen] Mock<IAssemblyUtility> assemblyUtilityMock, [Frozen] Mock<ILog> loggerMock, [Frozen] IDictionary<string, AssemblyInfo> assemblyInfoMap, AppDomainAssemblyResolver resolver) { assemblyUtilityMock.Setup(u => u.GetAssemblyName(_info.Path)).Returns(_assemblyName); assemblyUtilityMock.Setup(u => u.LoadFile(_info.Path)).Returns(typeof(Mock).Assembly); assemblyInfoMap[_assemblyName.Name] = _info; resolver.AssemblyResolve(this, new ResolveEventArgs(_assemblyName.Name)); loggerMock.Verify( l => l.DebugFormat("Resolving from: {0} to: {1}", _assemblyName.Name, It.Is<AssemblyName>(n => n.ToString().Equals(_assemblyName.ToString())))); }