Exemplo n.º 1
0
        public void CanLoadCustomConfigWithoutMixingPrefix()
        {
            IOconfFileLoader.AddLoader("Mathing", (row, lineIndex) => new IOConfMathing(row, lineIndex));
            var(_, rowsEnum) = IOconfFileLoader.ParseLines(new[] { "Mathing;mymath;heater1 + 5" });
            var rows = rowsEnum.ToArray();

            Assert.AreEqual(1, rows.Length);
            Assert.IsInstanceOfType(rows[0], typeof(IOConfMathing));
        }
Exemplo n.º 2
0
        public void CanLoadAccountLine()
        {
            var(_, rowsEnum) = IOconfFileLoader.ParseLines(new[] { "Account;john;[email protected];johndoepass" });
            var rows = rowsEnum.ToArray();

            Assert.AreEqual(1, rows.Length);
            Assert.IsInstanceOfType(rows[0], typeof(IOconfAccount));
            var account = (IOconfAccount)rows[0];

            Assert.AreEqual("[email protected]", $"{account.Name}-{account.Email}-{account.Password}");
        }
Exemplo n.º 3
0
        public void CanLoadMathLine()
        {
            var(_, rowsEnum) = IOconfFileLoader.ParseLines(new[] { "Math;mymath;heater1 + 5" });
            var rows = rowsEnum.ToArray();

            Assert.AreEqual(1, rows.Length);
            Assert.IsInstanceOfType(rows[0], typeof(IOconfMath));
            var math = (IOconfMath)rows[0];

            Assert.AreEqual("mymath", math.Name);
            Assert.AreEqual(405, math.Calculate(new() { { "heater1", 400 } }).Value);
        }