public void RefreshValuesTest1() { int a = 0; bool[] test1 = new bool[] { true, true }; bool[] test2 = new bool[] { true, true }; bool[] test3 = new bool[] { false, true }; bool[] test4 = new bool[] { false, false }; bool[] test5 = new bool[] { true, false }; bool[] test6 = new bool[] { true, false }; Tag d = myCollection.GetTagWithName("boolcoil1"); d.InnerTag.TagValueChangedEvent += delegate(ITagType tag) { a++; }; myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test1); myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test2); myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test3); myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test4); myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test5); myCollection.CoilStatuses.RefreshValues(myCollection.CoilStatuses.Maps[0], test6); Assert.AreEqual(3, a); }
public void GetTagWithNameTest() { TagCollection myCollection = new TagCollection(); foreach (var item in testTags.Values) { myCollection.AddTag(item); } int boolcount = 0; foreach (var item in testTags.Keys) { if (item.StartsWith("bool")) { if (myCollection.GetBoolTagWithName(item) != null) { boolcount++; } } } int ushortcount = 0; foreach (var item in testTags.Keys) { if (item.StartsWith("ushort")) { if (myCollection.GetUshortTagWithName(item) != null) { ushortcount++; } } } int floatcount = 0; foreach (var item in testTags.Keys) { if (item.StartsWith("float")) { if (myCollection.GetFloatTagWithName(item) != null) { floatcount++; } } } int totalcount = 0; foreach (var item in testTags.Keys) { if (myCollection.GetTagWithName(item) != null) { totalcount++; } } Assert.AreEqual(20, boolcount); Assert.AreEqual(20, ushortcount); Assert.AreEqual(20, floatcount); Assert.AreEqual(60, totalcount); }