public void EqualityOperatorShould_Work_OK_For_Protocol_Lines()
        {
            ProtocolLine pl1 = new ProtocolLine("Set;tagPath1;tagValue1;192");
            ProtocolLine pl2 = new ProtocolLine("Set;tagPath1;tagValue1;192");

            Assert.IsTrue(pl1 == pl2);
        }
        public void EqualsShould_Work_For_Equal_Protocol_Lines()
        {
            ProtocolLine pl1 = new ProtocolLine("Set;tagPath1;tagValue1;192");
            ProtocolLine pl2 = new ProtocolLine("Set;tagPath1;tagValue1;192");

            Assert.IsTrue(pl1.Equals(pl2));
        }
Example #3
0
        private void SetSingleTagFromProtocol(ProtocolLine protocolLine)
        {
            opcWriter.WriteSingleTag(new OpcTag(protocolLine.TagPath, protocolLine.TagValue, OpcTagQualityFromInteger(protocolLine.TagQualityInt)));

            IncrementCurrentProtocolLine();

            FillOpcDataGrid(opcReader.ReadAllTags());
        }
        public void ConstructorShould_Parse_Valid_Protocol_Line_With_Blanks()
        {
            ProtocolLine protocolLine = new ProtocolLine("Set; tagPath; tagValue; 192");

            Assert.AreEqual(ProtocolLine.Actions.Set, protocolLine.Action);
            Assert.AreEqual("tagPath", protocolLine.TagPath);
            Assert.AreEqual("tagValue", protocolLine.TagValue);
            Assert.AreEqual("192", protocolLine.TagQualityInt);
        }
Example #5
0
        public void Append(ProtocolLine protocolLine)
        {
            lines.Add(protocolLine);

            if (null != OnProtocolLineAdded)
            {
                OnProtocolLineAdded(this, new ProtocolLineAddedArgs(protocolLine));
            }
        }
Example #6
0
        public void Append(ProtocolLine protocolLine)
        {
            lines.Add(protocolLine);

            if (null != OnProtocolLineAdded)
            {
                OnProtocolLineAdded(this, new ProtocolLineAddedArgs(protocolLine));
            }
        }
Example #7
0
        private void CheckExpectedTagFromProtocol(ProtocolLine protocolLine)
        {
            List <OpcTag> opcTagList = opcReader.ReadAllTags();

            OpcTag.OpcTagQuality qualityFromInt =
                (OpcTag.OpcTagQuality)Convert.ToInt32(protocolLine.TagQualityInt);
            OpcTag tagToCheck = new OpcTag(protocolLine.TagPath, protocolLine.TagValue, qualityFromInt);

            if (opcTagList.Contains(tagToCheck))
            {
                FillOpcDataGrid(opcTagList);
                IncrementCurrentProtocolLine();
            }
        }
        public void EqualsShould_Work_For_UnEqual_Protocol_Lines()
        {
            ProtocolLine pl1 = new ProtocolLine("Set;tagPath1;tagValue1;192");

            ProtocolLine pl2 = new ProtocolLine("Dummy;tagPath1;tagValue1;192");
            Assert.IsFalse(pl1.Equals(pl2));

            pl2 = new ProtocolLine("Set;tagPath2;tagValue1;192");
            Assert.IsFalse(pl1.Equals(pl2));

            pl2 = new ProtocolLine("Set;tagPath1;tagValue2;192");
            Assert.IsFalse(pl1.Equals(pl2));

            pl2 = new ProtocolLine("Set;tagPath1;tagValue1;0");
            Assert.IsFalse(pl1.Equals(pl2));

            pl2 = new ProtocolLine("Dummy;tagPath1;tagValue1;0");
            Assert.IsFalse(pl1.Equals(pl2));
        }
