public void When_Message_Already_Prefixed_Scope_Should_Not_Be_Added()
        {
            var options = CreateLoggerConfigMonitor();

            options.CurrentValue.UseScopes = true;

            var moqInfo  = new Mock <Action <string> >();
            var provider = new Mock <LoRaConsoleLoggerProvider>(options);

            var logger = new TestLoRaConsoleLogger(moqInfo.Object, null, provider.Object);

            var devEUI  = new DevEui(0x12345678);
            var message = devEUI + " test";

            using var scope = logger.BeginDeviceScope(devEUI);
            logger.LogInformation(message);

            moqInfo.Verify(x => x.Invoke(It.Is <string>(x => x == message)), Times.Once);
        }
        public void When_Multiple_Scopes_Set_DevEUI_Preferred_Over_DevAddr_Preferred_Over_StationEUI(string devEuiScope, string devAddrScope, int?stationEuiScope, string expected)
        {
            // arrange
            var options  = CreateLoggerConfigMonitor();
            var moqInfo  = new Mock <Action <string> >();
            var provider = new Mock <LoRaConsoleLoggerProvider>(options);
            var logger   = new TestLoRaConsoleLogger(moqInfo.Object, null, provider.Object);

            // act
            using var euiScope = devEuiScope is { } someDevEuiScope?logger.BeginDeviceScope(DevEui.Parse(someDevEuiScope)) : default;

            using var addrScope = devAddrScope is null ? default : logger.BeginDeviceAddressScope(devAddrScope);
                                  using var statScope = stationEuiScope is { } s?logger.BeginEuiScope(new StationEui ((ulong)s)): default;

                                  logger.LogInformation("foo");

                                  // assert
                                  moqInfo.Verify(x => x.Invoke(expected), Times.Once);
        }
        public void When_Scope_Settings_Change_DevEUI_Is_Handled_In_The_Message(bool useScopes)
        {
            var options = CreateLoggerConfigMonitor();

            options.CurrentValue.UseScopes = useScopes;

            var moqInfo  = new Mock <Action <string> >();
            var provider = new Mock <LoRaConsoleLoggerProvider>(options);

            var logger = new TestLoRaConsoleLogger(moqInfo.Object, null, provider.Object);

            var          devEUI  = new DevEui(0x12345678);
            const string message = "test";

            using var scope = logger.BeginDeviceScope(devEUI);
            logger.LogInformation(message);

            var expected = useScopes ? devEUI + " " + message : message;

            moqInfo.Verify(x => x.Invoke(It.Is <string>(x => x == expected)), Times.Once);
        }