Exemplo n.º 1
0
        public void expect_measure_voltage_more_10()
        {
            const float measureVoltage = 30;
            const float measureCurrent = 7;
            var         init           = new Lambda.StateRead(_logger, _lambdaProtocol, _unit);

            _unit.MeasuredParameters(measureVoltage, 0, measureCurrent, 0, 0, 0);

            var exceptionWasRised = false;

            try
            {
                init.Process();
            }
            catch (LambdaFailureException)
            {
                exceptionWasRised = true;
            }

            Assert.AreEqual(
                "OUT 0",
                string.Join(", ", _transportLog),
                "lambdaProtocol");

            Assert.IsTrue(exceptionWasRised, "exception");

            //var config = ConfigurationProvider.Current.Configuration.GetCustomConfig<Config>();

            //var actual = string.Format("[] " + Lambda.StateRead.Info,
            //    config.Voltage, measureVoltage, measureCurrent);

            //Assert.AreEqual(actual, string.Join(", ", _loggerLog),
            //    "loger");
        }
Exemplo n.º 2
0
        public void expect_ok()
        {
            var init = new Lambda.StateRead(_logger, _lambdaProtocol, _unit);

            _unit.MeasuredParameters(27, 0, 6, 0, 0, 0);
            init.Process();

            Assert.AreEqual(
                "",
                string.Join(", ", _transportLog),
                "lambdaProtocol");

            var actual = "[] " + Lambda.StateRead.Ok;

            Assert.AreEqual(actual, string.Join(", ", _loggerLog),
                            "loger");
        }
Exemplo n.º 3
0
        public void expect_measure_voltage_3()
        {
            const float measureVoltage = 27;
            const float measureCurrent = 7;
            var         init           = new Lambda.StateRead(_logger, _lambdaProtocol, _unit);

            _unit.MeasuredParameters(measureVoltage, 0, measureCurrent, 0, 0, 0);
            init.Process();

            Assert.AreEqual(
                "",
                string.Join(", ", _transportLog),
                "lambdaProtocol");

            var config = ConfigurationProvider.Current.Configuration.GetCustomConfig <Config>();

            var actual = string.Format("[] " + Lambda.StateRead.Info,
                                       config.Voltage, measureVoltage, measureCurrent);

            Assert.AreEqual(actual, string.Join(", ", _loggerLog),
                            "loger");
        }