-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(TeslaFleetApiService): extract HandleUnsignedCommands method
- Loading branch information
Showing
3 changed files
with
43 additions
and
23 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
TeslaSolarCharger.Tests/Services/Server/TeslaFleetApiService.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,19 @@ | ||
using Newtonsoft.Json; | ||
using System.Threading.Tasks; | ||
using TeslaSolarCharger.Server.Dtos.TeslaFleetApi; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace TeslaSolarCharger.Tests.Services.Server; | ||
|
||
public class TeslaFleetApiService(ITestOutputHelper outputHelper) : TestBase(outputHelper) | ||
{ | ||
[Fact] | ||
public async Task CanHandleUnsignedCommands() | ||
{ | ||
var commandResult = JsonConvert.DeserializeObject<DtoGenericTeslaResponse<DtoVehicleCommandResult>>("{\"response\":{\"result\":false,\"reason\":\"unsigned_cmds_hardlocked\"}}"); | ||
Assert.NotNull(commandResult?.Response); | ||
var fleetApiService = Mock.Create<TeslaSolarCharger.Server.Services.TeslaFleetApiService>(); | ||
await fleetApiService.HandleUnsignedCommands(commandResult.Response).ConfigureAwait(false); | ||
} | ||
} |
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