public WorkOrderReadRepository(IPersistenceContext persistenceContext,
                                       IOdataProvider odataProvider,
                                       IModelConverter modelConverter)
        {
            Guard.On(persistenceContext, Error.ArgumentNull(nameof(persistenceContext))).AgainstNull();
            Guard.On(odataProvider, Error.ArgumentNull(nameof(odataProvider))).AgainstNull();
            Guard.On(modelConverter, Error.ArgumentNull(nameof(modelConverter))).AgainstNull();

            _odataProvider  = odataProvider;
            _modelConverter = modelConverter;
            _collection     = persistenceContext.Database.GetCollection <WorkOrderClass>(Consts.Collections.WorkOrders);
        }
        public void ConstructorShouldFailWhenOdataProviderIsNull()
        {
            // Arrange
            var            mapper        = new Mock <IMapper>().Object;
            var            userFinder    = new Mock <IUserFinder>().Object;
            IOdataProvider odataProvider = null;

            // Act
            Action ctor = () => { new ListQueryHandler(mapper, userFinder, odataProvider); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Esempio n. 3
0
        public void CtorShouldFailWhenOdataProviderNull()
        {
            // Arrange
            var persistenceConfiguration           = new PersistenceConfiguration("mongodb://*****:*****@localhost:10255/admin?ssl=true");
            IPersistenceContext persistenceContext = new PersistenceContext(persistenceConfiguration);
            IOdataProvider      odataProvider      = null;
            IModelConverter     modelConverter     = new Mock <IModelConverter>().Object;

            // Act
            Action ctor = () => { new WorkOrderReadRepository(persistenceContext, odataProvider, modelConverter); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Esempio n. 4
0
 public ListQueryHandler(IMapper mapper, IUserFinder userFinder, IOdataProvider odataProvider)
 {
     _mapper        = mapper ?? throw Error.ArgumentNull(nameof(mapper));
     _userFinder    = userFinder ?? throw Error.ArgumentNull(nameof(userFinder));
     _odataProvider = odataProvider ?? throw Error.ArgumentNull(nameof(odataProvider));
 }