public void SetUp() { _fixture = new Fixture(); _householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>(); _claimValueProviderMock = MockRepository.GenerateMock <IClaimValueProvider>(); _objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); }
/// <summary> /// Creates the basic functionality for command handlers which handles commands for household data in the food waste domain. /// </summary> /// <param name="householdDataRepository">Implementation of the repository which can access household 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 FoodWasteHouseholdDataCommandHandlerBase(IHouseholdDataRepository householdDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder) { if (householdDataRepository == null) { throw new ArgumentNullException("householdDataRepository"); } 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"); } _householdDataRepository = householdDataRepository; _foodWasteObjectMapper = foodWasteObjectMapper; _specification = specification; _commonValidations = commonValidations; _exceptionBuilder = exceptionBuilder; }
/// <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 which can handle a query for getting some data for a household member. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> protected HouseholdMemberDataGetQueryHandlerBase(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper) { ArgumentNullGuard.NotNull(householdDataRepository, nameof(householdDataRepository)) .NotNull(claimValueProvider, nameof(claimValueProvider)) .NotNull(foodWasteObjectMapper, nameof(foodWasteObjectMapper)); HouseholdDataRepository = householdDataRepository; ClaimValueProvider = claimValueProvider; ObjectMapper = foodWasteObjectMapper; }
public void SetUp() { _householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>(); _claimValueProviderMock = MockRepository.GenerateMock <IClaimValueProvider>(); _objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); _specificationMock = MockRepository.GenerateMock <ISpecification>(); _commonValidationsMock = MockRepository.GenerateMock <ICommonValidations>(); _exceptionBuilderMock = MockRepository.GenerateMock <IExceptionBuilder>(); _fixture = new Fixture(); }
public void TestThatConstructorThrowsArgumentNullExceptionWhenSystemDataRepositoryIsNull() { IFoodWasteObjectMapper objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); // ReSharper disable ObjectCreationAsStatement ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => new MyStorageTypeCollectionGetQueryHandler(null, objectMapperMock)); // ReSharper restore ObjectCreationAsStatement TestHelper.AssertArgumentNullExceptionIsValid(exception, "systemDataRepository"); }
public void SetUp() { _householdDataRepositoryMock = MockRepository.GenerateMock <IHouseholdDataRepository>(); _claimValueProviderMock = MockRepository.GenerateMock <IClaimValueProvider>(); _objectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); _specificationMock = MockRepository.GenerateMock <ISpecification>(); _commonValidationsMock = MockRepository.GenerateMock <ICommonValidations>(); _domainObjectValidationsMock = MockRepository.GenerateMock <IDomainObjectValidations>(); _logicExecutorMock = MockRepository.GenerateMock <ILogicExecutor>(); _exceptionBuilderMock = MockRepository.GenerateMock <IExceptionBuilder>(); _fixture = new Fixture(); _random = new Random(_fixture.Create <int>()); }
/// <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 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 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 which can check whether the current user has been created as a household member. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> public HouseholdMemberIsCreatedQueryHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper) { if (householdDataRepository == null) { throw new ArgumentNullException("householdDataRepository"); } if (claimValueProvider == null) { throw new ArgumentNullException("claimValueProvider"); } if (foodWasteObjectMapper == null) { throw new ArgumentNullException("foodWasteObjectMapper"); } _householdDataRepository = householdDataRepository; _claimValueProvider = claimValueProvider; _objectMapper = foodWasteObjectMapper; }
/// <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 a repository which can access system data for the food waste domain. /// </summary> /// <param name="foodWasteDataProvider">Implementation of a data provider which can access data in the food waste repository.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> public SystemDataRepository(IFoodWasteDataProvider foodWasteDataProvider, IFoodWasteObjectMapper foodWasteObjectMapper) : base(foodWasteDataProvider, foodWasteObjectMapper) { }
/// <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 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 the command handler which can handles the command for upgrading the membership on the current users household member account. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</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 a common validations.</param> /// <param name="domainObjectValidations">Implementaion of a common validations used by domain objects in the food waste domain.</param> /// <param name="exceptionBuilder">Implementation of a builder which can build exceptions.</param> public HouseholdMemberUpgradeMembershipCommandHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IDomainObjectValidations domainObjectValidations, IExceptionBuilder exceptionBuilder) : base(householdDataRepository, claimValueProvider, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { if (domainObjectValidations == null) { throw new ArgumentNullException("domainObjectValidations"); } _domainObjectValidations = domainObjectValidations; }
/// <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; }
/// <summary> /// Creates a command handler which handles a command for adding a household member to a given household on the current users household account. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</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 common validations.</param> /// <param name="domainObjectValidations">Implementation of common validations used by domain objects in the food waste domain.</param> /// <param name="logicExecutor">Implementation of the logic executor which can execute basic logic.</param> /// <param name="exceptionBuilder">Implementation of a builder which can build exceptions.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="domainObjectValidations"/> or <paramref name="logicExecutor"/> is null.</exception> public HouseholdAddHouseholdMemberCommandHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IDomainObjectValidations domainObjectValidations, ILogicExecutor logicExecutor, IExceptionBuilder exceptionBuilder) : base(householdDataRepository, claimValueProvider, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { ArgumentNullGuard.NotNull(domainObjectValidations, nameof(domainObjectValidations)) .NotNull(logicExecutor, nameof(logicExecutor)); _domainObjectValidations = domainObjectValidations; _logicExecutor = logicExecutor; }
/// <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> /// Creates a command handler which handles a command for adding a household to the current users household account. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</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 a common validations.</param> /// <param name="logicExecutor">Implementation of the logic executor which can execute basic logic.</param> /// <param name="exceptionBuilder">Implementation of a builder which can build exceptions.</param> public HouseholdAddCommandHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, ILogicExecutor logicExecutor, IExceptionBuilder exceptionBuilder) : base(householdDataRepository, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { if (claimValueProvider == null) { throw new ArgumentNullException("claimValueProvider"); } if (logicExecutor == null) { throw new ArgumentNullException("logicExecutor"); } _claimValueProvider = claimValueProvider; _logicExecutor = logicExecutor; }
/// <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> /// 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; }
/// <summary> /// Creates a repository which can access household data for the food waste domain. /// </summary> /// <param name="foodWasteDataProvider">Implementation of a data provider which can access data in the food waste repository.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> public HouseholdDataRepository(IFoodWasteDataProvider foodWasteDataProvider, IFoodWasteObjectMapper foodWasteObjectMapper) : base(foodWasteDataProvider, foodWasteObjectMapper) { }
public void SetUp() { _foodWasteDataProviderMock = MockRepository.GenerateMock <IFoodWasteDataProvider>(); _foodWasteObjectMapperMock = MockRepository.GenerateMock <IFoodWasteObjectMapper>(); _fixture = new Fixture(); }
/// <summary> /// Creates an instance of the private class for testing the basic functionality for command handlers which handles commands for household data in the food waste domain. /// </summary> /// <param name="householdDataRepository">Implementation of the repository which can access household 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 MyFoodWasteHouseholdDataCommandHandler(IHouseholdDataRepository householdDataRepository, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder) : base(householdDataRepository, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { }
/// <summary> /// Creates basic functionality used by repositories in the food waste domain. /// </summary> /// <param name="foodWasteDataProvider">Implementation of a data provider which can access data in the food waste repository.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> protected DataRepositoryBase(IFoodWasteDataProvider foodWasteDataProvider, IFoodWasteObjectMapper foodWasteObjectMapper) { _foodWasteDataProvider = foodWasteDataProvider ?? throw new ArgumentNullException(nameof(foodWasteDataProvider)); _foodWasteObjectMapper = foodWasteObjectMapper ?? throw new ArgumentNullException(nameof(foodWasteObjectMapper)); }
/// <summary> /// Creates the query handler which handles the query for getting household member data for the current user. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</param> /// <param name="foodWasteObjectMapper">Implementation of an object mapper which can map objects in the food waste domain.</param> public HouseholdMemberDataGetQueryHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper) : base(householdDataRepository, claimValueProvider, foodWasteObjectMapper) { }
/// <summary> /// Creates a command handler which handles a command for updating a household to the current users household account. /// </summary> /// <param name="householdDataRepository">Implementation of a repository which can access household data for the food waste domain.</param> /// <param name="claimValueProvider">Implementation of a provider which can resolve values from the current users claims.</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 a common validations.</param> /// <param name="exceptionBuilder">Implementation of a builder which can build exceptions.</param> public HouseholdUpdateCommandHandler(IHouseholdDataRepository householdDataRepository, IClaimValueProvider claimValueProvider, IFoodWasteObjectMapper foodWasteObjectMapper, ISpecification specification, ICommonValidations commonValidations, IExceptionBuilder exceptionBuilder) : base(householdDataRepository, claimValueProvider, foodWasteObjectMapper, specification, commonValidations, exceptionBuilder) { }
/// <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) { }