Rename NucuCar.Domain to NucuCar.Core and fix tests.
This commit is contained in:
parent
23cf373272
commit
e0a3d77699
20 changed files with 31 additions and 31 deletions
|
@ -1,14 +1,14 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
|
|
||||||
namespace NucuCar.Domain.Http
|
namespace NucuCar.Core.Http
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple HttpClient wrapper designed to make it easier to work with web requests with media type application/json.
|
/// A simple HttpClient wrapper designed to make it easier to work with web requests with media type application/json.
|
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NucuCar.Domain.Http
|
namespace NucuCar.Core.Http
|
||||||
{
|
{
|
||||||
public class MockMinimalHttpClient : MinimalHttpClient
|
public class MockMinimalHttpClient : MinimalHttpClient
|
||||||
{
|
{
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<RootNamespace>NucuCar.Core</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
3
NucuCar.Core/Readme.md
Normal file
3
NucuCar.Core/Readme.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# NucuCar.Core
|
||||||
|
|
||||||
|
Contains core functionality.
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace NucuCar.Domain.Utilities
|
namespace NucuCar.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ConnectionStringParser is an utility service to parse and validate connection strings.
|
/// ConnectionStringParser is an utility service to parse and validate connection strings.
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace NucuCar.Domain.Utilities
|
namespace NucuCar.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper class used for checking arguments and raise exception if the checks don't pass.
|
/// Helper class used for checking arguments and raise exception if the checks don't pass.
|
|
@ -1,4 +0,0 @@
|
||||||
# Protos
|
|
||||||
|
|
||||||
The files from Protos are compiled by the gRPC compiler and provide data
|
|
||||||
structures that are shared across the project.
|
|
|
@ -77,7 +77,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
<ProjectReference Include="..\NucuCar.Core\NucuCar.Core.csproj" />
|
||||||
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
<ProjectReference Include="..\NucuCar.Core\NucuCar.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NucuCar.Domain.Utilities;
|
using NucuCar.Core.Utilities;
|
||||||
using NucuCar.Telemetry.Abstractions;
|
using NucuCar.Telemetry.Abstractions;
|
||||||
|
|
||||||
namespace NucuCar.Telemetry.Publishers
|
namespace NucuCar.Telemetry.Publishers
|
||||||
|
|
|
@ -5,8 +5,8 @@ using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NucuCar.Domain.Http;
|
using NucuCar.Core.Http;
|
||||||
using NucuCar.Domain.Utilities;
|
using NucuCar.Core.Utilities;
|
||||||
using NucuCar.Telemetry.Abstractions;
|
using NucuCar.Telemetry.Abstractions;
|
||||||
|
|
||||||
namespace NucuCar.Telemetry.Publishers
|
namespace NucuCar.Telemetry.Publishers
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NucuCar.Domain.Utilities;
|
using NucuCar.Core.Utilities;
|
||||||
using NucuCar.Telemetry.Abstractions;
|
using NucuCar.Telemetry.Abstractions;
|
||||||
using NucuCar.Telemetry.Publishers;
|
using NucuCar.Telemetry.Publishers;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NucuCar.Domain.Utilities;
|
using NucuCar.Core.Utilities;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Domain.Tests
|
namespace NucuCar.UnitTests.NucuCar.Core
|
||||||
{
|
{
|
||||||
public class ConnectionStringParserTest
|
public class ConnectionStringParserTest
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using NucuCar.Domain.Utilities;
|
using NucuCar.Core.Utilities;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Domain.Tests
|
namespace NucuCar.UnitTests.NucuCar.Core
|
||||||
{
|
{
|
||||||
public class GuardTest
|
public class GuardTest
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@ using System.Threading.Tasks;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Modules.BME680;
|
using NucuCar.Sensors.Modules.BME680;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor
|
namespace NucuCar.UnitTests.NucuCar.Sensors.Bme680
|
||||||
{
|
{
|
||||||
public class TestBme680Sensor : Bme680Sensor
|
public class TestBme680Sensor : Bme680Sensor
|
||||||
{
|
{
|
|
@ -5,10 +5,11 @@ using Microsoft.Extensions.Options;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NucuCar.Sensors.Abstractions;
|
using NucuCar.Sensors.Abstractions;
|
||||||
using NucuCar.Sensors.Modules.BME680;
|
using NucuCar.Sensors.Modules.BME680;
|
||||||
using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor;
|
using NucuCar.Telemetry.Abstractions;
|
||||||
|
using NucuCar.UnitTests.NucuCar.Sensors.Bme680;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Sensors.Tests
|
namespace NucuCar.UnitTests.NucuCar.Sensors
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests the functionality of the SensorWorker; Since the class is quite generic the test uses the
|
/// Tests the functionality of the SensorWorker; Since the class is quite generic the test uses the
|
||||||
|
@ -18,7 +19,7 @@ namespace NucuCar.UnitTests.NucuCar.Sensors.Tests
|
||||||
{
|
{
|
||||||
private readonly Mock<ILogger<Bme680Worker>> _mockLogger;
|
private readonly Mock<ILogger<Bme680Worker>> _mockLogger;
|
||||||
private readonly Mock<IOptions<Bme680Config>> _mockOptions;
|
private readonly Mock<IOptions<Bme680Config>> _mockOptions;
|
||||||
private readonly Mock<global::NucuCar.Telemetry.TelemetryPublisherProxy> _mockSensorTelemetry;
|
private readonly Mock<ITelemetryPublisher> _mockSensorTelemetry;
|
||||||
private readonly Mock<TestBme680Sensor> _mockTestBme680Sensor;
|
private readonly Mock<TestBme680Sensor> _mockTestBme680Sensor;
|
||||||
private readonly Mock<ISensor<Bme680Sensor>> _mockBme680ISensor;
|
private readonly Mock<ISensor<Bme680Sensor>> _mockBme680ISensor;
|
||||||
private readonly CancellationTokenSource _cts;
|
private readonly CancellationTokenSource _cts;
|
||||||
|
@ -28,7 +29,7 @@ namespace NucuCar.UnitTests.NucuCar.Sensors.Tests
|
||||||
_cts = new CancellationTokenSource();
|
_cts = new CancellationTokenSource();
|
||||||
_mockLogger = new Mock<ILogger<Bme680Worker>>();
|
_mockLogger = new Mock<ILogger<Bme680Worker>>();
|
||||||
_mockOptions = new Mock<IOptions<Bme680Config>>();
|
_mockOptions = new Mock<IOptions<Bme680Config>>();
|
||||||
_mockSensorTelemetry = new Mock<global::NucuCar.Telemetry.TelemetryPublisherProxy>();
|
_mockSensorTelemetry = new Mock<ITelemetryPublisher>();
|
||||||
_mockTestBme680Sensor = new Mock<TestBme680Sensor>();
|
_mockTestBme680Sensor = new Mock<TestBme680Sensor>();
|
||||||
_mockBme680ISensor = new Mock<ISensor<Bme680Sensor>>();
|
_mockBme680ISensor = new Mock<ISensor<Bme680Sensor>>();
|
||||||
|
|
|
@ -3,7 +3,7 @@ using NucuCar.Telemetry;
|
||||||
using NucuCar.Telemetry.Publishers;
|
using NucuCar.Telemetry.Publishers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Domain.Telemetry.Tests
|
namespace NucuCar.UnitTests.NucuCar.Telemetry
|
||||||
{
|
{
|
||||||
public class TelemetryPublisherFactoryTest
|
public class TelemetryPublisherFactoryTest
|
||||||
{
|
{
|
|
@ -2,15 +2,14 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NucuCar.Domain.Http;
|
using NucuCar.Core.Http;
|
||||||
using NucuCar.Telemetry;
|
using NucuCar.Telemetry;
|
||||||
using NucuCar.Telemetry.Publishers;
|
using NucuCar.Telemetry.Publishers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NucuCar.UnitTests.NucuCar.Domain.Telemetry.Tests
|
namespace NucuCar.UnitTests.NucuCar.Telemetry
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class used to test the TelemetryPublisherFirestore by mocking the GetTelemetry method and HttpClient field.
|
/// Class used to test the TelemetryPublisherFirestore by mocking the GetTelemetry method and HttpClient field.
|
|
@ -16,7 +16,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NucuCar.Domain\NucuCar.Domain.csproj" />
|
<ProjectReference Include="..\NucuCar.Core\NucuCar.Core.csproj" />
|
||||||
<ProjectReference Include="..\NucuCar.Sensors\NucuCar.Sensors.csproj" />
|
<ProjectReference Include="..\NucuCar.Sensors\NucuCar.Sensors.csproj" />
|
||||||
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
<ProjectReference Include="..\NucuCar.Telemetry\NucuCar.Telemetry.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Sensors", "NucuCar.Sensors\NucuCar.Sensors.csproj", "{94C44683-F5AF-4D7D-83AE-1F94A81E1E91}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Sensors", "NucuCar.Sensors\NucuCar.Sensors.csproj", "{94C44683-F5AF-4D7D-83AE-1F94A81E1E91}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Domain", "NucuCar.Domain\NucuCar.Domain.csproj", "{36BDA186-4C90-43C6-8991-A16DE245F91A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.Core", "NucuCar.Core\NucuCar.Core.csproj", "{36BDA186-4C90-43C6-8991-A16DE245F91A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.UnitTests", "NucuCar.UnitTests\NucuCar.UnitTests.csproj", "{C6F07921-1052-4945-911E-F328A622F229}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.UnitTests", "NucuCar.UnitTests\NucuCar.UnitTests.csproj", "{C6F07921-1052-4945-911E-F328A622F229}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|
Loading…
Reference in a new issue