Example #1
0
 public ListBusinessUnitQueryHandler(IMapper mapper,
                                     IBusinessUnitReadRepository businessUnitReadRepository,
                                     IBusinessUnitOdataProvider businessUnitOdataProvider)
 {
     _mapper = mapper ?? throw Error.ArgumentNull(nameof(mapper));
     _businessUnitReadRepository = businessUnitReadRepository ?? throw Error.ArgumentNull(nameof(businessUnitReadRepository));
     _businessUnitOdataProvider  = businessUnitOdataProvider ?? throw Error.ArgumentNull(nameof(businessUnitOdataProvider));
 }
 public UpdateBusinessUnitCommandHandler(IBusinessUnitWriteRepository businessUnitWriteRepository,
                                         IBusinessUnitReadRepository businessUnitReadRepository,
                                         IVersionProvider versionProvider)
 {
     _businessUnitWriteRepository = businessUnitWriteRepository ?? throw Error.ArgumentNull(nameof(businessUnitWriteRepository));
     _businessUnitReadRepository  = businessUnitReadRepository ?? throw Error.ArgumentNull(nameof(businessUnitReadRepository));
     _versionProvider             = versionProvider ?? throw Error.ArgumentNull(nameof(versionProvider));
 }
        public void ConstructorShouldFailWhenBusinessUnitReadRepositoryIsNull()
        {
            // Arrange
            var mapper = new Mock <IMapper>().Object;
            IBusinessUnitReadRepository businessUnitReadRepository = null;

            // Act
            Action ctor = () =>
            {
                new GetBusinessUnitQueryHandler(mapper, businessUnitReadRepository);
            };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Example #4
0
        public void ConstructorShouldFailWhenBusinessUnitReadRepositoryIsNull()
        {
            // Arrange
            var businessUnitWriteRepository = new Mock <IBusinessUnitWriteRepository>().Object;
            IBusinessUnitReadRepository businessUnitReadRepository = null;
            var versionProvider = new Mock <IVersionProvider>().Object;

            // Act
            Action ctor = () =>
            {
                new UpdateBusinessUnitCommandHandler(businessUnitWriteRepository,
                                                     businessUnitReadRepository,
                                                     versionProvider);
            };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
 public void TestInitialize()
 {
     RepositoryTestsHelper.Init(Consts.Collections.BusinessUnitCollectionName);
     _repository = new BusinessUnitReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
 }
 public GetBusinessUnitQueryHandler(IMapper mapper,
                                    IBusinessUnitReadRepository businessUnitReadRepository)
 {
     _businessUnitReadRepository = businessUnitReadRepository ?? throw Error.ArgumentNull(nameof(businessUnitReadRepository));
     _mapper = mapper ?? throw Error.ArgumentNull(nameof(mapper));
 }