Esempio n. 1
0
        public void GetTest()
        {
            string deviceId = Guid.NewGuid().ToString();
            var    now      = DateTime.Now;

            var twin = new Twin(deviceId);

            twin.Tags["x"] = "one";
            twin.Properties.Desired["y"]  = 1;
            twin.Properties.Reported["z"] = now;

            Assert.Equal(twin.Get("deviceId"), deviceId);
            Assert.Equal(twin.Get("twin.deviceId"), deviceId);
            Assert.Equal(twin.Get("tags.x").ToString(), "one");
            Assert.Equal(twin.Get("twin.tags.x").ToString(), "one");
            Assert.Equal((int)twin.Get("properties.desired.y"), 1);
            Assert.Equal((int)twin.Get("twin.properties.desired.y"), 1);
            Assert.Equal((DateTime)twin.Get("properties.reported.z"), now);
            Assert.Equal((DateTime)twin.Get("twin.properties.reported.z"), now);
        }
Esempio n. 2
0
        public void GetShouldReturnNullIfTagIsNotDefined()
        {
            var twin = new Twin();

            Assert.Null(twin.Get("tags.x"));
        }
Esempio n. 3
0
        public void GetShouldReturnNullIfFullNameIsInvalidate()
        {
            var twin = new Twin();

            Assert.Null(twin.Get("prefix.x"));
        }