示例#1
0
 public ContributorController(ICustomerService customerService,
                              ILocalizationService localizationService,
                              IContributorService contributorService,
                              IPermissionService permissionService,
                              IUrlRecordService urlRecordService,
                              ILanguageService languageService,
                              ILocalizedEntityService localizedEntityService,
                              IPictureService pictureService,
                              IDateTimeHelper dateTimeHelper,
                              ContributorSettings contributorSettings,
                              ICustomerActivityService customerActivityService,
                              IAddressService addressService,
                              ICountryService countryService,
                              IStateProvinceService stateProvinceService)
 {
     this._customerService         = customerService;
     this._localizationService     = localizationService;
     this._contributorService      = contributorService;
     this._permissionService       = permissionService;
     this._urlRecordService        = urlRecordService;
     this._languageService         = languageService;
     this._localizedEntityService  = localizedEntityService;
     this._pictureService          = pictureService;
     this._dateTimeHelper          = dateTimeHelper;
     this._contributorSettings     = contributorSettings;
     this._customerActivityService = customerActivityService;
     this._addressService          = addressService;
     this._countryService          = countryService;
     this._stateProvinceService    = stateProvinceService;
 }
示例#2
0
 public ContributorApiController(IContributorService contributorService, IAuthenticationService <int> authService, IEmailService emailService, ITokenService tokenService, ILogger <ContributorApiController> logger) : base(logger)
 {
     _authService        = authService;
     _contributorService = contributorService;
     _emailService       = emailService;
     _tokenService       = tokenService;
 }
示例#3
0
 public WebWorkContext(HttpContextBase httpContext,
                       ICustomerService customerService,
                       IContributorService contributorService,
                       IStoreContext storeContext,
                       IAuthenticationService authenticationService,
                       ILanguageService languageService,
                       ICurrencyService currencyService,
                       IGenericAttributeService genericAttributeService,
                       TaxSettings taxSettings,
                       CurrencySettings currencySettings,
                       LocalizationSettings localizationSettings,
                       IUserAgentHelper userAgentHelper,
                       IStoreMappingService storeMappingService)
 {
     this._httpContext             = httpContext;
     this._customerService         = customerService;
     this._contributorService      = contributorService;
     this._storeContext            = storeContext;
     this._authenticationService   = authenticationService;
     this._languageService         = languageService;
     this._currencyService         = currencyService;
     this._genericAttributeService = genericAttributeService;
     this._taxSettings             = taxSettings;
     this._currencySettings        = currencySettings;
     this._localizationSettings    = localizationSettings;
     this._userAgentHelper         = userAgentHelper;
     this._storeMappingService     = storeMappingService;
 }
示例#4
0
        public ContributorController(IContributorModelFactory contributorModelFactory,
                                     IWorkContext workContext,
                                     ILocalizationService localizationService,
                                     ICustomerService customerService,
                                     IWorkflowMessageService workflowMessageService,
                                     IContributorService contributorService,
                                     IUrlRecordService urlRecordService,
                                     IPictureService pictureService,
                                     LocalizationSettings localizationSettings,
                                     ContributorSettings contributorSettings,
                                     CaptchaSettings captchaSettings)
        {
            this._contributorModelFactory = contributorModelFactory;
            this._workContext             = workContext;
            this._localizationService     = localizationService;
            this._customerService         = customerService;
            this._workflowMessageService  = workflowMessageService;
            this._contributorService      = contributorService;
            this._urlRecordService        = urlRecordService;
            this._pictureService          = pictureService;

            this._localizationSettings = localizationSettings;
            this._contributorSettings  = contributorSettings;
            this._captchaSettings      = captchaSettings;
        }
示例#5
0
        public ContributorController(IContributorService contributorService,
                                     ICommonService commonService)
        {
            _contributorService = contributorService;

            _commonService = commonService;
        }
        public void Initialize()
        {
            _fixture = new ContributorServiceTestsFixture();
            var httpClient = new HttpClient(_fixture.HttpMessageHandler);

            _contributorService = new ContributorService(httpClient);
        }
