From 1e7e30bbcd6a08b994868e2dc073843d87589deb Mon Sep 17 00:00:00 2001 From: parallelbgls Date: Mon, 16 Jan 2017 10:30:21 +0800 Subject: [PATCH] Tests Architechture. --- Tests/Modbus.Net.Tests/AddressMaker.cs | 13 ++++ Tests/Modbus.Net.Tests/AddressTest.cs | 27 ++++++++ Tests/Modbus.Net.Tests/BaseTest.cs | 46 ++++++++++++-- Tests/Modbus.Net.Tests/CommunicationTest.cs | 62 +++++++++++++++++++ .../Modbus.Net.Tests/Modbus.Net.Tests.csproj | 7 ++- 5 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 Tests/Modbus.Net.Tests/AddressMaker.cs create mode 100644 Tests/Modbus.Net.Tests/AddressTest.cs create mode 100644 Tests/Modbus.Net.Tests/CommunicationTest.cs diff --git a/Tests/Modbus.Net.Tests/AddressMaker.cs b/Tests/Modbus.Net.Tests/AddressMaker.cs new file mode 100644 index 0000000..d9bbcfa --- /dev/null +++ b/Tests/Modbus.Net.Tests/AddressMaker.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Modbus.Net.Tests +{ + public class AddressMaker + { + + } +} diff --git a/Tests/Modbus.Net.Tests/AddressTest.cs b/Tests/Modbus.Net.Tests/AddressTest.cs new file mode 100644 index 0000000..2b6ad11 --- /dev/null +++ b/Tests/Modbus.Net.Tests/AddressTest.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Modbus.Net.Tests +{ + [TestClass] + public class AddressTest + { + [TestMethod] + public void CombinerTest() + { + + } + + [TestMethod] + public void FormaterTest() + { + + } + + [TestMethod] + public void TranslatorTest() + { + + } + } +} diff --git a/Tests/Modbus.Net.Tests/BaseTest.cs b/Tests/Modbus.Net.Tests/BaseTest.cs index 039f898..12f75fe 100644 --- a/Tests/Modbus.Net.Tests/BaseTest.cs +++ b/Tests/Modbus.Net.Tests/BaseTest.cs @@ -1,14 +1,50 @@ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace Modbus.Net.Tests { - [TestClass] - public class BaseTest + public sealed class TestAddresses { - [TestMethod] - public void TestMethod1() + private Dictionary[]> Addresses { get; } = new Dictionary[]>(); + + public Tuple[] this[string index] { + get { return Addresses[index]; } + set + { + if (!Addresses.ContainsKey(index)) + { + Addresses.Add(index, value); + } + else + { + Addresses[index] = value; + } + } + } + } + + public sealed class TestAreas + { + private Dictionary Areas { get; } = new Dictionary(); + + public string[] this[string index] + { + get { return Areas[index]; } + set + { + if (!Areas.ContainsKey(index)) + { + Areas.Add(index, value); + } + else + { + Areas[index] = value; + } + } } } } diff --git a/Tests/Modbus.Net.Tests/CommunicationTest.cs b/Tests/Modbus.Net.Tests/CommunicationTest.cs new file mode 100644 index 0000000..9c6f520 --- /dev/null +++ b/Tests/Modbus.Net.Tests/CommunicationTest.cs @@ -0,0 +1,62 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Modbus.Net.Tests +{ + [TestClass] + public class CommunicationTest + { + public void CommunicationInvoke(string addressFullName, int count) + { + + } + + [TestMethod] + public void CoilSingleRead() + { + + } + + [TestMethod] + public void CoilMuiltiRead() + { + + } + + [TestMethod] + public void CoilSingleWrite() + { + + } + + [TestMethod] + public void CoilMuiltiWrite() + { + + } + + [TestMethod] + public void RegisterSingleRead() + { + + } + + [TestMethod] + public void RegistertMultiRead() + { + + } + + [TestMethod] + public void RegisterSingleWrite() + { + + } + + [TestMethod] + public void RegistertMultiWrite() + { + + } + } +} diff --git a/Tests/Modbus.Net.Tests/Modbus.Net.Tests.csproj b/Tests/Modbus.Net.Tests/Modbus.Net.Tests.csproj index 5141707..f4aac55 100644 --- a/Tests/Modbus.Net.Tests/Modbus.Net.Tests.csproj +++ b/Tests/Modbus.Net.Tests/Modbus.Net.Tests.csproj @@ -45,13 +45,18 @@ - + + False + + + +