public void ShouldGetMappingForDerivedTypesThanTheRegisteredOnes() { var regionAdapterMappings = new RegionAdapterMappings(); var regionAdapter = new MockRegionAdapter(); regionAdapterMappings.RegisterMapping(typeof(ItemsControl), regionAdapter); var returnedAdapter = regionAdapterMappings.GetMapping(typeof(ItemsControlDescendant)); Assert.IsNotNull(returnedAdapter); Assert.AreSame(regionAdapter, returnedAdapter); }
public void ShouldGetRegisteredMapping() { var regionAdapterMappings = new RegionAdapterMappings(); Type registeredType = typeof(ItemsControl); var regionAdapter = new MockRegionAdapter(); regionAdapterMappings.RegisterMapping(registeredType, regionAdapter); var returnedAdapter = regionAdapterMappings.GetMapping(registeredType); Assert.IsNotNull(returnedAdapter); Assert.AreSame(regionAdapter, returnedAdapter); }
public void ShouldGetTheMostSpecializedMapping() { var regionAdapterMappings = new RegionAdapterMappings(); var genericAdapter = new MockRegionAdapter(); var specializedAdapter = new MockRegionAdapter(); regionAdapterMappings.RegisterMapping(typeof(ItemsControl), genericAdapter); regionAdapterMappings.RegisterMapping(typeof(ItemsControlDescendant), specializedAdapter); var returnedAdapter = regionAdapterMappings.GetMapping(typeof(ItemsControlDescendant)); Assert.IsNotNull(returnedAdapter); Assert.AreSame(specializedAdapter, returnedAdapter); }
public void GetMappingOfUnregisteredTypeThrows() { var regionAdapterMappings = new RegionAdapterMappings(); regionAdapterMappings.GetMapping(typeof(object)); }