예제 #1
0
        public PenaltyCalculationProcessorServicesTests()
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.Add(typeof(IPenaltyCalculationService), typeof(TurkeyPenaltyCalculationService), CountryEnum.TR.GetName(), ServiceLifetime.Transient);
            serviceCollection.Add(typeof(IPenaltyCalculationService), typeof(UnitedArabEmiratesPenaltyCalculationService), CountryEnum.AE.GetName(), ServiceLifetime.Transient);

            serviceCollection.AddTransient <IPenaltyCalculationServiceFactoryPatternResolver, PenaltyCalculationServiceFactoryPatternResolver>();

            var serviceProvider = serviceCollection.BuildServiceProvider();

            factoryPatternResolver = serviceProvider.GetService <IPenaltyCalculationServiceFactoryPatternResolver>();

            penaltyCalculationProcessor = new PenaltyCalculationProcessor(factoryPatternResolver);

            _mockRepo = new MockCountryRepository();
        }
 public HomeController(ICountryRepository countryRepository, IPenaltyCalculationProcessor penaltyCalculationProcessor)
 {
     _countryRepository           = countryRepository;
     _penaltyCalculationProcessor = penaltyCalculationProcessor;
 }