Exemplo n.º 1
0
        public void TestRead()
        {
            PLCMemory memory = new PLCMemory();
            {
                memory["test1"] = 10;
                Assert.Equal(1, memory.Count);

                Dictionary <string, object> data = memory.Read(new string[] { "test1", "test2" });
                Assert.NotNull(data);
                Assert.Equal(1, data.Count);
                Assert.Equal(10, data["test1"]);
            }

            {
                memory["test1"] = "10";
                memory["test2"] = int.MinValue;
                Assert.Equal(2, memory.Count);

                Dictionary <string, object> data = memory.Read(new string[] { "test1", "test2" });
                Assert.NotNull(data);
                Assert.Equal(2, data.Count);
                Assert.Equal("10", data["test1"]);
                Assert.Equal(int.MinValue, data["test2"]);
            }
        }
Exemplo n.º 2
0
        public void TestEmpty()
        {
            PLCMemory memory = new PLCMemory();
            {
                Assert.Equal(0, memory.Count);

                Dictionary <string, object> data = memory.Read(new string[] { "test1", "test2" });
                Assert.NotNull(data);
                Assert.Equal(0, data.Count);
            }
        }