Skip to content

Commit

Permalink
Update Publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
Mutex666 committed Mar 10, 2024
1 parent eb36511 commit 162b83c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Linq;
using ClassLibraryCommon;
using Newtonsoft.Json;
using NonVisuals.HID;
using NonVisuals.Panels.Saitek.Panels;
using NonVisuals.Tests.Serialization.Common;
using Xunit;

namespace NonVisuals.Tests.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()
};
}
}
}
23 changes: 19 additions & 4 deletions src/PublishReleaseDCSFP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ if (($env:dcsfpReleaseDestinationFolderPath -eq $null) -or (-not (Test-Path $env
}

#---------------------------------
# Tests execution For DCSFP
# Tests execution For DCSFlightpanels
#---------------------------------
Write-Host "Starting tests execution for DCSFP" -foregroundcolor "Green"
$testPath = $scriptPath + "\DCSFP.Tests"
Write-Host "Starting tests execution for DCSFlightpanels" -foregroundcolor "Green"
$testPath = $scriptPath + "\DCSFlightpanels.Tests"
Set-Location -Path $testPath
dotnet test
$testsLastExitCode = $LastExitCode
Expand All @@ -74,7 +74,22 @@ if ( 0 -ne $testsLastExitCode ) {
Write-Host "Fatal error. Some unit tests failed." -foregroundcolor "Red"
exit
}
Write-Host "Finished tests execution for DCSFP" -foregroundcolor "Green"
Write-Host "Finished tests execution for DCSFlightpanels" -foregroundcolor "Green"

#---------------------------------
# Tests execution For DCS-BIOS
#---------------------------------
Write-Host "Starting tests execution for DCS-BIOS" -foregroundcolor "Green"
$testPath = $scriptPath + "\DCS-BIOS.Tests"
Set-Location -Path $testPath
dotnet test
$testsLastExitCode = $LastExitCode
Write-Host "Tests LastExitCode: $testsLastExitCode" -foregroundcolor "Green"
if ( 0 -ne $testsLastExitCode ) {
Write-Host "Fatal error. Some unit tests failed." -foregroundcolor "Red"
exit
}
Write-Host "Finished tests execution for DCS-BIOS" -foregroundcolor "Green"

#---------------------------------
# Tests execution For NonVisuals
Expand Down

0 comments on commit 162b83c

Please sign in to comment.