Esempio 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");
        }
Esempio 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");
        }
Esempio n. 3
0
        public void en_culture()
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en");

            var actual = string.Empty;
            var init   = new Lambda.StateRead(null, null, null);

            try
            {
                init.PowerOn(null);
            }
            catch (LambdaFailureException exception)
            {
                actual = exception.Message;
            }

            const string expected = "Initializing device done previously";

            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void ru_culture()
        {
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("ru");

            var actual = string.Empty;
            var init   = new Lambda.StateRead(null, null, null);

            try
            {
                init.PowerOn(null);
            }
            catch (LambdaFailureException exception)
            {
                actual = exception.Message;
            }

            const string expected = "Инициализация устройства выполнена ранее";

            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
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");
        }
Esempio n. 6
0
        public void unexpected_read_init_method()
        {
            var init = new Lambda.StateRead(_logger, _lambdaProtocol, _unit);

            init.ReadInit(null);
        }
Esempio n. 7
0
        public void unexpected_powerOn_method()
        {
            var init = new Lambda.StateRead(_logger, _lambdaProtocol, _unit);

            init.PowerOn(null);
        }