Example #1
0
        public ApplicationService(
            IConfiguration configuration,
            IDeviceServiceFactory deviceServiceFactory,
            IReceiverService receiverService
            )
        {
            _configuration        = configuration;
            _deviceServiceFactory = deviceServiceFactory;

            var clientId = _configuration["MqttOptions:ClientId"];
            var cseId    = _configuration["MqttOptions:CSEId"];
            var broker   = _configuration["MqttOptions:Broker"];
            var port     = Convert.ToInt32(_configuration["MqttOptions:Port"]);
            var timeout  = Convert.ToInt32(_configuration["MqttOptions:Timeout"]);
            var username = _configuration["MqttOptions:Username"];
            var password = _configuration["MqttOptions:Password"];

            _deviceClientOptions = new DeviceClientOptionsBuilder()
                                   .WithClientId(clientId)
                                   .WithCSEId(cseId)
                                   .WithMqttOptions(broker, port, timeout, username, password)
                                   .Build();

            _deviceService = _deviceServiceFactory.CreateDeviceService(_deviceClientOptions);

            _receiverService = receiverService;
        }
Example #2
0
        public void GetReceiverById_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService GetReceiverById() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);
            var receiver = new Receiver
            {
                Name = "Receiver1",
                DeliveryAddresses = new List <DeliveryAddress>
                {
                    new DeliveryAddress
                    {
                        Town   = "Town1",
                        Street = "Street1",
                    },
                    new DeliveryAddress
                    {
                        Town   = "Town2",
                        Street = "Street2",
                    },
                }
            };

            context.Receivers.Add(receiver);
            context.SaveChanges();

            var result = receiverService.GetReceiverById(receiver.Id);

            var expected = receiver;

            Assert.AreEqual(expected, result, errorMessagePrefix);
        }
Example #3
0
 public TelegramController(
     ITelegramService telegram,
     ISessionService session,
     IReceiverService receiver
     )
 {
     _telegram = telegram;
     _session  = session;
     _receiver = receiver;
 }
Example #4
0
 public BookingController(IUnitOfWork unitOfWork, DataContext context,
                          IBookingService bookingService, IStatusService statusService,
                          IMerchantService merchantService, IReceiverService receiverService,
                          ILogger <BookingController> logger)
 {
     _context         = context;
     _unitOfWork      = unitOfWork;
     _bookingService  = bookingService;
     _statusService   = statusService;
     _merchantService = merchantService;
     _receiverService = receiverService;
     _logger          = logger;
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IReceiverService receiverService)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            //receiverService.Receive();

            app.UseHttpsRedirection();
            app.UseMvc();
        }
Example #6
0
        public void DeleteAddress_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService DeleteAddress() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);

            var address = new DeliveryAddress()
            {
                Town = "Town1",
            };

            context.DeliveryAddresses.Add(address);
            context.SaveChanges();

            var result = receiverService.DeleteAddress(address.Id);

            Assert.True(result.isDeleted);
        }
Example #7
0
        public void Delete_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService Delete() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);

            var receiver = new Receiver
            {
                Name = "Receiver1",
            };

            context.Receivers.Add(receiver);
            context.SaveChanges();

            var result = receiverService.Delete(receiver.Id);

            Assert.True(result.isDeleted);
        }
Example #8
0
        public void CreateNewAddress_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService CreateNewAddress() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);

            var receiver = new Receiver
            {
                Name = "Receiver1",
            };

            context.Receivers.Add(receiver);
            context.SaveChanges();

            var result = receiverService.CreateNewAddress("Town1", "Street1", "Receiver1");

            Assert.True(context.DeliveryAddresses.Contains(result));
        }
Example #9
0
        public void EditIncludedAddress_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService EditIncludedAddress() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);

            var address = new DeliveryAddress()
            {
                Town   = "Town1",
                Street = "Street1",
            };

            context.DeliveryAddresses.Add(address);
            context.SaveChanges();

            var result = receiverService.EditIncludedAddress(address.Id, "Town2", "Street2");

            Assert.True(context.DeliveryAddresses.First().Town == "Town2");
            Assert.True(context.DeliveryAddresses.First().Street == "Street2");
        }
Example #10
0
 public NomenclaturesController(INomenclaturesService nomenclaturesService, IReceiverService receiverService, IMapper mapper)
 {
     _nomenclaturesService = nomenclaturesService;
     _receiverService      = receiverService;
     _mapper = mapper;
 }
 public GetUsersPageCountQueryHandler(IReceiverService receiverService)
 {
     _receiverService = receiverService;
 }
 public ValuesController(
     IReceiverService receiverService
     )
 {
     _receiverService = receiverService;
 }
Example #13
0
 public GetListOrganizationsQueryHandler(IReceiverService receiverService)
 {
     _receiverService = receiverService;
 }
Example #14
0
 public GetListUsersQueryHandler(IReceiverService receiverService)
 {
     _receiverService = receiverService;
 }
Example #15
0
 public CoreServiceTest()
 {
     _domainRabbitMQ  = new Mock <IDomainRabbitMQ>();
     _receiverService = new ReceiverService(_domainRabbitMQ.Object);
     _senderService   = new SenderService(_domainRabbitMQ.Object);
 }
Example #16
0
 public AddUserOrganizationCommandHandler(IReceiverService receiverService)
 {
     _receiverService = receiverService;
 }
Example #17
0
 public ReceiversController(IReceiverService receiversService, IMapper mapper)
 {
     _receiversService = receiversService;
     _mapper           = mapper;
 }
Example #18
0
 public BotController(ISenderService senderService, IReceiverService receiverService)
 {
     _receiverService = receiverService;
     _senderService   = senderService;
 }
Example #19
0
 public Consumer(ILogger <Consumer> logger, IReceiverService receiverService)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _receiverService = receiverService ?? throw new ArgumentNullException(nameof(receiverService));
 }
 public ReceiversController(IReceiverService receiverService) =>
Example #21
0
 public HomeController(IReceiverService receiverService)
 {
     _receiverService = receiverService;
 }