Skip to content

Commit

Permalink
Feature/tuning wizard (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
k3ldar authored Oct 12, 2023
1 parent 0d98109 commit bde10d7
Show file tree
Hide file tree
Showing 150 changed files with 23,234 additions and 952 deletions.
22 changes: 12 additions & 10 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<NoWarn>1701;1702;8032;8981</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>Shared.Key.pfx</AssemblyOriginatorKeyFile>
<Description>GCode Sender and Analyzer</Description>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -30,45 +30,47 @@
</PropertyGroup>

<PropertyGroup>
<PluginVersion>5.4.0</PluginVersion>
<SharedVer>3.10.0</SharedVer>
<SharedWinVer>1.2.0</SharedWinVer>
<PluginVersion>5.5.1</PluginVersion>
<SharedVer>3.10.2</SharedVer>
<SharedWinVer>1.2.1</SharedWinVer>
</PropertyGroup>

<PropertyGroup>
<Version>0.7.0</Version>
<Version>0.9.8.1</Version>
<FileVersion>$(Version)</FileVersion>
<ProductVersion>$(Version)</ProductVersion>
<LangVersion>latest</LangVersion>
<Authors>Simon Carter ([email protected])</Authors>
<Company>Simon Carter</Company>
<Copyright>Copyright (c) 2022 - 2023. Simon Carter. All rights reserved.</Copyright>
<Copyright>Copyright (c) 2022 - 2023 Simon Carter. All rights reserved.</Copyright>
<Description>Advanced GCode Sender, Analyzer and Editor</Description>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Debug|net7.0'">
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE;NET_CORE;NET_6_0;NET_6_X;ISO_WEEK;ATTR_OS;NET_5_ABOVE;NET_6_ABOVE;NET_7_ABOVE;NET_7_0;NET_7_X;WIN_SYSTEM</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>full</DebugType>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net7.0'">
<DefineConstants>CODE_ANALYSIS;NET_CORE;NET_6_0;NET_6_X;ISO_WEEK;ATTR_OS;NET_5_ABOVE;NET_6_ABOVE;NET_7_ABOVE;NET_7_0;NET_7_X;WIN_SYSTEM</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>portable</DebugType>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Debug|net7.0-windows'">
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE;NET_CORE;NET_6_0;NET_6_X;ISO_WEEK;ATTR_OS;NET_5_ABOVE;NET_6_ABOVE;NET_7_ABOVE;NET_7_0;NET_7_X;WIN_SYSTEM</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>full</DebugType>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net7.0-windows'">
<DefineConstants>CODE_ANALYSIS;NET_CORE;NET_6_0;NET_6_X;ISO_WEEK;ATTR_OS;NET_5_ABOVE;NET_6_ABOVE;NET_7_ABOVE;NET_7_0;NET_7_X;WIN_SYSTEM</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>portable</DebugType>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Expand Down
27 changes: 0 additions & 27 deletions Directory.Build.targets

This file was deleted.

2 changes: 1 addition & 1 deletion src/GCATests/GCService/GCodeProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void Start_SetsRunningToTrue_Returns_True()
};

MockComPortFactory mockComPortFactory = new();
MockGSendDataProvider mockDataProvider = new MockGSendDataProvider();
MockGSendDataProvider mockDataProvider = new();


