public MessageProcessorTestBase() { this.startTime = DateTimeOffset.UtcNow.Ticks; this.macAddress = Utility.GetMacAddress(); this.ServerConfiguration = new NetworkServerConfiguration { GatewayID = ServerGatewayID, LogToConsole = true, LogLevel = ((int)LogLevel.Debug).ToString(), }; Logger.Init(new LoggerConfiguration() { LogLevel = LogLevel.Debug, LogToConsole = true, }); this.PayloadDecoder = new TestLoRaPayloadDecoder(new LoRaPayloadDecoder()); this.PacketForwarder = new TestPacketForwarder(); this.LoRaDeviceApi = new Mock <LoRaDeviceAPIServiceBase>(MockBehavior.Strict); this.FrameCounterUpdateStrategyProvider = new LoRaDeviceFrameCounterUpdateStrategyProvider(ServerGatewayID, this.LoRaDeviceApi.Object); var deduplicationFactory = new DeduplicationStrategyFactory(this.LoRaDeviceApi.Object); var adrStrategyProvider = new LoRaADRStrategyProvider(); var adrManagerFactory = new LoRAADRManagerFactory(this.LoRaDeviceApi.Object); var functionBundlerProvider = new FunctionBundlerProvider(this.LoRaDeviceApi.Object); this.RequestHandlerImplementation = new DefaultLoRaDataRequestHandler(this.ServerConfiguration, this.FrameCounterUpdateStrategyProvider, this.PayloadDecoder, deduplicationFactory, adrStrategyProvider, adrManagerFactory, functionBundlerProvider); this.LoRaDeviceClient = new Mock <ILoRaDeviceClient>(MockBehavior.Strict); this.ConnectionManager = new LoRaDeviceClientConnectionManager(new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromSeconds(5) })); this.LoRaDeviceFactory = new TestLoRaDeviceFactory(this.ServerConfiguration, this.FrameCounterUpdateStrategyProvider, this.LoRaDeviceClient.Object, deduplicationFactory, adrStrategyProvider, adrManagerFactory, functionBundlerProvider, this.ConnectionManager); }
public MessageProcessorMultipleGatewayTest() { this.SecondServerConfiguration = new NetworkServerConfiguration { GatewayID = SecondServerGatewayID, LogToConsole = true, LogLevel = ((int)LogLevel.Debug).ToString(), }; this.SecondPacketForwarder = new TestPacketForwarder(); this.SecondLoRaDeviceApi = new Mock <LoRaDeviceAPIServiceBase>(MockBehavior.Strict); this.SecondFrameCounterUpdateStrategyProvider = new LoRaDeviceFrameCounterUpdateStrategyProvider(SecondServerGatewayID, this.SecondLoRaDeviceApi.Object); var deduplicationStrategyFactory = new DeduplicationStrategyFactory(this.SecondLoRaDeviceApi.Object); var loRaAdrManagerFactory = new LoRAADRManagerFactory(this.SecondLoRaDeviceApi.Object); var adrStrategyProvider = new LoRaADRStrategyProvider(); var functionBundlerProvider = new FunctionBundlerProvider(this.SecondLoRaDeviceApi.Object); this.secondRequestHandlerImplementation = new DefaultLoRaDataRequestHandler(this.SecondServerConfiguration, this.SecondFrameCounterUpdateStrategyProvider, new LoRaPayloadDecoder(), deduplicationStrategyFactory, adrStrategyProvider, loRaAdrManagerFactory, functionBundlerProvider); this.SecondLoRaDeviceClient = new Mock <ILoRaDeviceClient>(MockBehavior.Strict); this.SecondConnectionManager = new LoRaDeviceClientConnectionManager(new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromSeconds(5) })); this.SecondLoRaDeviceFactory = new TestLoRaDeviceFactory(this.SecondServerConfiguration, this.SecondFrameCounterUpdateStrategyProvider, this.SecondLoRaDeviceClient.Object, deduplicationStrategyFactory, adrStrategyProvider, loRaAdrManagerFactory, functionBundlerProvider, this.SecondConnectionManager); }
public MessageProcessorMultipleGatewayBase(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { SecondServerConfiguration = new NetworkServerConfiguration { GatewayID = SecondServerGatewayID, LogToConsole = true, LogLevel = ((int)LogLevel.Debug).ToString(CultureInfo.InvariantCulture), }; SecondDownstreamMessageSender = new TestDownstreamMessageSender(); SecondLoRaDeviceApi = new Mock <LoRaDeviceAPIServiceBase>(MockBehavior.Strict); SecondFrameCounterUpdateStrategyProvider = new LoRaDeviceFrameCounterUpdateStrategyProvider(SecondServerConfiguration, SecondLoRaDeviceApi.Object); this.cache = new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromSeconds(5) }); this.testOutputLoggerFactory = new TestOutputLoggerFactory(testOutputHelper); var deduplicationStrategyFactory = new DeduplicationStrategyFactory(this.testOutputLoggerFactory, this.testOutputLoggerFactory.CreateLogger <DeduplicationStrategyFactory>()); var loRaAdrManagerFactory = new LoRAADRManagerFactory(SecondLoRaDeviceApi.Object, this.testOutputLoggerFactory); var adrStrategyProvider = new LoRaADRStrategyProvider(this.testOutputLoggerFactory); var functionBundlerProvider = new FunctionBundlerProvider(SecondLoRaDeviceApi.Object, this.testOutputLoggerFactory, this.testOutputLoggerFactory.CreateLogger <FunctionBundlerProvider>()); SecondConcentratorDeduplication = new ConcentratorDeduplication(this.cache, this.testOutputLoggerFactory.CreateLogger <IConcentratorDeduplication>()); SecondRequestHandlerImplementation = new DefaultLoRaDataRequestHandler(SecondServerConfiguration, SecondFrameCounterUpdateStrategyProvider, SecondConcentratorDeduplication, new LoRaPayloadDecoder(this.testOutputLoggerFactory.CreateLogger <LoRaPayloadDecoder>()), deduplicationStrategyFactory, adrStrategyProvider, loRaAdrManagerFactory, functionBundlerProvider, this.testOutputLoggerFactory.CreateLogger <DefaultLoRaDataRequestHandler>(), null); SecondLoRaDeviceClient = new Mock <ILoRaDeviceClient>(MockBehavior.Strict); this.cache = new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromSeconds(5) }); var defaultRequestHandler = new DefaultLoRaDataRequestHandler(SecondServerConfiguration, SecondFrameCounterUpdateStrategyProvider, SecondConcentratorDeduplication, new LoRaPayloadDecoder(this.testOutputLoggerFactory.CreateLogger <LoRaPayloadDecoder>()), deduplicationStrategyFactory, adrStrategyProvider, loRaAdrManagerFactory, functionBundlerProvider, this.testOutputLoggerFactory.CreateLogger <DefaultLoRaDataRequestHandler>(), meter: null); SecondConnectionManager = new LoRaDeviceClientConnectionManager(this.cache, this.testOutputLoggerFactory.CreateLogger <LoRaDeviceClientConnectionManager>()); SecondLoRaDeviceFactory = new TestLoRaDeviceFactory(SecondServerConfiguration, SecondLoRaDeviceClient.Object, SecondConnectionManager, DeviceCache, defaultRequestHandler); }