示例#7
0
        public CustomerController(ICustomerService customerService,
                                  IContributorService contributorService,
                                  IContextManager contextManager,
                                  IAppUserContext appUserContext)
        {
            if (customerService == null)
            {
                throw new ArgumentNullException(nameof(customerService));
            }

            if (contributorService == null)
            {
                throw new ArgumentNullException(nameof(contributorService));
            }

            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }

            if (appUserContext == null)
            {
                throw new ArgumentNullException(nameof(appUserContext));
            }

            _customerService    = customerService;
            _contributorService = contributorService;
            _contextManager     = contextManager;
            _appUserContext     = appUserContext;
        }
示例#8
0
        public ServiceDecompositionController(ICustomerService customerService,
                                              ICustomerPackService customerPackService,
                                              IDiagramService diagramService,
                                              IContributorService contributorService,
                                              ApplicationUserManager userManager,
                                              ApplicationRoleManager roleManager,
                                              IContextManager contextManager,
                                              IAppUserContext appUserContext) : base(contextManager)
        {
            if (customerService == null)
            {
                throw new ArgumentNullException(nameof(customerService));
            }

            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }

            if (appUserContext == null)
            {
                throw new ArgumentNullException(nameof(appUserContext));
            }

            if (customerPackService == null)
            {
                throw new ArgumentNullException(nameof(customerPackService));
            }

            if (diagramService == null)
            {
                throw new ArgumentNullException(nameof(diagramService));
            }

            if (contributorService == null)
            {
                throw new ArgumentNullException(nameof(contributorService));
            }

            if (userManager == null)
            {
                throw new ArgumentNullException(nameof(userManager));
            }

            if (roleManager == null)
            {
                throw new ArgumentNullException(nameof(roleManager));
            }

            _customerService     = customerService;
            _customerPackService = customerPackService;
            _diagramService      = diagramService;
            _contributorService  = contributorService;
            _userManager         = userManager;
            _roleManager         = roleManager;
            _contextManager      = contextManager;
            _appUserContext      = appUserContext;
        }
示例#9
0
 public SongCreateController(ISongService songService,
                             IContributorService contributorService,
                             ISongEditionService songEditionService,
                             ILibraryService libaryService)
 {
     _songService        = songService;
     _contributorService = contributorService;
     _songEditionService = songEditionService;
     _libaryService      = libaryService;
 }
        public async Task Should_ThrowException_When_ApiContributorReturnInvalidResponse()
        {
            // Arrange
            var contributorId = _fixture.UnlimitedDateContributorId;
            var httpClient    = new HttpClient(_fixture.EmptyResultsHttpMessageHandler);

            _contributorService = new ContributorService(httpClient);

            // Act
            var contributor = await _contributorService.GetContributorStats(contributorId);
        }
示例#11
0
 public APIController(
     IVoicingService voicingService,
     ISongService songService,
     IInstrumentationService instrumentationService,
     IContributorService contributorService)
 {
     _voicingService         = voicingService;
     _songService            = songService;
     _instrumentationService = instrumentationService;
     _contributorService     = contributorService;
 }
        public ContributorViewModel(IContributorService contributorService)
        {
            _contributorService = contributorService;

            var contributorStatsDateFrom = (DateTimeConsts.UnixEpoch).ToString(DateTimeConsts.DateTimeFormat);
            var contributorStatsDateTo   = (DateTimeConsts.Today).ToString(DateTimeConsts.DateTimeFormat);

            ContributorStatsDateRange = string.Format(ContributorStatsDateRangeStringFormat, contributorStatsDateFrom, contributorStatsDateTo);

            ChangeSelectDateRangeCommand = new Command(async() => await ChangeDateRage());
        }