Example #9
0
        private void ExecuteProtocolLine()
        {
            string lineToExecute = tbProtocol.Lines[currentProtocolLine];

            try
            {
                ProtocolLine protocolLine = new ProtocolLine(lineToExecute);

                switch (protocolLine.Action)
                {
                case ProtocolLine.Actions.Set:
                {
                    SetSingleTagFromProtocol(protocolLine);
                    break;
                }

                case ProtocolLine.Actions.Wait:
                {
                    CheckExpectedTagFromProtocol(protocolLine);
                    break;
                }

                case ProtocolLine.Actions.Dummy:
                {
                    IncrementCurrentProtocolLine();
                    break;
                }

                default: break;
                }
            }
            catch (ProtocolActionException)
            {
                MessageBox.Show("Invalid protocol action for line: " + lineToExecute);
            }
        }
 public ProtocolLineAddedArgs(ProtocolLine addedProtocolLine)
 {
     AddedProtocolLine = addedProtocolLine;
 }
Example #11
0
        private void SetSingleTagFromProtocol(ProtocolLine protocolLine)
        {
            opcWriter.WriteSingleTag(new OpcTag(protocolLine.TagPath, protocolLine.TagValue, OpcTagQualityFromInteger(protocolLine.TagQualityInt)));

            IncrementCurrentProtocolLine();

            FillOpcDataGrid(opcReader.ReadAllTags());
        }
Example #12
0
        private void ExecuteProtocolLine()
        {
            string lineToExecute = tbProtocol.Lines[currentProtocolLine];

            try
            {
                ProtocolLine protocolLine = new ProtocolLine(lineToExecute);

                switch (protocolLine.Action)
                {
                    case ProtocolLine.Actions.Set:
                        {
                            SetSingleTagFromProtocol(protocolLine);
                            break;
                        }
                    case ProtocolLine.Actions.Wait:
                        {
                            CheckExpectedTagFromProtocol(protocolLine);
                            break;
                        }
                    case ProtocolLine.Actions.Dummy:
                        {
                            IncrementCurrentProtocolLine();
                            break;
                        }
                    default: break;
                }
            }
            catch (ProtocolActionException)
            {
                MessageBox.Show("Invalid protocol action for line: " + lineToExecute);
            }
        }
Example #13
0
        private void CheckExpectedTagFromProtocol(ProtocolLine protocolLine)
        {
            List<OpcTag> opcTagList = opcReader.ReadAllTags();

            OpcTag.OpcTagQuality qualityFromInt =
                (OpcTag.OpcTagQuality)Convert.ToInt32(protocolLine.TagQualityInt);
            OpcTag tagToCheck = new OpcTag(protocolLine.TagPath, protocolLine.TagValue, qualityFromInt);

            if (opcTagList.Contains(tagToCheck))
            {
                FillOpcDataGrid(opcTagList);
                IncrementCurrentProtocolLine();
            }
        }
Example #14
0
        public void ToStringWithoutParametersShould_Produce_Semicolon_Separated_String()
        {
            ProtocolLine protocolLine = new ProtocolLine("Set;tagPath;tagValue;192");

            Assert.AreEqual("Set;tagPath;tagValue;192", protocolLine.ToString());
        }
Example #15
0
 public void UnknownActionShould_Cause_A_ProtocolActionException()
 {
     ProtocolLine protocolLine = new ProtocolLine("UnSet; tagPath; tagValue; 192");
 }
 public ProtocolLineAddedArgs(ProtocolLine addedProtocolLine)
 {
     AddedProtocolLine = addedProtocolLine;
 }
Example #17
0
 public void WhitespacesOnlyProtocolLineShould_Cause_An_ArgumentException()
 {
     ProtocolLine protocolLine = new ProtocolLine(" \t");
 }
Example #18
0
 public void InvalidLineShould_Cause_An_IndexOutOfRangeException()
 {
     ProtocolLine protocolLine = new ProtocolLine("Set; tagPath; tagValue");
 }
Example #19
0
        public void NotEqualOperatorShould_Work_For_Unequal_Protocol_Lines()
        {
            ProtocolLine pl1 = new ProtocolLine("Set;tagPath1;tagValue1;192");
            ProtocolLine pl2 = new ProtocolLine("Dummy;tagPath1;tagValue1;192");

            Assert.IsTrue(pl1 != pl2);
        }
Example #20
0
 public void DummyShould_Be_A_Valid_Contructor_Parameter()
 {
     ProtocolLine protocolLine = new ProtocolLine("Dummy");
 }
Example #21
0
 public void EmptyProtocolLineShould_Cause_An_ArgumentExceptionn()
 {
     ProtocolLine protocolLine = new ProtocolLine(string.Empty);
 }