Exemplo n.º 1
0
        public void UpdateFromString_InvalidUpdateString_ThrowException()
        {
            BatteryCell bc = new BatteryCell(2);
            string      updateString;

            updateString = "<>";
            Assert.Throws <InvalidUpdateStringException>(() => bc.UpdateFromString(updateString));
            updateString = "<B;23,45.2>";
            Assert.Throws <InvalidUpdateStringException>(() => bc.UpdateFromString(updateString));
            updateString = "<B,1,4>";
            Assert.Throws <InvalidUpdateStringException>(() => bc.UpdateFromString(updateString));
            updateString = "<B;3,45.1235>";
            Assert.Throws <InvalidUpdateStringException>(() => bc.UpdateFromString(updateString));
            updateString = "<B;,12>";
            Assert.Throws <InvalidUpdateStringException>(() => bc.UpdateFromString(updateString));
        }
Exemplo n.º 2
0
        public void UpdateFromString_InvalidUpdateString_ObjectUpdated()
        {
            BatteryCell bc = new BatteryCell(4)
            {
                Voltage = 3.5f
            };
            string updateString;

            updateString = "<BC;4,3.6>";
            bc.UpdateFromString(updateString);

            Assert.AreEqual(3.6f, bc.Voltage);
        }