-
Notifications
You must be signed in to change notification settings - Fork 29
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
6 changed files
with
799 additions
and
0 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
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
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
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
46 changes: 46 additions & 0 deletions
46
src/Tests/Serialization/Panels/SwitchPanelPZ55_SerializeTests.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,46 @@ | ||
using DCSFPTests.Serialization.Common; | ||
using NonVisuals.Panels.Saitek.Panels; | ||
using Xunit; | ||
using Newtonsoft.Json; | ||
using ClassLibraryCommon; | ||
using NonVisuals.HID; | ||
using System.Linq; | ||
|
||
|
||
namespace DCSFPTests.Serialization.Panels { | ||
public class SwitchPanelPZ55_SerializeTests { | ||
[Fact] | ||
public static void SwitchPanelPZ55_ShouldBeSerializable() { | ||
SwitchPanelPZ55 s = GetObject(); | ||
|
||
string serializedObj = JsonConvert.SerializeObject(s, Formatting.Indented, JSonSettings.JsonDefaultSettings); | ||
// SwitchPanelPZ55 d = JsonConvert.DeserializeObject<SwitchPanelPZ55>(serializedObj); | ||
|
||
RepositorySerialized repo = new(); | ||
//Save sample file in project (use it only once) | ||
//repo.SaveSerializedObjectToFile(s.GetType(), serializedObj); | ||
|
||
//SwitchPanelPZ55 deseralizedObjFromFile = JsonConvert.DeserializeObject<SwitchPanelPZ55>(repo.GetSerializedObjectString(s.GetType())); | ||
|
||
// DeepAssert.Equal(s, deseralizedObjFromFile); | ||
// DeepAssert.Equal(d, deseralizedObjFromFile); | ||
} | ||
|
||
public static SwitchPanelPZ55 GetObject(int instanceNbr = 1) { | ||
GamingPanelSkeleton gamingPanelSkeleton = new(GamingPanelVendorEnum.Saitek, GamingPanelEnum.PZ55SwitchPanel); | ||
return new SwitchPanelPZ55(new HIDSkeleton(gamingPanelSkeleton, "FakeHidInstanceForTests")) | ||
{ | ||
ManualLandingGearLEDs = false, | ||
ManualLandingGearLEDsColorDown = BIPLight_SerializeTests.GetPanelLEDColorFromInstance(instanceNbr), | ||
ManualLandingGearLEDsColorUp = BIPLight_SerializeTests.GetPanelLEDColorFromInstance(instanceNbr + 1), | ||
ManualLandingGearLEDsColorTrans = BIPLight_SerializeTests.GetPanelLEDColorFromInstance(instanceNbr + 2), | ||
ManualLandingGearTransTimeSeconds = instanceNbr + 6, | ||
|
||
DCSBiosBindings = DCSBIOSActionBindingPZ55_SerializeTests.GetObjects(), | ||
KeyBindingsHashSet = KeyBindingPZ55_SerializeTests.GetObjects(), | ||
OSCommandList = OSCommandBindingPZ55_SerializeTests.GetObjects().ToList(), | ||
BIPLinkHashSet = BIPLinkPZ55_SerializeTests.GetObjects() | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.