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

View File

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

View File

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

View File

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

View File

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

View File

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