public void Should_Not_Find_Module_By_AreaName() { var service = new DefaultWebModulesRegistration(new Mock <IAssemblyLoader>().Object, new Mock <IControllerExtensions>().Object); var descriptor = service.FindModuleByAreaName("Test"); Assert.IsNull(descriptor); }
public void Should_Find_Module_By_AreaName() { var loader = new Mock <IAssemblyLoader>(); loader .Setup(l => l.GetLoadableTypes(It.IsAny <Assembly>())) .Returns <Assembly>(r => new[] { typeof(SampleWebModuleDescriptor) }); var service = new DefaultWebModulesRegistration(loader.Object, new Mock <IControllerExtensions>().Object); service.AddModuleDescriptorTypeFromAssembly(GetType().Assembly); service.InitializeModules(); var sampleDescriptor = new SampleWebModuleDescriptor(); WebModuleDescriptor descriptor = service.FindModuleByAreaName(sampleDescriptor.AreaName); Assert.IsNotNull(descriptor); Assert.AreEqual(descriptor.Name, sampleDescriptor.Name); }