Пример #1
0
        public void Save_Stores_ProtocolLines_In_The_File()
        {
            string projectName = "projectName";
            string protocolName = "protocolName";

            OpcMockProtocol omp = new OpcMockProtocol(protocolName);
            string ompLine1 = "Set;tagPath1;tagValue1;192";
            string ompLine2 = "Set;tagPath2;tagValue2;192";
            omp.Append(new ProtocolLine(ompLine1));
            omp.Append(new ProtocolLine(ompLine2));

            string protocolFilePath = TestContext.TestDeploymentDir + Path.DirectorySeparatorChar + protocolName + FileExtensionContants.FileExtensionProtocol;

            ProtocolWriter protocolWriter = new ProtocolWriter(TestContext.TestDeploymentDir, projectName);

            protocolWriter.Save(omp);

            string expectedFileContent = ompLine1 + Environment.NewLine + ompLine2 + Environment.NewLine;

            string actualFileContent = File.ReadAllText(protocolFilePath);

            Assert.AreEqual(expectedFileContent, actualFileContent);

            File.Delete(protocolFilePath);
        }
Пример #2
0
        private void saveAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProtocolWriter protocolWriter = new ProtocolWriter(GetProjectFolderPath(), opcMockProject.Name);

            foreach (OpcMockProtocol omp in opcMockProject.Protocols)
            {
                protocolWriter.Save(omp);
            }
        }
Пример #3
0
        public void ProtocolWriter_Is_Created_With_A_Folder_Path()
        {
            string folderPath = "folderPath";
            string projectName = "projectName";

            ProtocolWriter protocolWriter = new ProtocolWriter(folderPath, projectName);

            Assert.AreEqual(folderPath, protocolWriter.FolderPath);
            Assert.AreEqual(projectName, protocolWriter.ProjectName);
        }
Пример #4
0
        public void Save_Creates_A_Protocol_File_In_The_FolderPath()
        {
            string projectName = "projectName";
            string protocolName = "protocolName";

            OpcMockProtocol opcMockProtocol = new OpcMockProtocol(protocolName);

            ProtocolWriter protocolWriter = new ProtocolWriter(TestContext.TestDeploymentDir, projectName);

            protocolWriter.Save(opcMockProtocol);

            string protocolFilePath = TestContext.TestDeploymentDir + Path.DirectorySeparatorChar + protocolName + FileExtensionContants.FileExtensionProtocol;

            Assert.IsTrue(File.Exists(protocolFilePath));

            File.Delete(protocolFilePath);
        }
Пример #5
0
        private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (cbProtocols.SelectedIndex > 0)
            {
                ProtocolWriter protocolWriter = new ProtocolWriter(GetProjectFolderPath(), opcMockProject.Name);

                OpcMockProtocol currentProtocol = new OpcMockProtocol(cbProtocols.SelectedText);

                foreach (string line in tbProtocol.Lines)
                {
                    try
                    {
                        currentProtocol.Append(new ProtocolLine(line));
                    }
                    catch (ArgumentException)
                    {
                        //End of protocol reached
                    }
                }

                protocolWriter.Save(currentProtocol);
            }
        }
Пример #6
0
        private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (cbProtocols.SelectedIndex > 0)
            {
                ProtocolWriter protocolWriter = new ProtocolWriter(GetProjectFolderPath(), opcMockProject.Name);

                OpcMockProtocol currentProtocol = new OpcMockProtocol(cbProtocols.SelectedText);

                foreach (string line in tbProtocol.Lines)
                {
                    try
                    {
                        currentProtocol.Append(new ProtocolLine(line));
                    }
                    catch (ArgumentException)
                    {
                        //End of protocol reached
                    }
                }

                protocolWriter.Save(currentProtocol);
            }
        }
Пример #7
0
        private void saveAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProtocolWriter protocolWriter = new ProtocolWriter(GetProjectFolderPath(), opcMockProject.Name);

            foreach (OpcMockProtocol omp in opcMockProject.Protocols)
            {
                protocolWriter.Save(omp);
            }
        }