-
-
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.
Merge pull request #285 from pkuehnel/feat/solarValuesOverMqtt
feat/solarValuesOverMqtt
- Loading branch information
Showing
20 changed files
with
421 additions
and
63 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
38 changes: 38 additions & 0 deletions
38
TeslaSolarCharger.Tests/Services/Server/SolarMqttService.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,38 @@ | ||
using TeslaSolarCharger.Shared.Contracts; | ||
using TeslaSolarCharger.Shared.Dtos.Contracts; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace TeslaSolarCharger.Tests.Services.Server; | ||
|
||
public class SolarMqttService : TestBase | ||
{ | ||
public SolarMqttService(ITestOutputHelper outputHelper) | ||
: base(outputHelper) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public void Can_Extract_MqttServer() | ||
{ | ||
var insertedValue = "192.168.1.50"; | ||
Mock.Mock<IConfigurationWrapper>().Setup(s => s.SolarMqttServer()).Returns(insertedValue); | ||
|
||
var solarMqttService = Mock.Create<TeslaSolarCharger.Server.Services.SolarMqttService>(); | ||
var mqttServer = solarMqttService.GetMqttServerAndPort(out var mqttServerPort); | ||
Assert.Equal(insertedValue, mqttServer); | ||
Assert.Null(mqttServerPort); | ||
} | ||
|
||
[Fact] | ||
public void Can_Extract_MqttServerAndPort() | ||
{ | ||
var insertedValue = "192.168.1.50:1883"; | ||
Mock.Mock<IConfigurationWrapper>().Setup(s => s.SolarMqttServer()).Returns(insertedValue); | ||
|
||
var solarMqttService = Mock.Create<TeslaSolarCharger.Server.Services.SolarMqttService>(); | ||
var mqttServer = solarMqttService.GetMqttServerAndPort(out var mqttServerPort); | ||
Assert.Equal("192.168.1.50", mqttServer); | ||
Assert.Equal(mqttServerPort, 1883); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace TeslaSolarCharger.Server.Contracts; | ||
|
||
public interface ISolarMqttService | ||
{ | ||
Task ConnectMqttClient(); | ||
} |
4 changes: 2 additions & 2 deletions
4
...rCharger/Server/Contracts/IMqttService.cs → ...Server/Contracts/ITeslaMateMqttService.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
namespace TeslaSolarCharger.Server.Contracts; | ||
|
||
public interface IMqttService | ||
public interface ITeslaMateMqttService | ||
{ | ||
Task ConnectMqttClient(); | ||
bool IsMqttClientConnected { get; } | ||
} | ||
} |
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
Oops, something went wrong.