-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue442Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using ExtendedXmlSerializer.Configuration; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Shared.Issue442; | ||
using ExtendedXmlSerializer.Tests.ReportedIssues.Support; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues | ||
{ | ||
public sealed class Issue442Tests | ||
{ | ||
[Fact] | ||
public void Verify() | ||
{ | ||
const string content = @"<Device fb=""FB_Pneumatic2Pos"" commandStruct=""E_Pneumatic_Cmd""> | ||
<Definition><![CDATA[ ""#InstanceName#""(PlcCycleTime := ""DB_Time"".PlcCycleTime, | ||
OpMode := ""DB_#Station#_Station"".OpMode, | ||
Inactive := FALSE, | ||
I_SensorA := #I_SensorA#, | ||
I_SensorB := #I_SensorB#, | ||
C_TwoCoils := #C_TwoCoils#, | ||
C_ForceVentilate := #C_ForceVentilate#, | ||
C_Clamping := #C_Clamping#, | ||
C_PL := ""E_PL"".#C_PL#, | ||
C_TimeVentilate := T#200ms, | ||
C_TimeoutDuration := T#3s, | ||
C_WaitTimePosA := T#0ms, | ||
C_WaitTimePosB := T#0ms, | ||
Q_ValveA => #Q_ValveA#, | ||
Q_ValveB => #Q_ValveB#, | ||
Q_ValveOpenClamping => #Q_ValveOpenClamping#);]]></Definition> | ||
<DeviceDataDb><![CDATA[]]></DeviceDataDb> | ||
<ServiceHandler><![CDATA[ ""FC_Pneumatic2Pos_Service_3Rows""(DeviceNo := #DeviceNo#, | ||
Row := #Row#, | ||
RowVisible := TRUE, | ||
DeviceName_Textlist := ""E_Service3Row_DeviceNames"".""#DeviceName#"", | ||
ButtonTextPosA_Textlist := ""E_Service_ButtonText"".""#ActionA#"", | ||
ButtonTextPosB_Textlist := ""E_Service_ButtonText"".""#ActionB#"", | ||
I_PosA_2 := #I_SensorA2#, | ||
I_PosB_2 := #I_SensorB2#, | ||
IDB := #InstanceName#, | ||
Btn_DeActivateService := ""DB_#Station#_Station"".Buttons.Service);]]></ServiceHandler> | ||
<ParameterDb><![CDATA[]]></ParameterDb> | ||
<Releases><![CDATA[ ""#InstanceName#"".ReleasePosA := FALSE; | ||
""#InstanceName#"".ReleasePosB := FALSE;]]></Releases> | ||
<CommandStart><![CDATA[]]></CommandStart> | ||
<WatchAndForceTable> | ||
<Capacity>16</Capacity> | ||
<WatchAndForceTableEntry name=""Cmd"" /> | ||
<WatchAndForceTableEntry name=""Execute"" /> | ||
<WatchAndForceTableEntry name=""ExecState"" /> | ||
<WatchAndForceTableEntry name=""ErrorCode"" /> | ||
<WatchAndForceTableEntry name=""_State[1]"" /> | ||
<WatchAndForceTableEntry name=""_StateName"" /> | ||
<WatchAndForceTableEntry name=""I_SensorA"" /> | ||
<WatchAndForceTableEntry name=""I_SensorB"" /> | ||
<WatchAndForceTableEntry name=""_ValveA"" /> | ||
<WatchAndForceTableEntry name=""_ValveB"" /> | ||
<WatchAndForceTableEntry name=""_ValveOpenClamping"" /> | ||
</WatchAndForceTable> | ||
</Device>"; | ||
|
||
var serializer = new ConfigurationContainer().InspectingType<SiemensDeviceTemplate>() | ||
.EnableImplicitTyping(typeof(SiemensDeviceTemplate)) | ||
.Create() | ||
.ForTesting(); | ||
|
||
serializer.Deserialize<SiemensDeviceTemplate>(content) | ||
.WatchAndForceTableEntires.Should() | ||
.NotBeNull() | ||
.And.Subject.Should() | ||
.NotBeEmpty(); | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/Issue442/IDeviceTemplate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared.Issue442 | ||
{ | ||
public interface IDeviceTemplate {} | ||
} |
43 changes: 43 additions & 0 deletions
43
test/ExtendedXmlSerializer.Tests.ReportedIssues/Shared/Issue442/SiemensDeviceTemplate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using ExtendedXmlSerializer.ContentModel.Content; | ||
using System.Collections.Generic; | ||
using System.Xml.Serialization; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared.Issue442 | ||
{ | ||
[XmlRoot("Device", Namespace = "")] | ||
public class SiemensDeviceTemplate : IDeviceTemplate | ||
{ | ||
[XmlAttribute("fb")] | ||
public string FB { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement("Definition")] | ||
public string Definition { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement("DeviceDataDb")] | ||
public string DeviceDataDb { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement("ServiceHandler")] | ||
public string ServiceHandler { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement("ParameterDb")] | ||
public string ParameterDb { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement(ElementName = "Releases")] | ||
public string Releases { get; set; } | ||
|
||
[XmlAttribute("commandStruct")] | ||
public string CommandStruct { get; set; } | ||
|
||
[Verbatim] | ||
[XmlElement("CommandStart")] | ||
public string CommandStart { get; set; } | ||
|
||
[XmlElement("WatchAndForceTable")] | ||
public List<WatchAndForceTableTemplate> WatchAndForceTableEntires { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.../ExtendedXmlSerializer.Tests.ReportedIssues/Shared/Issue442/WatchAndForceTableTemplate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Xml.Serialization; | ||
|
||
namespace ExtendedXmlSerializer.Tests.ReportedIssues.Shared.Issue442 | ||
{ | ||
[XmlRoot("WatchAndForceTableEntry")] | ||
public class WatchAndForceTableTemplate | ||
{ | ||
[XmlAttribute("name")] | ||
public string Name { get; set; } | ||
} | ||
} |