Exemplo n.º 1
0
        public void SetIgnoreStateTest()
        {
            TagPool.SetMinReadedCount(2);
            TagPool.ClearTagPool();

            List <TagInfo> tagList = TagPool.GetAllExistsTags();

            Assert.IsTrue(tagList.Count == 0);


            TagInfo ti1 = new TagInfo("111", "01");
            TagInfo ti2 = new TagInfo("111", "03");

            TagPool.AddTag(ti1);
            TagPool.AddTag(ti2);
            TagPool.ResetExistsState();
            tagList = TagPool.GetAllExistsTags();
            Assert.IsTrue(tagList.Count == 0);
            TagPool.AddTag(ti1);
            TagPool.AddTag(ti2);
            TagPool.SetIgnoreMisreading(true);
            TagPool.ResetExistsState();
            tagList = TagPool.GetAllExistsTags();
            Assert.IsTrue(tagList.Count == 1);
        }
Exemplo n.º 2
0
        public void TagPoolTest()
        {
            TagPool.ClearTagPool();
            TagPool.SetMinReadedCount(2);

            List <TagInfo> tagList = TagPool.GetAllExistsTags();

            TagPool.ResetExistsState();
            Assert.IsTrue(tagList.Count == 0);

            TagInfo ti01 = new TagInfo("300833B2DDD906C001010101", "01");

            ti01.port = common_port_9601;
            TagPool.AddTag(ti01);
            TagPool.ResetExistsState();
            tagList = TagPool.GetAllExistsTags();
            Assert.IsTrue(tagList.Count == 0);
            tagList = TagPool.GetAllExistsTags(true);
            string str = JsonConvert.SerializeObject(tagList);

            Assert.IsTrue(tagList.Count == 1);
            //Assert.IsTrue(tagList[0].epc == "300833B2DDD906C001010101");

            TagInfo ti02 = new TagInfo("300833B2DDD906C001010102", "01");

            ti02.port = common_port_9602;
            TagPool.AddTag(ti01);
            TagPool.AddTag(ti02);
            TagPool.AddTag(ti02);
            TagPool.ResetExistsState();
            tagList = TagPool.GetAllExistsTags();
            Assert.IsTrue(tagList.Count == 1);
            Assert.IsTrue(tagList.Exists((_tag) => { return(_tag.epc == "300833B2DDD906C001010102" && _tag.port == common_port_9602); }));
        }
Exemplo n.º 3
0
        public void TagPoolParseAndAddTagsTest()
        {
            string data = "Disc:2000/02/28 20:01:51, Last:2000/02/28 20:07:42, Count:00019, Ant:02, Type:04, Tag:300833B2DDD906C001010101" +
                          "Disc:2000/02/28 20:01:51, Last:2000/02/28 20:07:42, Count:00019, Ant:02, Type:04, Tag:300833B2DDD906C001010102 " +
                          "Disc:2000/02/28 20:01:51, Last:2000/02/28 20:07:42, Count:00019, Ant:02, Type:0 " +
                          "Disc:2000/02/28 20:01:51, Last:2000/02/28 20:07:42, Count:00019, Ant:02, Type:04, Tag:300833B2DDD906C001010103 " +
                          "Disc:2000/02/28 20:01:51, Last:2000/02/28 20:07:42, Count:00019, Ant:02, Tag:300833B2DDD906C001010103  ";

            TagPool.AddParser(common_port_9601, TagInfo.GetParseRawTagDataFunc(common_port_9601, TagPool.AddTagRange), true);
            List <TagInfo> tags = TagPool.GetRawDataParser(common_port_9601)(data);

            //TagPool.IntervalResetState();
            tags = TagPool.GetAllExistsTags(true);
            Assert.IsTrue(tags.Count == 3);
            Assert.IsTrue(tags.Exists((_tag) => { return(_tag.epc == "300833B2DDD906C001010101"); }));
            Assert.IsTrue(tags.Exists((_tag) => { return(_tag.epc == "300833B2DDD906C001010102"); }));
            Assert.IsTrue(tags.Exists((_tag) => { return(_tag.epc == "300833B2DDD906C001010103"); }));
        }