Namespaces fixed

This commit is contained in:
Felix Weiß
2023-06-23 15:45:14 +02:00
parent 88ad175145
commit f5f1e3bea9
15 changed files with 63 additions and 87 deletions

View File

@@ -1,5 +1,5 @@
using MewtocolNet.Logging; using MewtocolNet.Logging;
using MewtocolNet.Subregisters; using MewtocolNet.Registers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,7 +1,7 @@
using MewtocolNet.Logging; using MewtocolNet.Logging;
using MewtocolNet.Queue; using MewtocolNet.Queue;
using MewtocolNet.RegisterAttributes; using MewtocolNet.RegisterAttributes;
using MewtocolNet.Subregisters; using MewtocolNet.Registers;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,6 +1,6 @@
using MewtocolNet.Logging; using MewtocolNet.Logging;
using MewtocolNet.PLCEnums; using MewtocolNet.PLCEnums;
using MewtocolNet.Subregisters; using MewtocolNet.Registers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;

View File

@@ -2,7 +2,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// Defines a register containing a boolean /// Defines a register containing a boolean

View File

@@ -1,4 +1,4 @@
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// Result for a boolean register /// Result for a boolean register

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// Defines a register containing a number /// Defines a register containing a number

View File

@@ -1,4 +1,5 @@
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// Result for a read/write operation /// Result for a read/write operation
/// </summary> /// </summary>
@@ -31,7 +32,4 @@
} }
} }

View File

@@ -2,7 +2,8 @@
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// Defines a register containing a string /// Defines a register containing a string
/// </summary> /// </summary>

View File