示例#13
0
        public AdministrationController(IParameterService parameterService,
                                        ICustomerService customerService,
                                        IContributorService contributorService,
                                        IAssetService assetService,
                                        IRegionTypeRefDataService regionTypeRefDataService,
                                        IContextManager contextManager,
                                        ApplicationUserManager userManager,
                                        ApplicationRoleManager roleManager)
        {
            if (parameterService == null)
            {
                throw new ArgumentNullException(nameof(parameterService));
            }
            if (customerService == null)
            {
                throw new ArgumentNullException(nameof(customerService));
            }
            if (contributorService == null)
            {
                throw new ArgumentNullException(nameof(contributorService));
            }
            if (assetService == null)
            {
                throw new ArgumentNullException(nameof(assetService));
            }
            if (regionTypeRefDataService == null)
            {
                throw new ArgumentNullException(nameof(regionTypeRefDataService));
            }
            if (contextManager == null)
            {
                throw new ArgumentNullException(nameof(contextManager));
            }
            if (userManager == null)
            {
                throw new ArgumentNullException(nameof(userManager));
            }
            if (roleManager == null)
            {
                throw new ArgumentNullException(nameof(roleManager));
            }

            _parameterService         = parameterService;
            _customerService          = customerService;
            _contributorService       = contributorService;
            _assetService             = assetService;
            _regionTypeRefDataService = regionTypeRefDataService;
            _contextManager           = contextManager;
            _userManager = userManager;
            _roleManager = roleManager;
        }
        public async Task Should_ReturnNull_When_ApiContributorReturnErrorStatusCode()
        {
            // Arrange
            var contributorId = _fixture.UnlimitedDateContributorId;
            var httpClient    = new HttpClient(_fixture.ErrorStatusCodeHttpMessageHandler);

            _contributorService = new ContributorService(httpClient);

            // Act
            var repositories = await _contributorService.GetContributorStats(contributorId);

            // Assert
            Assert.IsNull(repositories);
        }
 public BackwardCompatibility2XController(IArticleService articleService,
                                          ICategoryService categoryService,
                                          IPublisherService publisherService,
                                          INewsService newsService,
                                          IBlogService blogService,
                                          ITopicService topicService,
                                          IContributorService contributorService)
 {
     this._articleService     = articleService;
     this._categoryService    = categoryService;
     this._publisherService   = publisherService;
     this._newsService        = newsService;
     this._blogService        = blogService;
     this._topicService       = topicService;
     this._contributorService = contributorService;
 }
示例#16
0
 public BabaController(ISongService songService,
                       IContributorService contributorService,
                       IHymnalService hymnalService,
                       IPublisherService publisherService,
                       IVoicingService voicingService,
                       IInstrumentationService instrumentationService,
                       ISongEditionService songEditionService
                       )
 {
     _songService            = songService;
     _contributorService     = contributorService;
     _hymnalService          = hymnalService;
     _publisherService       = publisherService;
     _voicingService         = voicingService;
     _instrumentationService = instrumentationService;
     _songEditionService     = songEditionService;
 }
示例#17
0
 public PublisherController(ICategoryService categoryService,
                            IPublisherService publisherService,
                            IPublisherTemplateService publisherTemplateService,
                            IArticleService articleService,
                            ICustomerService customerService,
                            IStoreService storeService,
                            IStoreMappingService storeMappingService,
                            IUrlRecordService urlRecordService,
                            IPictureService pictureService,
                            ILanguageService languageService,
                            ILocalizationService localizationService,
                            ILocalizedEntityService localizedEntityService,
                            IExportManager exportManager,
                            ICustomerActivityService customerActivityService,
                            IContributorService contributorService,
                            IAclService aclService,
                            IPermissionService permissionService,
                            CatalogSettings catalogSettings,
                            IWorkContext workContext,
                            IImportManager importManager,
                            ICacheManager cacheManager)
 {
     this._categoryService          = categoryService;
     this._publisherTemplateService = publisherTemplateService;
     this._publisherService         = publisherService;
     this._articleService           = articleService;
     this._customerService          = customerService;
     this._storeService             = storeService;
     this._storeMappingService      = storeMappingService;
     this._urlRecordService         = urlRecordService;
     this._pictureService           = pictureService;
     this._languageService          = languageService;
     this._localizationService      = localizationService;
     this._localizedEntityService   = localizedEntityService;
     this._exportManager            = exportManager;
     this._customerActivityService  = customerActivityService;
     this._contributorService       = contributorService;
     this._aclService        = aclService;
     this._permissionService = permissionService;
     this._catalogSettings   = catalogSettings;
     this._workContext       = workContext;
     this._importManager     = importManager;
     this._cacheManager      = cacheManager;
 }