bool startCalled = false;
Expand Down
10 changes: 5 additions & 5 deletions src/GCATests/GCService/PluginInitializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class PluginInitializationTests
[TestCategory(TestsCategory)]
public void ExtendsIPluginAndIInitialiseEvents()
{
PluginInitialization sut = new PluginInitialization();
PluginInitialization sut = new();

Assert.IsInstanceOfType(sut, typeof(IPlugin));
Assert.IsInstanceOfType(sut, typeof(IInitialiseEvents));
Expand All @@ -36,7 +36,7 @@ public void ExtendsIPluginAndIInitialiseEvents()
[TestCategory(TestsCategory)]
public void GetVersion_ReturnsCurrentVersion_Success()
{
PluginInitialization sut = new PluginInitialization();
PluginInitialization sut = new();

Assert.AreEqual((ushort)1, sut.GetVersion());
}
Expand All @@ -45,8 +45,8 @@ public void GetVersion_ReturnsCurrentVersion_Success()
[TestCategory(TestsCategory)]
public void Initialize_DoesNotAddItemsToLogger()
{
PluginInitialization sut = new PluginInitialization();
MockLogger testLogger = new MockLogger();
PluginInitialization sut = new();
MockLogger testLogger = new();

sut.Initialise(testLogger);

Expand All @@ -57,7 +57,7 @@ public void Initialize_DoesNotAddItemsToLogger()
[TestCategory(TestsCategory)]
public void Finalise_DoesNotThrowException()
{
PluginInitialization sut = new PluginInitialization();
PluginInitialization sut = new();
Assert.IsNotNull(sut);

sut.Finalise();
Expand Down
24 changes: 12 additions & 12 deletions src/GCATests/GCService/SubProgramApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Construct_Invalid_ParamNull_Throws_ArgumentNullException()
[TestMethod]
public void Construct_ValidInstance_Success()
{
SubprogramApi sut = new SubprogramApi(new MockSubprograms());
SubprogramApi sut = new(new MockSubprograms());
Assert.IsNotNull(sut);
}

Expand All @@ -45,7 +45,7 @@ public void GetAllSubprogramNames_Success()
subprograms.Subprograms.Add(new SubprogramModel("test3", "desc 3", "asfdasdf"));
subprograms.Subprograms.Add(new SubprogramModel("test4", "desc 4", "asfdasdf"));
subprograms.Subprograms.Add(new SubprogramModel("test5", "desc 5", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.GetAllSubprograms() as ActionResult;
Assert.IsNotNull(result);
Expand Down Expand Up @@ -75,7 +75,7 @@ public void GetAllSubprogramNames_Success()
public void SubprogramExists_NullName_DoesNotExist_ReturnsFalse()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists(null) as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -94,7 +94,7 @@ public void SubprogramExists_NullName_DoesNotExist_ReturnsFalse()
public void SubprogramExists_ValidName_DoesNotExist_ReturnsFalse()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -114,7 +114,7 @@ public void SubprogramExists_ValidName_Exists_ReturnsTrue()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -133,7 +133,7 @@ public void SubprogramExists_ValidName_Exists_ReturnsTrue()
public void SubSubprogramDelete_SubProgramNotfound_Returns_False()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramDelete("O500") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -153,7 +153,7 @@ public void SubSubprogramDelete_SubProgramFound_Returns_True()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramDelete("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -172,7 +172,7 @@ public void SubSubprogramDelete_SubProgramFound_Returns_True()
public void SubprogramGet_SubProgramNotFound_Returns_False()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramGet("O500") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -192,7 +192,7 @@ public void SubprogramGet_SubProgramNotFound_Returns_True()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramGet("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -217,7 +217,7 @@ public void SubprogramUpdate_InvalidModel_Returns_False()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramUpdate(null) as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -235,10 +235,10 @@ public void SubprogramUpdate_InvalidModel_Returns_False()
[TestMethod]
public void SubprogramUpdate_UpdatesFromModel_Returns_False()
{
SubprogramModel subprogram = new SubprogramModel("O5000", "desc 1", "asfdasdf");
SubprogramModel subprogram = new("O5000", "desc 1", "asfdasdf");
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(subprogram);
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramUpdate(new SubprogramModel("O5000", "new desc", "new content")) as ActionResult;
Assert.IsNotNull(result);
Expand Down
2 changes: 1 addition & 1 deletion src/GCATests/GSendAnalyzerTests/GCodeCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class GCodeCommandTests
[TestCategory(TestCategoryAnalyser)]
public void Construct_InvalidInstance_CodeIsNotInRange_Throws()
{
GCodeCommand sut = new GCodeCommand(2, '#', 0, "0", String.Empty, null, new CurrentCommandValues(), 1, null);
GCodeCommand sut = new(2, '#', 0, "0", String.Empty, null, new CurrentCommandValues(), 1, null);
Assert.IsFalse(sut.IsValidGCode);
}

Expand Down
8 changes: 5 additions & 3 deletions src/GCATests/GSendApi/JobExecutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ public class JobExecutionTests
[TestMethod]
public void CreateJobExecution_FailToCreateDBRecord_Returns_JsonErrorResponse()
{
MockGSendDataProvider gSendDataProvider = new MockGSendDataProvider(new string[] { "ProverXL", "3018" });
gSendDataProvider.CreateFalseResponseWhenCalled = true;
MockGSendDataProvider gSendDataProvider = new(new string[] { "ProverXL", "3018" })
{
CreateFalseResponseWhenCalled = true
};
JobExecutionApi sut = new(gSendDataProvider, new MockNotification());

ActionResult Result = sut.CreateJobExecution(1, 2, 3) as ActionResult;
Expand All @@ -43,7 +45,7 @@ public void CreateJobExecution_FailToCreateDBRecord_Returns_JsonErrorResponse()
[TestMethod]
public void CreateJobExecution_DBRecordCreated_Returns_JsonSuccess()
{
MockGSendDataProvider gSendDataProvider = new MockGSendDataProvider(new string[] { "ProverXL", "3018" });
MockGSendDataProvider gSendDataProvider = new(new string[] { "ProverXL", "3018" });
JobExecutionApi sut = new(gSendDataProvider, new MockNotification());

ActionResult Result = sut.CreateJobExecution(1, 2, 3) as ActionResult;
Expand Down
24 changes: 12 additions & 12 deletions src/GCATests/GSendApi/SubProgramApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public class SubProgramApiTests
[ExpectedException(typeof(ArgumentNullException))]
public void Construct_Invalid_ParamNull_Throws_ArgumentNullException()
{
SubprogramApi sut = new SubprogramApi(null);
SubprogramApi sut = new(null);
Assert.IsNotNull(sut);
}

[TestMethod]
public void Construct_ValidInstance_Success()
{
SubprogramApi sut = new SubprogramApi(new MockSubprograms());
SubprogramApi sut = new(new MockSubprograms());
Assert.IsNotNull(sut);
}

Expand All @@ -46,7 +46,7 @@ public void GetAllSubprogramNames_Success()
subprograms.Subprograms.Add(new SubprogramModel("test3", "desc 3", "asfdasdf"));
subprograms.Subprograms.Add(new SubprogramModel("test4", "desc 4", "asfdasdf"));
subprograms.Subprograms.Add(new SubprogramModel("test5", "desc 5", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.GetAllSubprograms() as ActionResult;
Assert.IsNotNull(result);
Expand Down Expand Up @@ -76,7 +76,7 @@ public void GetAllSubprogramNames_Success()
public void SubprogramExists_NullName_DoesNotExist_ReturnsFalse()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists(null) as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -95,7 +95,7 @@ public void SubprogramExists_NullName_DoesNotExist_ReturnsFalse()
public void SubprogramExists_ValidName_DoesNotExist_ReturnsFalse()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -115,7 +115,7 @@ public void SubprogramExists_ValidName_Exists_ReturnsTrue()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramExists("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -134,7 +134,7 @@ public void SubprogramExists_ValidName_Exists_ReturnsTrue()
public void SubSubprogramDelete_SubProgramNotfound_Returns_False()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramDelete("O500") as ActionResult;
Assert.IsNotNull(result);
Expand Down Expand Up @@ -173,7 +173,7 @@ public void SubSubprogramDelete_SubProgramFound_Returns_True()
public void SubprogramGet_SubProgramNotFound_Returns_False()
{
MockSubprograms subprograms = new();
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramGet("O500") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -193,7 +193,7 @@ public void SubprogramGet_SubProgramNotFound_Returns_True()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramGet("O5000") as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -218,7 +218,7 @@ public void SubprogramUpdate_InvalidModel_Returns_False()
{
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(new SubprogramModel("O5000", "desc 1", "asfdasdf"));
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramUpdate(null) as ActionResult;
Assert.IsNotNull(result);
Expand All @@ -236,10 +236,10 @@ public void SubprogramUpdate_InvalidModel_Returns_False()
[TestMethod]
public void SubprogramUpdate_UpdatesFromModel_Returns_False()
{
SubprogramModel subprogram = new SubprogramModel("O5000", "desc 1", "asfdasdf");
SubprogramModel subprogram = new("O5000", "desc 1", "asfdasdf");
MockSubprograms subprograms = new();
subprograms.Subprograms.Add(subprogram);
SubprogramApi sut = new SubprogramApi(subprograms);
SubprogramApi sut = new(subprograms);

ActionResult result = sut.SubprogramUpdate(new SubprogramModel("O5000", "new desc", "new content")) as ActionResult;
Assert.IsNotNull(result);
Expand Down
3 changes: 3 additions & 0 deletions src/GCATests/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
[assembly: SuppressMessage("Minor Code Smell", "S3878:Arrays should not be created for params parameters", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.MCodeOverrideTests.M620Tests.Process_M620UnableToOpenComPort_Throws_FileNotFoundException")]
[assembly: SuppressMessage("Minor Code Smell", "S3878:Arrays should not be created for params parameters", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.MCodeOverrideTests.M620Tests.Process_M620OpenComPort_PreventsSendingOfCommand_ReturnsTrue")]
[assembly: SuppressMessage("Major Code Smell", "S125:Sections of code should not be commented out", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.GCService.ProcessorMediatorTests.ExecuteAsync_StartsAllMachines_Success")]
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.Mocks.MockComPortFactory.GetComPort(System.String)~GSendShared.IComPort")]
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.Mocks.MockComPortFactory.CreateComPort(GSendShared.Abstractions.IComPortModel)~GSendShared.IComPort")]
[assembly: SuppressMessage("Style", "IDE0063:Use simple 'using' statement", Justification = "<Pending>", Scope = "member", Target = "~M:GSendTests.Mocks.MockComPortFactory.DeleteComPort(GSendShared.IComPort)")]
Loading

0 comments on commit bde10d7

Please sign in to comment.