@@ -1,4 +1,4 @@
namespace MewtocolNet.Subregisters { namespace MewtocolNet.Registers {
/// <summary> /// <summary>
/// The results of a string register operation /// The results of a string register operation

View File

@@ -1,15 +1,11 @@
using Xunit;
using MewtocolNet; using MewtocolNet;
using System.Diagnostics;
using Xunit.Abstractions;
using System.Collections;
using MewtocolNet.RegisterAttributes; using MewtocolNet.RegisterAttributes;
using Microsoft.Win32; using MewtocolNet.Registers;
using MewtocolNet.Subregisters; using System.Collections;
using Xunit;
using Xunit.Abstractions;
namespace MewtocolTests namespace MewtocolTests {
{
public class AutomatedPropertyRegisters { public class AutomatedPropertyRegisters {
@@ -111,7 +107,7 @@ namespace MewtocolTests
//actual tests //actual tests
[Fact(DisplayName = "Boolean R generation")] [Fact(DisplayName = "Boolean R generation")]
public void BooleanGen () { public void BooleanGen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -124,7 +120,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Boolean input XD generation")] [Fact(DisplayName = "Boolean input XD generation")]
public void BooleanInputGen () { public void BooleanInputGen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -137,7 +133,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Int16 generation")] [Fact(DisplayName = "Int16 generation")]
public void Int16Gen () { public void Int16Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -150,7 +146,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "UInt16 generation")] [Fact(DisplayName = "UInt16 generation")]
public void UInt16Gen () { public void UInt16Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -163,7 +159,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Int32 generation")] [Fact(DisplayName = "Int32 generation")]
public void Int32Gen () { public void Int32Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -176,7 +172,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "UInt32 generation")] [Fact(DisplayName = "UInt32 generation")]
public void UInt32Gen () { public void UInt32Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -189,7 +185,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Float32 generation")] [Fact(DisplayName = "Float32 generation")]
public void Float32Gen () { public void Float32Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -202,7 +198,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "String generation")] [Fact(DisplayName = "String generation")]
public void StringGen () { public void StringGen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -218,7 +214,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "BitArray 16bit generation")] [Fact(DisplayName = "BitArray 16bit generation")]
public void BitArray16Gen () { public void BitArray16Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -234,7 +230,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "BitArray 32bit generation")] [Fact(DisplayName = "BitArray 32bit generation")]
public void BitArray32Gen () { public void BitArray32Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -250,7 +246,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "BitArray single bool generation")] [Fact(DisplayName = "BitArray single bool generation")]
public void BitArraySingleBool16Gen () { public void BitArraySingleBool16Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -265,7 +261,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "TimeSpan generation")] [Fact(DisplayName = "TimeSpan generation")]
public void TimespanGen () { public void TimespanGen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -278,7 +274,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Enum16 generation")] [Fact(DisplayName = "Enum16 generation")]
public void Enum16Gen () { public void Enum16Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();
@@ -291,7 +287,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Enum32 generation")] [Fact(DisplayName = "Enum32 generation")]
public void Enum32Gen () { public void Enum32Gen() {
var interf = new MewtocolInterface("192.168.0.1"); var interf = new MewtocolInterface("192.168.0.1");
interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller(); interf.WithRegisterCollection(new TestRegisterCollection()).WithPoller();

View File

@@ -1,10 +1,7 @@
using Xunit;
using MewtocolNet; using MewtocolNet;
using MewtocolNet.Registers;
using Xunit.Abstractions;
using MewtocolNet.Links;
using System.Collections; using System.Collections;
using Xunit;
using Xunit.Abstractions;
namespace MewtocolTests { namespace MewtocolTests {
@@ -12,12 +9,12 @@ namespace MewtocolTests {
private readonly ITestOutputHelper output; private readonly ITestOutputHelper output;
public TestHelperExtensions (ITestOutputHelper output) { public TestHelperExtensions(ITestOutputHelper output) {
this.output = output; this.output = output;
} }
[Fact(DisplayName = nameof(MewtocolHelpers.ToBitString))] [Fact(DisplayName = nameof(MewtocolHelpers.ToBitString))]
public void ToBitStringGeneration () { public void ToBitStringGeneration() {
var bitarr = new BitArray(16); var bitarr = new BitArray(16);
bitarr[2] = true; bitarr[2] = true;
@@ -31,7 +28,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = nameof(MewtocolHelpers.ToHexString))] [Fact(DisplayName = nameof(MewtocolHelpers.ToHexString))]
public void ToHexStringGeneration () { public void ToHexStringGeneration() {
var bytes = new byte[6] { var bytes = new byte[6] {
0x10, 0x10,
@@ -47,7 +44,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = nameof(MewtocolHelpers.ToHexASCIIBytes))] [Fact(DisplayName = nameof(MewtocolHelpers.ToHexASCIIBytes))]
public void ToHexASCIIBytesGeneration () { public void ToHexASCIIBytesGeneration() {
string test = "Hello, world!"; string test = "Hello, world!";
@@ -70,7 +67,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = nameof(MewtocolHelpers.BuildBCCFrame))] [Fact(DisplayName = nameof(MewtocolHelpers.BuildBCCFrame))]
public void BuildBCCFrameGeneration () { public void BuildBCCFrameGeneration() {
string test = "%01#RCSX0000"; string test = "%01#RCSX0000";
string expect = "%01#RCSX00001D"; string expect = "%01#RCSX00001D";
@@ -80,7 +77,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = nameof(MewtocolHelpers.ParseDTByteString))] [Fact(DisplayName = nameof(MewtocolHelpers.ParseDTByteString))]
public void ParseDTByteStringGeneration () { public void ParseDTByteStringGeneration() {
var testList = new List<string>() { var testList = new List<string>() {
"1112", "1112",
@@ -97,7 +94,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = nameof(MewtocolHelpers.ParseRCSingleBit))] [Fact(DisplayName = nameof(MewtocolHelpers.ParseRCSingleBit))]
public void ParseRCSingleBitGeneration () { public void ParseRCSingleBitGeneration() {
Assert.True($"%01$RC1".BuildBCCFrame().ParseRCSingleBit()); Assert.True($"%01$RC1".BuildBCCFrame().ParseRCSingleBit());
Assert.False($"%01$RC0".BuildBCCFrame().ParseRCSingleBit()); Assert.False($"%01$RC0".BuildBCCFrame().ParseRCSingleBit());

View File

@@ -1,22 +1,19 @@
using Xunit;
using MewtocolNet; using MewtocolNet;
using MewtocolNet.Registers; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace MewtocolTests namespace MewtocolTests {
{
public class TestLinkedLists { public class TestLinkedLists {
private readonly ITestOutputHelper output; private readonly ITestOutputHelper output;
public TestLinkedLists (ITestOutputHelper output) { public TestLinkedLists(ITestOutputHelper output) {
this.output = output; this.output = output;
} }
[Fact(DisplayName = "Linked error list")] [Fact(DisplayName = "Linked error list")]
public void NumericRegisterMewtocolIdentifiers () { public void NumericRegisterMewtocolIdentifiers() {
var expectedData = new Dictionary<int, string> { var expectedData = new Dictionary<int, string> {

View File

@@ -1,16 +1,10 @@
using MewtocolNet; using MewtocolNet;
using MewtocolNet.Logging; using MewtocolNet.Logging;
using MewtocolNet.PLCEnums; using MewtocolNet.PLCEnums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace MewtocolTests namespace MewtocolTests {
{
public class TestLivePLC { public class TestLivePLC {
@@ -39,12 +33,12 @@ namespace MewtocolTests
}; };
public TestLivePLC (ITestOutputHelper output) { public TestLivePLC(ITestOutputHelper output) {
this.output = output; this.output = output;
Logger.LogLevel = LogLevel.Verbose; Logger.LogLevel = LogLevel.Verbose;
Logger.OnNewLogMessage((d,m) => { Logger.OnNewLogMessage((d, m) => {
output.WriteLine($"Mewtocol Logger: {d} {m}"); output.WriteLine($"Mewtocol Logger: {d} {m}");
@@ -53,7 +47,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Connection cycle client to PLC")] [Fact(DisplayName = "Connection cycle client to PLC")]
public async void TestClientConnection () { public async void TestClientConnection() {
foreach (var plc in testData) { foreach (var plc in testData) {
@@ -74,7 +68,7 @@ namespace MewtocolTests
} }
[Fact(DisplayName = "Reading basic information from PLC")] [Fact(DisplayName = "Reading basic information from PLC")]
public async void TestClientReadPLCStatus () { public async void TestClientReadPLCStatus() {
foreach (var plc in testData) { foreach (var plc in testData) {

View File

@@ -1,7 +1,6 @@
using Xunit;
using MewtocolNet; using MewtocolNet;
using MewtocolNet.Registers; using MewtocolNet.Registers;
using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace MewtocolTests { namespace MewtocolTests {
@@ -10,12 +9,12 @@ namespace MewtocolTests {
private readonly ITestOutputHelper output; private readonly ITestOutputHelper output;
public TestRegisterInterface (ITestOutputHelper output) { public TestRegisterInterface(ITestOutputHelper output) {
this.output = output; this.output = output;
} }
[Fact(DisplayName = "Numeric mewtocol query building")] [Fact(DisplayName = "Numeric mewtocol query building")]
public void NumericRegisterMewtocolIdentifiers () { public void NumericRegisterMewtocolIdentifiers() {
List<IRegister> registers = new List<IRegister> { List<IRegister> registers = new List<IRegister> {
new NRegister<short>(50, _name: null), new NRegister<short>(50, _name: null),
@@ -48,7 +47,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = "PLC register naming convention test")] [Fact(DisplayName = "PLC register naming convention test")]
public void PLCRegisterIdentifiers () { public void PLCRegisterIdentifiers() {
List<IRegister> registers = new List<IRegister> { List<IRegister> registers = new List<IRegister> {
//numeric ones //numeric ones
@@ -107,7 +106,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = "Non allowed (Overflow address)")] [Fact(DisplayName = "Non allowed (Overflow address)")]
public void OverFlowRegisterAddress () { public void OverFlowRegisterAddress() {
var ex = Assert.Throws<NotSupportedException>(() => { var ex = Assert.Throws<NotSupportedException>(() => {
@@ -144,7 +143,7 @@ namespace MewtocolTests {
} }
[Fact(DisplayName = "Non allowed (Wrong data type)")] [Fact(DisplayName = "Non allowed (Wrong data type)")]
public void WrongDataTypeRegister () { public void WrongDataTypeRegister() {
var ex = Assert.Throws<NotSupportedException>(() => { var ex = Assert.Throws<NotSupportedException>(() => {

View File

@@ -1,11 +1,5 @@
using MewtocolNet; using MewtocolNet;
using MewtocolNet.Mewtocol;
using MewtocolNet.Registers; using MewtocolNet.Registers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
@@ -15,12 +9,12 @@ public class TestRegisterParsing {
private readonly ITestOutputHelper output; private readonly ITestOutputHelper output;
public TestRegisterParsing (ITestOutputHelper output) { public TestRegisterParsing(ITestOutputHelper output) {
this.output = output; this.output = output;
} }
[Fact(DisplayName = "Parsing as BRegister (Phyiscal Outputs)")] [Fact(DisplayName = "Parsing as BRegister (Phyiscal Outputs)")]
public void TestParsingBRegisterY () { public void TestParsingBRegisterY() {
var tests = new Dictionary<string, IRegister>() { var tests = new Dictionary<string, IRegister>() {
@@ -51,7 +45,7 @@ public class TestRegisterParsing {
} }
[Fact(DisplayName = "Parsing as BRegister (Phyiscal Inputs)")] [Fact(DisplayName = "Parsing as BRegister (Phyiscal Inputs)")]
public void TestParsingBRegisterX () { public void TestParsingBRegisterX() {
var tests = new Dictionary<string, IRegister>() { var tests = new Dictionary<string, IRegister>() {