示例#18
0
        public CommonController(ICommonModelFactory commonModelFactory,
                                ILanguageService languageService,
                                ICurrencyService currencyService,
                                ILocalizationService localizationService,
                                IWorkContext workContext,
                                IStoreContext storeContext,
                                IQueuedEmailService queuedEmailService,
                                IEmailAccountService emailAccountService,
                                IThemeContext themeContext,
                                IGenericAttributeService genericAttributeService,
                                ICustomerActivityService customerActivityService,
                                IContributorService contributorService,
                                IWorkflowMessageService workflowMessageService,
                                TaxSettings taxSettings,
                                StoreInformationSettings storeInformationSettings,
                                EmailAccountSettings emailAccountSettings,
                                CommonSettings commonSettings,
                                LocalizationSettings localizationSettings,
                                CaptchaSettings captchaSettings,
                                ContributorSettings contributorSettings)
        {
            this._commonModelFactory      = commonModelFactory;
            this._languageService         = languageService;
            this._currencyService         = currencyService;
            this._localizationService     = localizationService;
            this._workContext             = workContext;
            this._storeContext            = storeContext;
            this._queuedEmailService      = queuedEmailService;
            this._emailAccountService     = emailAccountService;
            this._themeContext            = themeContext;
            this._genericAttributeService = genericAttributeService;
            this._customerActivityService = customerActivityService;
            this._contributorService      = contributorService;
            this._workflowMessageService  = workflowMessageService;

            this._taxSettings = taxSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._emailAccountSettings     = emailAccountSettings;
            this._commonSettings           = commonSettings;
            this._localizationSettings     = localizationSettings;
            this._captchaSettings          = captchaSettings;
            this._contributorSettings      = contributorSettings;
        }
示例#19
0
 public CatalogController(ICatalogModelFactory catalogModelFactory,
                          IArticleModelFactory articleModelFactory,
                          ICategoryService categoryService,
                          IPublisherService publisherService,
                          IArticleService articleService,
                          IContributorService contributorService,
                          IWorkContext workContext,
                          IStoreContext storeContext,
                          ILocalizationService localizationService,
                          IWebHelper webHelper,
                          IArticleTagService articleTagService,
                          IGenericAttributeService genericAttributeService,
                          IAclService aclService,
                          IStoreMappingService storeMappingService,
                          IPermissionService permissionService,
                          ICustomerActivityService customerActivityService,
                          MediaSettings mediaSettings,
                          CatalogSettings catalogSettings,
                          ContributorSettings contributorSettings)
 {
     this._catalogModelFactory     = catalogModelFactory;
     this._articleModelFactory     = articleModelFactory;
     this._categoryService         = categoryService;
     this._publisherService        = publisherService;
     this._articleService          = articleService;
     this._contributorService      = contributorService;
     this._workContext             = workContext;
     this._storeContext            = storeContext;
     this._localizationService     = localizationService;
     this._webHelper               = webHelper;
     this._articleTagService       = articleTagService;
     this._genericAttributeService = genericAttributeService;
     this._aclService              = aclService;
     this._storeMappingService     = storeMappingService;
     this._permissionService       = permissionService;
     this._customerActivityService = customerActivityService;
     this._mediaSettings           = mediaSettings;
     this._catalogSettings         = catalogSettings;
     this._contributorSettings     = contributorSettings;
 }
        public void TestInitilize()
        {
            _mockUnitOfWork = new Mock <IUnitOfWork>();
            var dateTimeNow = DateTime.Now;

            _contributors = new List <Contributor>
            {
                new Contributor
                {
                    Id           = 1,
                    CustomerId   = 1,
                    UserId       = UserIdOne,
                    EmailAddress = UserNameOne,
                    InsertedBy   = UserNameOne,
                    InsertedDate = dateTimeNow,
                    UpdatedBy    = UserNameOne,
                    UpdatedDate  = dateTimeNow,
                },
                new Contributor
                {
                    Id           = 1,
                    CustomerId   = 1,
                    UserId       = UserIdTwo,
                    EmailAddress = UserNameTwo,
                    InsertedBy   = UserNameOne,
                    InsertedDate = dateTimeNow,
                    UpdatedBy    = UserNameOne,
                    UpdatedDate  = dateTimeNow,
                },
            };


            _mockContributorRepository = MockRepositoryHelper.Create(_contributors, (entity, id) => entity.Id == (int)id);

            _contributorService = new ContributorService(
                _mockContributorRepository.Object, _mockUnitOfWork.Object);

            Bootstrapper.SetupAutoMapper();
        }
