Ejemplo n.º 1
0
        public void UpdateRequiredTest()
        {
            var current = new Twin();

            current.Tags["x"] = 1;
            current.Properties.Desired["y"] = "one";

            var existing = new Twin();

            existing.Tags["x"] = 1;
            existing.Properties.Desired["y"] = "one";

            Assert.False(current.UpdateRequired(existing));

            existing.Properties.Reported["z"] = DateTime.Now;
            Assert.False(current.UpdateRequired(existing));

            existing.Tags["x"] = 2;
            Assert.True(current.UpdateRequired(existing));

            existing.Tags["x"] = current.Tags["x"];
            existing.Properties.Desired["y"] = "two";
            Assert.True(current.UpdateRequired(existing));

            existing.Properties.Desired["y"] = current.Properties.Desired["y"];
            existing.Tags["xx"] = 3;
            Assert.True(current.UpdateRequired(existing));
        }