From e0a3d77699a7af890c0ae6123abfa7ab0c99fb73 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Mon, 2 Aug 2021 21:57:52 +0300 Subject: [PATCH] Rename NucuCar.Domain to NucuCar.Core and fix tests. --- .../Http/MinimalHttpClient.cs | 6 +++--- .../Http/MockMinimalHttpClient.cs | 2 +- .../NucuCar.Core.csproj | 1 + NucuCar.Core/Readme.md | 3 +++ .../Utilities/ConnectionStringParser.cs | 2 +- {NucuCar.Domain => NucuCar.Core}/Utilities/Guard.cs | 2 +- NucuCar.Domain/Readme.md | 4 ---- NucuCar.Sensors/NucuCar.Sensors.csproj | 2 +- NucuCar.Telemetry/NucuCar.Telemetry.csproj | 2 +- NucuCar.Telemetry/Publishers/TelemetryPublisherDisk.cs | 2 +- .../Publishers/TelemetryPublisherFirestore.cs | 4 ++-- NucuCar.Telemetry/TelemetryPublisherFactory.cs | 2 +- .../ConnectionStringParserTest.cs | 4 ++-- .../{NucuCar.Domain.Tests => NucuCar.Core}/GuardTest.cs | 4 ++-- .../Bme680}/TestBme680Sensor.cs | 2 +- .../Bme680WorkerTest.cs | 9 +++++---- .../TelemetryPublisherFactoryTest.cs | 2 +- .../TelemetryPublisherFirestoreTest.cs | 5 ++--- NucuCar.UnitTests/NucuCar.UnitTests.csproj | 2 +- NucuCar.sln | 2 +- 20 files changed, 31 insertions(+), 31 deletions(-) rename {NucuCar.Domain => NucuCar.Core}/Http/MinimalHttpClient.cs (99%) rename {NucuCar.Domain => NucuCar.Core}/Http/MockMinimalHttpClient.cs (96%) rename NucuCar.Domain/NucuCar.Domain.csproj => NucuCar.Core/NucuCar.Core.csproj (87%) create mode 100644 NucuCar.Core/Readme.md rename {NucuCar.Domain => NucuCar.Core}/Utilities/ConnectionStringParser.cs (97%) rename {NucuCar.Domain => NucuCar.Core}/Utilities/Guard.cs (97%) delete mode 100644 NucuCar.Domain/Readme.md rename NucuCar.UnitTests/{NucuCar.Domain.Tests => NucuCar.Core}/ConnectionStringParserTest.cs (95%) rename NucuCar.UnitTests/{NucuCar.Domain.Tests => NucuCar.Core}/GuardTest.cs (93%) rename NucuCar.UnitTests/{NucuCar.Sensors.Tests/EnvironmentSensor => NucuCar.Sensors/Bme680}/TestBme680Sensor.cs (90%) rename NucuCar.UnitTests/{NucuCar.Sensors.Tests => NucuCar.Sensors}/Bme680WorkerTest.cs (89%) rename NucuCar.UnitTests/{NucuCar.Domain.Telemetry.Tests => NucuCar.Telemetry}/TelemetryPublisherFactoryTest.cs (96%) rename NucuCar.UnitTests/{NucuCar.Domain.Telemetry.Tests => NucuCar.Telemetry}/TelemetryPublisherFirestoreTest.cs (98%) diff --git a/NucuCar.Domain/Http/MinimalHttpClient.cs b/NucuCar.Core/Http/MinimalHttpClient.cs similarity index 99% rename from NucuCar.Domain/Http/MinimalHttpClient.cs rename to NucuCar.Core/Http/MinimalHttpClient.cs index 78cccd9..f955a59 100644 --- a/NucuCar.Domain/Http/MinimalHttpClient.cs +++ b/NucuCar.Core/Http/MinimalHttpClient.cs @@ -1,14 +1,14 @@ using System; using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using System.Net.Http; -using System.Net.Http.Headers; -namespace NucuCar.Domain.Http +namespace NucuCar.Core.Http { /// /// A simple HttpClient wrapper designed to make it easier to work with web requests with media type application/json. diff --git a/NucuCar.Domain/Http/MockMinimalHttpClient.cs b/NucuCar.Core/Http/MockMinimalHttpClient.cs similarity index 96% rename from NucuCar.Domain/Http/MockMinimalHttpClient.cs rename to NucuCar.Core/Http/MockMinimalHttpClient.cs index 4faa11d..33f3ff5 100644 --- a/NucuCar.Domain/Http/MockMinimalHttpClient.cs +++ b/NucuCar.Core/Http/MockMinimalHttpClient.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; -namespace NucuCar.Domain.Http +namespace NucuCar.Core.Http { public class MockMinimalHttpClient : MinimalHttpClient { diff --git a/NucuCar.Domain/NucuCar.Domain.csproj b/NucuCar.Core/NucuCar.Core.csproj similarity index 87% rename from NucuCar.Domain/NucuCar.Domain.csproj rename to NucuCar.Core/NucuCar.Core.csproj index ae26a9f..d0b58b5 100644 --- a/NucuCar.Domain/NucuCar.Domain.csproj +++ b/NucuCar.Core/NucuCar.Core.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + NucuCar.Core diff --git a/NucuCar.Core/Readme.md b/NucuCar.Core/Readme.md new file mode 100644 index 0000000..d5cf182 --- /dev/null +++ b/NucuCar.Core/Readme.md @@ -0,0 +1,3 @@ +# NucuCar.Core + +Contains core functionality. diff --git a/NucuCar.Domain/Utilities/ConnectionStringParser.cs b/NucuCar.Core/Utilities/ConnectionStringParser.cs similarity index 97% rename from NucuCar.Domain/Utilities/ConnectionStringParser.cs rename to NucuCar.Core/Utilities/ConnectionStringParser.cs index 30d5362..cb0d073 100644 --- a/NucuCar.Domain/Utilities/ConnectionStringParser.cs +++ b/NucuCar.Core/Utilities/ConnectionStringParser.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace NucuCar.Domain.Utilities +namespace NucuCar.Core.Utilities { /// /// ConnectionStringParser is an utility service to parse and validate connection strings. diff --git a/NucuCar.Domain/Utilities/Guard.cs b/NucuCar.Core/Utilities/Guard.cs similarity index 97% rename from NucuCar.Domain/Utilities/Guard.cs rename to NucuCar.Core/Utilities/Guard.cs index 7f7b9c7..7b1e86d 100644 --- a/NucuCar.Domain/Utilities/Guard.cs +++ b/NucuCar.Core/Utilities/Guard.cs @@ -1,6 +1,6 @@ using System; -namespace NucuCar.Domain.Utilities +namespace NucuCar.Core.Utilities { /// /// Helper class used for checking arguments and raise exception if the checks don't pass. diff --git a/NucuCar.Domain/Readme.md b/NucuCar.Domain/Readme.md deleted file mode 100644 index 42b6797..0000000 --- a/NucuCar.Domain/Readme.md +++ /dev/null @@ -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. \ No newline at end of file diff --git a/NucuCar.Sensors/NucuCar.Sensors.csproj b/NucuCar.Sensors/NucuCar.Sensors.csproj index 1d0e2a8..830eba3 100644 --- a/NucuCar.Sensors/NucuCar.Sensors.csproj +++ b/NucuCar.Sensors/NucuCar.Sensors.csproj @@ -77,7 +77,7 @@ - + diff --git a/NucuCar.Telemetry/NucuCar.Telemetry.csproj b/NucuCar.Telemetry/NucuCar.Telemetry.csproj index 7f26de5..1191a5c 100644 --- a/NucuCar.Telemetry/NucuCar.Telemetry.csproj +++ b/NucuCar.Telemetry/NucuCar.Telemetry.csproj @@ -6,7 +6,7 @@ - + diff --git a/NucuCar.Telemetry/Publishers/TelemetryPublisherDisk.cs b/NucuCar.Telemetry/Publishers/TelemetryPublisherDisk.cs index 34220cb..52ddfd7 100644 --- a/NucuCar.Telemetry/Publishers/TelemetryPublisherDisk.cs +++ b/NucuCar.Telemetry/Publishers/TelemetryPublisherDisk.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Newtonsoft.Json; -using NucuCar.Domain.Utilities; +using NucuCar.Core.Utilities; using NucuCar.Telemetry.Abstractions; namespace NucuCar.Telemetry.Publishers diff --git a/NucuCar.Telemetry/Publishers/TelemetryPublisherFirestore.cs b/NucuCar.Telemetry/Publishers/TelemetryPublisherFirestore.cs index 6980789..a4f207a 100644 --- a/NucuCar.Telemetry/Publishers/TelemetryPublisherFirestore.cs +++ b/NucuCar.Telemetry/Publishers/TelemetryPublisherFirestore.cs @@ -5,8 +5,8 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using NucuCar.Domain.Http; -using NucuCar.Domain.Utilities; +using NucuCar.Core.Http; +using NucuCar.Core.Utilities; using NucuCar.Telemetry.Abstractions; namespace NucuCar.Telemetry.Publishers diff --git a/NucuCar.Telemetry/TelemetryPublisherFactory.cs b/NucuCar.Telemetry/TelemetryPublisherFactory.cs index 85fab04..f0b5cb0 100644 --- a/NucuCar.Telemetry/TelemetryPublisherFactory.cs +++ b/NucuCar.Telemetry/TelemetryPublisherFactory.cs @@ -1,6 +1,6 @@ using System; using Microsoft.Extensions.Logging; -using NucuCar.Domain.Utilities; +using NucuCar.Core.Utilities; using NucuCar.Telemetry.Abstractions; using NucuCar.Telemetry.Publishers; diff --git a/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs b/NucuCar.UnitTests/NucuCar.Core/ConnectionStringParserTest.cs similarity index 95% rename from NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs rename to NucuCar.UnitTests/NucuCar.Core/ConnectionStringParserTest.cs index 3e98814..6a7407d 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Tests/ConnectionStringParserTest.cs +++ b/NucuCar.UnitTests/NucuCar.Core/ConnectionStringParserTest.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using NucuCar.Domain.Utilities; +using NucuCar.Core.Utilities; using Xunit; -namespace NucuCar.UnitTests.NucuCar.Domain.Tests +namespace NucuCar.UnitTests.NucuCar.Core { public class ConnectionStringParserTest { diff --git a/NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs b/NucuCar.UnitTests/NucuCar.Core/GuardTest.cs similarity index 93% rename from NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs rename to NucuCar.UnitTests/NucuCar.Core/GuardTest.cs index bc65ad2..4431fbc 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Tests/GuardTest.cs +++ b/NucuCar.UnitTests/NucuCar.Core/GuardTest.cs @@ -1,8 +1,8 @@ using System; -using NucuCar.Domain.Utilities; +using NucuCar.Core.Utilities; using Xunit; -namespace NucuCar.UnitTests.NucuCar.Domain.Tests +namespace NucuCar.UnitTests.NucuCar.Core { public class GuardTest { diff --git a/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs b/NucuCar.UnitTests/NucuCar.Sensors/Bme680/TestBme680Sensor.cs similarity index 90% rename from NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs rename to NucuCar.UnitTests/NucuCar.Sensors/Bme680/TestBme680Sensor.cs index cb1cadf..2f1ad13 100644 --- a/NucuCar.UnitTests/NucuCar.Sensors.Tests/EnvironmentSensor/TestBme680Sensor.cs +++ b/NucuCar.UnitTests/NucuCar.Sensors/Bme680/TestBme680Sensor.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Modules.BME680; -namespace NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor +namespace NucuCar.UnitTests.NucuCar.Sensors.Bme680 { public class TestBme680Sensor : Bme680Sensor { diff --git a/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs b/NucuCar.UnitTests/NucuCar.Sensors/Bme680WorkerTest.cs similarity index 89% rename from NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs rename to NucuCar.UnitTests/NucuCar.Sensors/Bme680WorkerTest.cs index 605a4a2..ed52bb7 100644 --- a/NucuCar.UnitTests/NucuCar.Sensors.Tests/Bme680WorkerTest.cs +++ b/NucuCar.UnitTests/NucuCar.Sensors/Bme680WorkerTest.cs @@ -5,10 +5,11 @@ using Microsoft.Extensions.Options; using Moq; using NucuCar.Sensors.Abstractions; using NucuCar.Sensors.Modules.BME680; -using NucuCar.UnitTests.NucuCar.Sensors.Tests.EnvironmentSensor; +using NucuCar.Telemetry.Abstractions; +using NucuCar.UnitTests.NucuCar.Sensors.Bme680; using Xunit; -namespace NucuCar.UnitTests.NucuCar.Sensors.Tests +namespace NucuCar.UnitTests.NucuCar.Sensors { /// /// 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> _mockLogger; private readonly Mock> _mockOptions; - private readonly Mock _mockSensorTelemetry; + private readonly Mock _mockSensorTelemetry; private readonly Mock _mockTestBme680Sensor; private readonly Mock> _mockBme680ISensor; private readonly CancellationTokenSource _cts; @@ -28,7 +29,7 @@ namespace NucuCar.UnitTests.NucuCar.Sensors.Tests _cts = new CancellationTokenSource(); _mockLogger = new Mock>(); _mockOptions = new Mock>(); - _mockSensorTelemetry = new Mock(); + _mockSensorTelemetry = new Mock(); _mockTestBme680Sensor = new Mock(); _mockBme680ISensor = new Mock>(); diff --git a/NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFactoryTest.cs b/NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFactoryTest.cs similarity index 96% rename from NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFactoryTest.cs rename to NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFactoryTest.cs index 2e9b562..92396e4 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFactoryTest.cs +++ b/NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFactoryTest.cs @@ -3,7 +3,7 @@ using NucuCar.Telemetry; using NucuCar.Telemetry.Publishers; using Xunit; -namespace NucuCar.UnitTests.NucuCar.Domain.Telemetry.Tests +namespace NucuCar.UnitTests.NucuCar.Telemetry { public class TelemetryPublisherFactoryTest { diff --git a/NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFirestoreTest.cs b/NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFirestoreTest.cs similarity index 98% rename from NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFirestoreTest.cs rename to NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFirestoreTest.cs index a832816..97d4d48 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Telemetry.Tests/TelemetryPublisherFirestoreTest.cs +++ b/NucuCar.UnitTests/NucuCar.Telemetry/TelemetryPublisherFirestoreTest.cs @@ -2,15 +2,14 @@ using System; using System.Collections.Generic; using System.Net; using System.Net.Http; -using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using NucuCar.Domain.Http; +using NucuCar.Core.Http; using NucuCar.Telemetry; using NucuCar.Telemetry.Publishers; using Xunit; -namespace NucuCar.UnitTests.NucuCar.Domain.Telemetry.Tests +namespace NucuCar.UnitTests.NucuCar.Telemetry { /// /// Class used to test the TelemetryPublisherFirestore by mocking the GetTelemetry method and HttpClient field. diff --git a/NucuCar.UnitTests/NucuCar.UnitTests.csproj b/NucuCar.UnitTests/NucuCar.UnitTests.csproj index f1d1264..6a8d517 100644 --- a/NucuCar.UnitTests/NucuCar.UnitTests.csproj +++ b/NucuCar.UnitTests/NucuCar.UnitTests.csproj @@ -16,7 +16,7 @@ - + diff --git a/NucuCar.sln b/NucuCar.sln index 69f769c..2ebe406 100644 --- a/NucuCar.sln +++ b/NucuCar.sln @@ -2,7 +2,7 @@ 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}" 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 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NucuCar.UnitTests", "NucuCar.UnitTests\NucuCar.UnitTests.csproj", "{C6F07921-1052-4945-911E-F328A622F229}" EndProject