public FunctionBundlerTest() { var strategy = new Mock <ILoRaADRStrategy>(MockBehavior.Strict); strategy.Setup(x => x.DefaultNbRep).Returns(1); strategy.Setup(x => x.DefaultTxPower).Returns(0); strategy.Setup(x => x.MinimumNumberOfResult).Returns(20); strategy .Setup(x => x.ComputeResult(It.IsNotNull <string>(), It.IsAny <LoRaADRTable>(), It.IsAny <float>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())) .Returns((string devEUI, LoRaADRTable table, float snr, int upstreamDr, int minTxPower, int maxDr) => { return(new LoRaADRResult { CanConfirmToDevice = true, DataRate = upstreamDr, TxPower = 0 }); }); var strategyProvider = new Mock <ILoRaADRStrategyProvider>(MockBehavior.Strict); strategyProvider .Setup(x => x.GetStrategy()) .Returns(strategy.Object); // .Returns(new LoRaADRStandardStrategy()); var cacheStore = new LoRaInMemoryDeviceStore(); this.adrManager = new LoRaADRServerManager(new LoRaADRInMemoryStore(), strategyProvider.Object, cacheStore); this.adrExecutionItem = new ADRExecutionItem(this.adrManager); var items = new IFunctionBundlerExecutionItem[] { new DeduplicationExecutionItem(cacheStore), this.adrExecutionItem, new NextFCntDownExecutionItem(new FCntCacheCheck(cacheStore)), new PreferredGatewayExecutionItem(cacheStore, new NullLogger <PreferredGatewayExecutionItem>(), null), }; this.functionBundler = new FunctionBundlerFunction(items); }
public FunctionBundlerTest() { var strategyProvider = new Mock <ILoRaADRStrategyProvider>(MockBehavior.Strict); strategyProvider .Setup(x => x.GetStrategy()) .Returns(new LoRaADRStandardStrategy()); var cacheStore = new LoRaInMemoryDeviceStore(); this.adrManager = new LoRaADRServerManager(new LoRaADRInMemoryStore(), strategyProvider.Object, cacheStore); this.adrExecutionItem = new ADRExecutionItem(this.adrManager); var items = new IFunctionBundlerExecutionItem[] { new DeduplicationExecutionItem(cacheStore), this.adrExecutionItem, new NextFCntDownExecutionItem(new FCntCacheCheck(cacheStore)), new PreferredGatewayExecutionItem(cacheStore, new NullLogger <PreferredGatewayExecutionItem>(), null), }; this.functionBundler = new FunctionBundlerFunction(items); }
public ADRExecutionItem(ILoRaADRManager adrManager) { this.adrManager = adrManager; }