示例#21
0
        /// <summary>
        /// Get contributor list
        /// </summary>
        /// <param name="contributorService">Contributor service</param>
        /// <param name="cacheManager">Cache manager</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Contributor list</returns>
        public static List <SelectListItem> GetContributorList(IContributorService contributorService, ICacheManager cacheManager, bool showHidden = false)
        {
            if (contributorService == null)
            {
                throw new ArgumentNullException("contributorService");
            }

            if (cacheManager == null)
            {
                throw new ArgumentNullException("cacheManager");
            }

            string cacheKey  = string.Format(ModelCacheEventConsumer.CONTRIBUTORS_LIST_KEY, showHidden);
            var    listItems = cacheManager.Get(cacheKey, () =>
            {
                var contributors = contributorService.GetAllContributors(showHidden: showHidden);
                return(contributors.Select(v => new SelectListItem
                {
                    Text = v.Name,
                    Value = v.Id.ToString()
                }));
            });

            var result = new List <SelectListItem>();

            //clone the list to ensure that "selected" property is not set
            foreach (var item in listItems)
            {
                result.Add(new SelectListItem
                {
                    Text  = item.Text,
                    Value = item.Value
                });
            }

            return(result);
        }
 public CustomerRoleController(ICustomerService customerService,
                               ILocalizationService localizationService,
                               ICustomerActivityService customerActivityService,
                               IPermissionService permissionService,
                               IArticleService articleService,
                               ICategoryService categoryService,
                               IPublisherService publisherService,
                               IStoreService storeService,
                               IContributorService contributorService,
                               IWorkContext workContext,
                               ICacheManager cacheManager)
 {
     this._customerService         = customerService;
     this._localizationService     = localizationService;
     this._customerActivityService = customerActivityService;
     this._permissionService       = permissionService;
     this._articleService          = articleService;
     this._categoryService         = categoryService;
     this._publisherService        = publisherService;
     this._storeService            = storeService;
     this._contributorService      = contributorService;
     this._workContext             = workContext;
     this._cacheManager            = cacheManager;
 }
