public void TestInitialize() { var odataProvider = new Mock <ILocationOdataProvider>().Object; var config = new MapperConfiguration(cfg => { cfg.AddProfile <DomainToClassProfile>(); cfg.AddProfile <ClassToDomainProfile>(); }); var mapper = new Mapper(config); RepositoryTestsHelper.Init(Consts.Collections.LocationCollectionName); _repository = new LocationReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)), odataProvider, mapper); }
public void ConstructorShouldFailWhenLocationReadRepositoryIsNull() { // Arrange var mapper = new Mock <IMapper>().Object; ILocationReadRepository locationReadRepository = null; var locationOdataProvider = new Mock <ILocationOdataProvider>().Object; // Act Action ctor = () => { new ListLocationQueryHandler(mapper, locationReadRepository, locationOdataProvider); }; // Assert ctor.Should().Throw <ArgumentNullException>(); }
public ListLocationQueryHandler(IMapper mapper, ILocationReadRepository locationReadRepository, ILocationOdataProvider locationOdataProvider) { _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _locationReadRepository = locationReadRepository ?? throw new ArgumentNullException(nameof(locationReadRepository)); _locationOdataProvider = locationOdataProvider ?? throw new ArgumentNullException(nameof(locationOdataProvider)); }