public SystemDataLogic(ISystemDataRepository dataRepository, ISystemPermissionRepository permissionRepository, ISystemMenuRepository menuRepository) : base(dataRepository) { _dataRepository = dataRepository; _permissionRepository = permissionRepository; _menuRepository = menuRepository; }
/// <summary> /// Creates an instanse of the query handler which handle a query for getting a collection of storage types for system usage. /// </summary> /// <returns>Instanse of the query handler which handle a query for getting a collection of storage types for system usage.</returns> private StorageTypeCollectionGetQueryHandlerForSystemView CreateSut() { _systemDataRepositoryMock = MockRepository.GenerateMock <ISystemDataRepository>(); _objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); return(new StorageTypeCollectionGetQueryHandlerForSystemView(_systemDataRepositoryMock, _objectMapperMock)); }
/// <summary> /// Creates the basic functionality for command handlers which handles commands for system data in the food waste domain. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> /// <param name="specification">Implementation of a specification which encapsulates validation rules.</param> /// <param name="commonValidations">Implementation of the common validations.</param> /// <param name="exceptionBuilder">Implementation of the builder which can build exceptions.</param> protected FoodWasteSystemDataCommandHandlerBase(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } if (foodWasteObjectMapper == null) { throw new ArgumentNullException("foodWasteObjectMapper"); } if (specification == null) { throw new ArgumentNullException("specification"); } if (commonValidations == null) { throw new ArgumentNullException("commonValidations"); } if (exceptionBuilder == null) { throw new ArgumentNullException("exceptionBuilder"); } _systemDataRepository = systemDataRepository; _foodWasteObjectMapper = foodWasteObjectMapper; _specification = specification; _commonValidations = commonValidations; _exceptionBuilder = exceptionBuilder; }
/// <summary> /// Creates the functionality which can merge fields in a static text. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> public StaticTextFieldMerge(ISystemDataRepository systemDataRepository) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } _systemDataRepository = systemDataRepository; }
/// <summary> /// Creates a command handler which handles a command for importing a food item from a given data provider. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> /// <param name="specification">Implementation of a specification which encapsulates validation rules.</param> /// <param name="commonValidations">Implementation of the common validations.</param> /// <param name="exceptionBuilder">Implementation of the builder which can build exceptions.</param> /// <param name="logicExecutor">Implementation of the logic executor which can execute basic logic.</param> public FoodItemImportFromDataProviderCommandHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder, ILogicExecutor logicExecutor) : base(systemDataRepository, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { if (logicExecutor == null) { throw new ArgumentNullException("logicExecutor"); } _logicExecutor = logicExecutor; }
public void TestThatConstructorThrowsArgumentNullExceptionWhenFoodWasteObjectMapperIsNull() { ISystemDataRepository systemDataRepositoryMock = MockRepository.GenerateMock <ISystemDataRepository>(); // ReSharper disable ObjectCreationAsStatement ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => new MyStorageTypeCollectionGetQueryHandler(systemDataRepositoryMock, null)); // ReSharper restore ObjectCreationAsStatement TestHelper.AssertArgumentNullExceptionIsValid(exception, "objectMapper"); }
/// <summary> /// Creates functionality which handles the query for getting a collection of translation informations. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public TranslationInfoCollectionGetQueryHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } if (foodWasteObjectMapper == null) { throw new ArgumentNullException("foodWasteObjectMapper"); } _systemDataRepository = systemDataRepository; _foodWasteObjectMapper = foodWasteObjectMapper; }
/// <summary> /// Creates a query handler which handles the query for getting a collection of data providers who handles payments. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public DataProviderWhoHandlesPaymentsCollectionGetQueryHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } if (foodWasteObjectMapper == null) { throw new ArgumentNullException("foodWasteObjectMapper"); } _systemDataRepository = systemDataRepository; _foodWasteObjectMapper = foodWasteObjectMapper; }
/// <summary> /// Creates functionality which handles a query for getting the tree of food groups. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> protected FoodGroupTreeGetQueryHandlerBase(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } if (foodWasteObjectMapper == null) { throw new ArgumentNullException("foodWasteObjectMapper"); } _systemDataRepository = systemDataRepository; _foodWasteObjectMapper = foodWasteObjectMapper; }
/// <summary> /// Creates a dispatcher which can dispatch the welcome letter to a household member. /// </summary> /// <param name="communicationRepository">Implementation of a repository used for communication with internal and external stakeholders in the food waste domain.</param> /// <param name="systemDataRepository">Implementation of a repository which can access system data for the food waste domain.</param> /// <param name="staticTextFieldMerge">Implementation of the functionality which can merge fields in a static text.</param> public WelcomeLetterDispatcher(ICommunicationRepository communicationRepository, ISystemDataRepository systemDataRepository, IStaticTextFieldMerge staticTextFieldMerge) : base(communicationRepository) { if (systemDataRepository == null) { throw new ArgumentNullException("systemDataRepository"); } if (staticTextFieldMerge == null) { throw new ArgumentNullException("staticTextFieldMerge"); } _systemDataRepository = systemDataRepository; _staticTextFieldMerge = staticTextFieldMerge; }
public SystemPermissionLogic(ISystemMenuButtonRepository menuButtonRepository, ISystemPermissionRepository permissionRepository, ISystemPermissionUserRepository permissionUserRepository, ISystemUserInfoRepository userInfoRepository, ISystemMenuRepository menuRepository, ISystemDataRepository dataRepository) : base(permissionRepository) { _menuButtonRepository = menuButtonRepository; _permissionRepository = permissionRepository; _permissionUsernRepository = permissionUserRepository; _userInfoRepository = userInfoRepository; _menuRepository = menuRepository; _dataRepository = dataRepository; }
/// <summary> /// Creates an instance of the private class for testing the functionality which handles a query for getting a collection of storage types. /// </summary> /// <param name="fixture">Auto fixture.</param> /// <param name="translationInfo">The translation informations which should be used when unit testing.</param> /// <param name="storageTypeCollection">The collection of storage types which should be used when unit testning.</param> /// <param name="storageTypeIdentificationViewCollection">The collection of the view for storage type identification which should be used when unit testing.</param> /// <returns>Instance of the private class for testing the functionality which handles a query for getting a collection of storage types.</returns> private MyStorageTypeCollectionGetQueryHandler CreateSut(Fixture fixture, ITranslationInfo translationInfo = null, IEnumerable <IStorageType> storageTypeCollection = null, IEnumerable <StorageTypeIdentificationView> storageTypeIdentificationViewCollection = null) { if (fixture == null) { throw new ArgumentNullException(nameof(fixture)); } _systemDataRepositoryMock = MockRepository.GenerateMock <ISystemDataRepository>(); _systemDataRepositoryMock.Stub(m => m.Get <ITranslationInfo>(Arg <Guid> .Is.Anything)) .Return(translationInfo ?? DomainObjectMockBuilder.BuildTranslationInfoMock()) .Repeat.Any(); _systemDataRepositoryMock.Stub(m => m.StorageTypeGetAll()) .Return(storageTypeCollection ?? DomainObjectMockBuilder.BuildStorageTypeMockCollection()) .Repeat.Any(); _objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); _objectMapperMock.Stub(m => m.Map <IEnumerable <IStorageType>, IEnumerable <StorageTypeIdentificationView> >(Arg <IEnumerable <IStorageType> > .Is.Anything, Arg <CultureInfo> .Is.Anything)) .Return(storageTypeIdentificationViewCollection ?? fixture.CreateMany <StorageTypeIdentificationView>(7).ToList()) .Repeat.Any(); return(new MyStorageTypeCollectionGetQueryHandler(_systemDataRepositoryMock, _objectMapperMock)); }
/// <summary> /// Creates an instance of the private class for testing the functionality which handles a query for getting a specific static text. /// </summary> /// <param name="staticTextType">Type of the static text to get.</param> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public MyStaticTextGetQueryHandler(StaticTextType staticTextType, ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) : base(systemDataRepository, foodWasteObjectMapper) { _staticTextType = staticTextType; }
/// <summary> /// Creates a private class for testing the query handler which handles a query for getting the collection of food items for system usage. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public MyFoodItemCollectionGetQueryHandlerForSystemView(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) : base(systemDataRepository, foodWasteObjectMapper) { }
/// <summary> /// Creates a query handler which handle a query for getting a collection of storage types for system usage. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> /// <param name="objectMapper">Implementation of the object mapper which can map objects in the food waste domain.</param> public StorageTypeCollectionGetQueryHandlerForSystemView(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper objectMapper) : base(systemDataRepository, objectMapper) { }
/// <summary> /// Creates a query handler which handles a query for getting the tree of food groups for household usage. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public FoodGroupTreeGetQueryHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) : base(systemDataRepository, foodWasteObjectMapper) { }
/// <summary> /// 构造器 /// </summary> /// <param name="systemDataRepository">系统数据仓储</param> public SystemDataService(ISystemDataRepository systemDataRepository) { this.systemDataRepository = systemDataRepository; }
/// <summary> /// Creates a private class for testing the functionality which handles a query for getting the collection of food items. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> /// <param name="onlyActive">Indication of whether only active food items should be included.</param> public MyFoodItemCollectionGetQueryHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, bool onlyActive) : base(systemDataRepository, foodWasteObjectMapper) { _onlyActive = onlyActive; }
public void TestSetUp() { var container = ContainerFactory.Create(); _systemDataRepository = container.Resolve <ISystemDataRepository>(); }
/// <summary> /// Creates the functionality which handles the query for getting the privacy policy. /// </summary> /// <param name="systemDataRepository">Implementation for a repository which can access system data in the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation for a object mapper which can map domain object in the food waste domain.</param> public PrivacyPolicyGetQueryHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper) : base(systemDataRepository, foodWasteObjectMapper) { }
/// <summary> /// Creates a command handler which handles a command for modifying a foreign key. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> /// <param name="specification">Implementation of a specification which encapsulates validation rules.</param> /// <param name="commonValidations">Implementation of the common validations.</param> /// <param name="exceptionBuilder">Implementation of the builder which can build exceptions.</param> public ForeignKeyModifyCommandHandler(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder) : base(systemDataRepository, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { }
/// <summary> /// 构造器 /// </summary> /// <param name="systemDataRepository">系统数据仓储</param> public SystemDataService(ISystemDataRepository systemDataRepository) { this.systemDataRepository = systemDataRepository; }
/// <summary> /// Creates an instance of the functionality which handles a query for getting a collection of storage types. /// </summary> /// <param name="systemDataRepository">Implementation of the repository which can access system data for the food waste domain.</param> /// <param name="objectMapper">Implementation of the object mapper which can map objects in the food waste domain.</param> protected StorageTypeCollectionGetQueryHandlerBase(ISystemDataRepository systemDataRepository, IFoodWasteObjectMapper objectMapper) { _systemDataRepository = systemDataRepository ?? throw new ArgumentNullException(nameof(systemDataRepository)); _objectMapper = objectMapper ?? throw new ArgumentNullException(nameof(objectMapper)); }