Exemplo n.º 1
0
        public void When_BuildNodeFunctions_Expect_Reference(Node node, double expected)
        {
            var builder = new RealBuilder();

            builder.RegisterDefaultFunctions();
            Assert.AreEqual(expected, builder.Build(node), 1e-20);
        }
Exemplo n.º 2
0
        public void When_BuildVariable_Expect_Reference()
        {
            var builder  = new RealBuilder();
            var variable = new GetSetVariable <double>("a", Units.Volt);

            builder.VariableFound += (sender, args) =>
            {
                if (!args.Created && args.Node.Name == "a")
                {
                    args.Result = variable.Value;
                }
            };
            variable.Value = 2.0;
            Assert.AreEqual(5.0, builder.Build(Node.Add(Node.Variable("a"), 3.0)), 1e-20);
        }
Exemplo n.º 3
0
        public void When_BuildNode_Expect_Reference(Node node, double expected)
        {
            var builder = new RealBuilder();

            Assert.AreEqual(expected, builder.Build(node), 1e-20);
        }