Example #1
0
 public NumeralService(INumeralRepository numeralRepository, IUnitOfWork unitOfWork, IMapper mapper, MapperConfiguration configMapper)
 {
     _numeralRepository = numeralRepository;
     _unitOfWork        = unitOfWork;
     _mapper            = mapper;
     _configMapper      = configMapper;
 }
Example #2
0
        private void RegisterConverters(ContainerBuilder builder)
        {
            builder.Register(c =>
            {
                INumeralRepository repository = c.Resolve <INumeralRepository>();

                return(new ConverterStrategy(
                           repository.GetRomanToArabicMap(),
                           repository.GetArabicToRomanMap()));
            })
            .As <IConverterStrategy>()
            .SingleInstance();
        }
Example #3
0
        private void RegisterProductDependencies(ContainerBuilder builder)
        {
            builder.Register(c =>
            {
                INumeralRepository repository = c.Resolve <INumeralRepository>();

                return(new ProductCategorizer(
                           repository.GetIntergalacticProducts(),
                           repository.GetEarthyProducts()));
            })
            .As <IProductCategorizer>().SingleInstance();

            builder.RegisterType <ProductHelper>()
            .As <IProductHelper>().SingleInstance();
        }
Example #4
0
        public void LoadDependencyGraph()
        {
            builder.RegisterModule <DataAccessModule>();
            builder.RegisterModule <UtilitiesModule>();
            builder.RegisterModule <ValidationModule>();
            builder.RegisterModule <NumeralCalculatorModule>();

            builder.Register(c =>
            {
                INumeralRepository repository = c.Resolve <INumeralRepository>();

                return(new Runner(c.Resolve <IProcessor>(),
                                  repository.GetInputFileContents()));
            })
            .As <IStartable>()
            .SingleInstance();
        }
Example #5
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType <ValidationMessageManager>().As <IValidationMessageManager>().SingleInstance();
            builder.RegisterType <ArabicNumeralValidator>().As <IValidator <int> >().SingleInstance();


            builder.Register(c =>
            {
                INumeralRepository repository          = c.Resolve <INumeralRepository>();
                IEnumerable <char> romanNumeralSymbols = repository.GetRomanToArabicMap().Keys;
                return(new RomanNumeralValidator(romanNumeralSymbols));
            })
            .As <IValidator <string> >()
            .SingleInstance();

            builder.RegisterType <RuleValidationEngine>().As <IRuleValidationEngine>().SingleInstance();
        }
 public RomanNumeralToDecimalConverter(INumeralRepository numeralRepository)
 {
     _numeralRepository = numeralRepository;
 }
 public RomanNumeralValidator(INumeralRepository numeralRepository)
 {
     _numeralRepository = numeralRepository;
 }