Skip to content

Commit

Permalink
Added controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tnunnink committed Apr 23, 2024
1 parent e97f4fc commit 37c5dec
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 65 deletions.
65 changes: 12 additions & 53 deletions src/.idea/.idea.L5Sharp/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions src/L5Sharp.Core/Components/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public class Controller : LogixComponent
public Controller() : base(L5XName.Controller)
{
Use = Use.Context;
Revision = new Revision();
ProjectCreationDate = DateTime.Now;
LastModifiedDate = DateTime.Now;
}

/// <summary>
Expand Down Expand Up @@ -92,7 +95,7 @@ public string? TimeSlice
/// </summary>
public bool? ShareUnusedTimeSlice
{
get => GetValue<bool>();
get => GetValue<bool?>();
set => SetValue(value);
}

Expand Down Expand Up @@ -225,7 +228,7 @@ public string? ProjectSN
/// </summary>
public bool? MatchProjectToController
{
get => GetValue<string?>() is not null ? GetValue<string?>() == "Yes" : default;
get => GetValue<string>() is not null ? GetValue<string>() == "Yes" : null;
set => SetValue(value is true ? "Yes" : "No");
}

Expand All @@ -234,7 +237,7 @@ public bool? MatchProjectToController
/// </summary>
public bool? InhibitAutomaticFirmwareUpdate
{
get => GetValue<int?>() is not null ? GetValue<int?>() == 1 : default;
get => GetValue<int?>() is not null ? GetValue<int?>() == 1 : null;
set => SetValue(value is true ? 1 : 0);
}

Expand Down Expand Up @@ -271,7 +274,7 @@ public string? ControllerLanguage
/// </summary>
public bool? CanUseRPIFromProducer
{
get => GetValue<bool>();
get => GetValue<bool?>();
set => SetValue(value);
}

Expand All @@ -290,7 +293,7 @@ public PassThroughOption? PassThroughConfiguration
/// </summary>
public bool? DownloadProjectDocumentationAndExtendedProperties
{
get => GetValue<bool>();
get => GetValue<bool?>();
set => SetValue(value);
}

Expand All @@ -305,7 +308,7 @@ public bool? DownloadProjectDocumentationAndExtendedProperties
/// </remarks>
public bool? DownloadCustomProperties
{
get => GetValue<bool>();
get => GetValue<bool?>();
set => SetValue(value);
}

Expand All @@ -316,7 +319,7 @@ public bool? DownloadCustomProperties
/// </summary>
public string? EtherNetIPMode
{
get => GetValue<string>();
get => GetValue<string?>();
set => SetValue(value);
}

Expand Down
2 changes: 1 addition & 1 deletion src/L5Sharp.Core/Data/AtomicData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private IEnumerable<Member> GenerateBitMembers()
for (var i = 0; i < bits.Length; i++)
{
var index = i;
yield return new Member(index.ToString(), () => bits[index],
yield return new Member(index.ToString(), () => bits[index],
_ => throw new NotSupportedException("Can do this."));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Controller Name="Test" Use="Context" MajorRev="33" MinorRev="12" ProcessorType="TestProcessorType" TimeSlice="TestTimeSlice" ShareUnusedTimeSlice="true" PowerLossProgram="TestPowerLossProgram" MajorFaultProgram="TestMajorFaultProgram" CommPath="TestCommPath" CommDriver="TestCommDriver" SFCExecutionControl="CurrentActive" SFCRestartPosition="MostRecent" SFCLastScan="AutomaticReset" ProjectSN="TestProjectSN" MatchProjectToController="Yes" InhibitAutomaticFirmwareUpdate="1" CurrentProjectLanguage="TestCurrentProjectLanguage" DefaultProjectLanguage="TestDefaultProjectLanguage" ControllerLanguage="TestControllerLanguage" CanUseRPIFromProducer="true" PassThroughConfiguration="Disabled" DownloadProjectDocumentationAndExtendedProperties="true">
<Description>This is a test</Description>
<RedundancyInfo Enabled="true" DataTablePadPercentage="50" IOMemoryPadPercentage="50" KeepTestEditsOnSwitchOver="true" />
<Security SecurityAuthorityID="TestSecurityAuthorityID" />
<SafetyInfo SafetyLocked="true" SafetySignature="Test SafetSignature">
<SafetyTagMap>TestTag,TestTag</SafetyTagMap>
</SafetyInfo>
</Controller>
Loading

0 comments on commit 37c5dec

Please sign in to comment.