示例#23
0
 public ContributorController(IContributorService contributorService)
 {
     _contributorService = contributorService;
 }
        public void Initialize()
        {
            var container = new ObjectBuilder(ObjectBuilderHelper.SetupObjectBuilder).GetContainer();

            Logger.SetLogWriter(new LogWriterFactory().Create(), false);

            var config  = ConfigurationSourceFactory.Create();
            var factory = new ExceptionPolicyFactory(config);

            var exceptionManager = factory.CreateManager();

            container.RegisterInstance(exceptionManager);

            ExceptionPolicy.SetExceptionManager(exceptionManager, false);

            _appContext = new AppContext
            {
                CurrentCustomer = new CurrentCustomerViewModel
                {
                    Id = CustomerId
                }
            };

            _mockAppUserContext = new Mock <IAppUserContext>();

            _mockAppUserContext.Setup(s => s.Current).Returns(_appContext);

            _mockUserManager = new Mock <IUserManager>();
            _mockUserManager.Setup(s => s.Name).Returns(UserName);
            _mockResponseManager = new Mock <IResponseManager>();

            _mockContextManager = new Mock <IContextManager>();
            _mockContextManager.Setup(s => s.UserManager).Returns(_mockUserManager.Object);
            _mockContextManager.Setup(s => s.ResponseManager).Returns(_mockResponseManager.Object);

            _mockAppUserContext = new Mock <IAppUserContext>();
            _mockAppUserContext.Setup(s => s.Current).Returns(_appContext);

            _mockUnitOfWork = new Mock <IUnitOfWork>();
            var dateTimeNow = DateTime.Now;

            _customers = new List <Customer>
            {
                new Customer
                {
                    Id                = 1,
                    CustomerName      = "3663",
                    CustomerNotes     = "Some 3663 Customer Notes.",
                    Active            = true,
                    Baseline          = false,
                    AssignedArchitect = UserNameOne,
                    ServiceDesks      = new List <ServiceDesk>
                    {
                        new ServiceDesk
                        {
                            DeskName       = "Desk 1",
                            DeskInputTypes = new List <DeskInputType>()
                        }
                    },
                    InsertedBy   = UserNameOne,
                    InsertedDate = dateTimeNow,
                    UpdatedBy    = UserNameOne,
                    UpdatedDate  = dateTimeNow
                },
                new Customer
                {
                    Id                = 2,
                    CustomerName      = "ING",
                    CustomerNotes     = "Some ING Customer Notes.",
                    Active            = true,
                    Baseline          = false,
                    AssignedArchitect = UserNameTwo,
                    InsertedBy        = UserNameTwo,
                    InsertedDate      = dateTimeNow,
                    UpdatedBy         = UserNameTwo,
                    UpdatedDate       = dateTimeNow
                },
                new Customer
                {
                    Id                = 3,
                    CustomerName      = "ING InActive",
                    CustomerNotes     = "Some ING Customer Notes.",
                    Active            = false,
                    Baseline          = false,
                    AssignedArchitect = UserNameOne,
                    InsertedBy        = UserNameOne,
                    InsertedDate      = dateTimeNow,
                    UpdatedBy         = UserNameOne,
                    UpdatedDate       = dateTimeNow
                },
                new Customer
                {
                    Id                = 4,
                    CustomerName      = "3663 MJJ",
                    CustomerNotes     = "Some 3663 MJJ Customer Notes.",
                    Active            = true,
                    Baseline          = false,
                    AssignedArchitect = UserNameOne,
                    InsertedBy        = UserNameOne,
                    InsertedDate      = dateTimeNow,
                    UpdatedBy         = UserNameOne,
                    UpdatedDate       = dateTimeNow
                },
            };

            _contributors = new List <Contributor>
            {
                new Contributor
                {
                    Id           = 1,
                    CustomerId   = 2,
                    UserId       = Guid.NewGuid().ToString(),
                    EmailAddress = UserNameOne,
                    Customer     = _customers[1]
                }
            };



            _mockCustomerRepository    = MockRepositoryHelper.Create(_customers, (entity, id) => entity.Id == (int)id);
            _mockContributorRepository = MockRepositoryHelper.Create(_contributors, (entity, id) => entity.Id == (int)id);

            _customerService = new CustomerService(
                _mockCustomerRepository.Object, _mockContributorRepository.Object, _mockUnitOfWork.Object);

            _contributorService = new ContributorService(_mockContributorRepository.Object, _mockUnitOfWork.Object);

            _mockContributorService = new Mock <IContributorService>();
            _mockContributorService.Setup(s => s.GetById(1)).Returns(_contributors[0]);
            _mockContributorService.Setup(s => s.GetCustomersContributors(2)).Returns(_contributors.Where(c => c.CustomerId == 2).AsQueryable());

            _controller = new CustomerController(_customerService,
                                                 _contributorService,
                                                 _mockContextManager.Object,
                                                 _mockAppUserContext.Object);

            _mockCustomerService = new Mock <ICustomerService>();
            var inits = new Dictionary <Type, Func <object, object> >
            {
                { typeof(ICollection <ServiceDesk>), (s) => null }
            };

            _mockCustomerService.Setup(s => s.GetById(1)).Returns(_customers[0].GetClone(inits));
            _mockCustomerService.Setup(s => s.GetById(2)).Returns(_customers[1].GetClone(inits));
            _mockCustomerService.Setup(s => s.Update(It.IsAny <Customer>()))
            .Callback <Customer>(c => _customerUpdated = c);


            _controllerWithMockedCustomerService = new CustomerController(_mockCustomerService.Object,
                                                                          _mockContributorService.Object,
                                                                          _mockContextManager.Object,
                                                                          _mockAppUserContext.Object);

            Bootstrapper.SetupAutoMapper();
        }
示例#25
0
 public SongController(ISongService songService, IContributorService contributorService)
 {
     _songService        = songService;
     _contributorService = contributorService;
 }
 public ContributorController(IErrorService errorService, IContributorService contributorService) : base(errorService)
 {
     this._contributorService = contributorService;
 }