diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..813eb6e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "nuget" + directory: "/src/PVOutput.Net/" + schedule: + interval: "daily" + + - package-ecosystem: "nuget" + directory: "/tests/PVOutput.Net.Tests/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c464d70..8f306ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Updated + +- Updated `Microsoft.Extensions.DependencyInjection.Abstractions` from `v3.1.7` to `v5.0.0` [#52](https://github.com/pyrocumulus/pvoutput.net/pull/52) +- Updated `Microsoft.Extensions.Logging.Abstractions` from `v3.1.7` to `v5.0.0` [#52](https://github.com/pyrocumulus/pvoutput.net/pull/52) +- Migrated analyzers `Microsoft.CodeAnalysis.FxCopAnalyzers` to `Microsoft.CodeAnalysis.NetAnalyzers` `v5.0.3` [#52](https://github.com/pyrocumulus/pvoutput.net/pull/52) + ### Fixed - **BREAKING**: Some methods will now return an `Orientation` enumeration value instead of a string representation [#49](https://github.com/pyrocumulus/pvoutput.net/pull/49) - **BREAKING**: Some methods will now return a `Shade` enumeration value instead of a string representation [#50](https://github.com/pyrocumulus/pvoutput.net/pull/50) - **BREAKING**: Marked `InstallDate` and `ArrayTilt` aspects as nullable, as they are optional in PVOutput [#50](https://github.com/pyrocumulus/pvoutput.net/pull/50) +- Marked assembly as `[CLSCompliant]` [#52](https://github.com/pyrocumulus/pvoutput.net/pull/52) ## [0.8.1] - 2020-11-07 diff --git a/src/PVOutput.Net/AssemblyInfo.cs b/src/PVOutput.Net/AssemblyInfo.cs new file mode 100644 index 0000000..b39a914 --- /dev/null +++ b/src/PVOutput.Net/AssemblyInfo.cs @@ -0,0 +1,13 @@ +using System; + +[assembly: CLSCompliant(true)] +namespace PVOutput.Net +{ + internal class AssemblyInfo + { + public AssemblyInfo() + { + + } + } +} diff --git a/src/PVOutput.Net/Objects/Core/FormatHelper.cs b/src/PVOutput.Net/Objects/Core/FormatHelper.cs index 20bca54..583556c 100644 --- a/src/PVOutput.Net/Objects/Core/FormatHelper.cs +++ b/src/PVOutput.Net/Objects/Core/FormatHelper.cs @@ -81,7 +81,7 @@ internal static string GetEnumerationDescription(this TEnumType enume throw new ArgumentException("EnumerationValue must be of Enum type", nameof(enumerationValue)); } - string name = Enum.GetName(type, enumerationValue); + var name = Enum.GetName(type, enumerationValue); if (name != null) { FieldInfo field = type.GetField(name); @@ -98,7 +98,7 @@ internal static string GetEnumerationDescription(this TEnumType enume public static TEnumType DescriptionToEnumValue(this string enumerationDescription) where TEnumType : struct { - var type = typeof(TEnumType); + Type type = typeof(TEnumType); if (!type.IsEnum) { diff --git a/src/PVOutput.Net/Objects/ExtendedDataConfiguration.cs b/src/PVOutput.Net/Objects/ExtendedDataConfiguration.cs index 8b3d1d6..babdbfb 100644 --- a/src/PVOutput.Net/Objects/ExtendedDataConfiguration.cs +++ b/src/PVOutput.Net/Objects/ExtendedDataConfiguration.cs @@ -23,9 +23,9 @@ internal ExtendedDataConfiguration(string label, string unit) /// /// Indicates if the current object is equal to another object of the same type /// - /// Other object to compare to + /// Other object to compare to /// True if both objects are equal, false otherwise - public override bool Equals(object other) => other is ExtendedDataConfiguration element && Equals(element); + public override bool Equals(object obj) => obj is ExtendedDataConfiguration element && Equals(element); /// /// Indicates if the current object is equal to another object of the same type diff --git a/src/PVOutput.Net/Objects/Factories/StringFactoryContainer.cs b/src/PVOutput.Net/Objects/Factories/StringFactoryContainer.cs index bd2b64a..f5d3598 100644 --- a/src/PVOutput.Net/Objects/Factories/StringFactoryContainer.cs +++ b/src/PVOutput.Net/Objects/Factories/StringFactoryContainer.cs @@ -7,37 +7,37 @@ namespace PVOutput.Net.Objects.Factories { internal static class StringFactoryContainer { - private static readonly Dictionary _readerFactories = new Dictionary(); + private static Dictionary ReaderFactories { get; } = new Dictionary(); static StringFactoryContainer() { - _readerFactories.Add(typeof(IOutput), new OutputFactory()); - _readerFactories.Add(typeof(ITeamOutput), new TeamOutputFactory()); - _readerFactories.Add(typeof(IAggregatedOutput), new AggregatedOutputFactory()); - _readerFactories.Add(typeof(ISystem), new SystemFactory()); - _readerFactories.Add(typeof(IStatus), new StatusFactory()); - _readerFactories.Add(typeof(IStatusHistory), new StatusHistoryFactory()); - _readerFactories.Add(typeof(IDayStatistics), new DayStatisticsFactory()); - _readerFactories.Add(typeof(IBatchStatusPostResult), new BatchStatusPostResultFactory()); - _readerFactories.Add(typeof(IStatistic), new StatisticFactory()); - _readerFactories.Add(typeof(IMissing), new MissingFactory()); - _readerFactories.Add(typeof(ITeam), new TeamFactory()); - _readerFactories.Add(typeof(IExtended), new ExtendedFactory()); - _readerFactories.Add(typeof(IFavourite), new FavouriteFactory()); - _readerFactories.Add(typeof(IInsolation), new InsolationFactory()); - _readerFactories.Add(typeof(ISupply), new SupplyFactory()); - _readerFactories.Add(typeof(ISystemSearchResult), new SystemSearchResultFactory()); + ReaderFactories.Add(typeof(IOutput), new OutputFactory()); + ReaderFactories.Add(typeof(ITeamOutput), new TeamOutputFactory()); + ReaderFactories.Add(typeof(IAggregatedOutput), new AggregatedOutputFactory()); + ReaderFactories.Add(typeof(ISystem), new SystemFactory()); + ReaderFactories.Add(typeof(IStatus), new StatusFactory()); + ReaderFactories.Add(typeof(IStatusHistory), new StatusHistoryFactory()); + ReaderFactories.Add(typeof(IDayStatistics), new DayStatisticsFactory()); + ReaderFactories.Add(typeof(IBatchStatusPostResult), new BatchStatusPostResultFactory()); + ReaderFactories.Add(typeof(IStatistic), new StatisticFactory()); + ReaderFactories.Add(typeof(IMissing), new MissingFactory()); + ReaderFactories.Add(typeof(ITeam), new TeamFactory()); + ReaderFactories.Add(typeof(IExtended), new ExtendedFactory()); + ReaderFactories.Add(typeof(IFavourite), new FavouriteFactory()); + ReaderFactories.Add(typeof(IInsolation), new InsolationFactory()); + ReaderFactories.Add(typeof(ISupply), new SupplyFactory()); + ReaderFactories.Add(typeof(ISystemSearchResult), new SystemSearchResultFactory()); } private static object GetObjectStringFactory() { Type type = typeof(TReturnType); - if (!_readerFactories.ContainsKey(type)) + if (!ReaderFactories.ContainsKey(type)) { throw new InvalidOperationException($"Factory for {type} is not known"); } - return _readerFactories[type]; + return ReaderFactories[type]; } public static IObjectStringReader CreateObjectReader() diff --git a/src/PVOutput.Net/Objects/PVCoordinate.cs b/src/PVOutput.Net/Objects/PVCoordinate.cs index c25d1b1..e64d7b9 100644 --- a/src/PVOutput.Net/Objects/PVCoordinate.cs +++ b/src/PVOutput.Net/Objects/PVCoordinate.cs @@ -43,9 +43,9 @@ public override string ToString() /// /// Indicates if the current object is equal to another object of the same type /// - /// Other object to compare to + /// Other object to compare to /// True if both objects are equal, false otherwise - public override bool Equals(object other) => other is PVCoordinate coordinate && Equals(coordinate); + public override bool Equals(object obj) => obj is PVCoordinate coordinate && Equals(coordinate); /// /// Indicates if the current object is equal to another object of the same type diff --git a/src/PVOutput.Net/PVOutput.Net.csproj b/src/PVOutput.Net/PVOutput.Net.csproj index 55f1770..8b7cff1 100644 --- a/src/PVOutput.Net/PVOutput.Net.csproj +++ b/src/PVOutput.Net/PVOutput.Net.csproj @@ -38,14 +38,18 @@ https://github.com/pyrocumulus/pvoutput.net/blob/master/CHANGELOG.mdtrue + + AllEnabledByDefault + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/tests/PVOutput.Net.Tests/Client/PVOutputClientTests.cs b/tests/PVOutput.Net.Tests/Client/PVOutputClientTests.cs index 9377edb..c651088 100644 --- a/tests/PVOutput.Net.Tests/Client/PVOutputClientTests.cs +++ b/tests/PVOutput.Net.Tests/Client/PVOutputClientTests.cs @@ -65,5 +65,11 @@ public void Create_ClientWithOptionsAndLogger_CreatesClientWithLogger() Assert.That(client.Logger, Is.Not.EqualTo(NullLogger.Instance)); }); } + + [Test] + public void Create_AssemblyInfo_CreatesAssemblyInfo() + { + _ = new AssemblyInfo(); // For code coverage + } } } diff --git a/tests/PVOutput.Net.Tests/Modules/Favourite/FavouriteServiceTests.cs b/tests/PVOutput.Net.Tests/Modules/Favourite/FavouriteServiceTests.cs index bd50827..a11c9e3 100644 --- a/tests/PVOutput.Net.Tests/Modules/Favourite/FavouriteServiceTests.cs +++ b/tests/PVOutput.Net.Tests/Modules/Favourite/FavouriteServiceTests.cs @@ -5,6 +5,7 @@ using NUnit.Framework; using PVOutput.Net.Enums; using PVOutput.Net.Objects; +using PVOutput.Net.Responses; using PVOutput.Net.Tests.Utils; using RichardSzalay.MockHttp; @@ -21,7 +22,7 @@ public async Task FavouriteService_GetSingle() testProvider.ExpectUriFromBase(GETFAVOURITE_URL) .RespondPlainText(FAVOURITE_RESPONSE_SINGLE); - var response = await client.Favourite.GetFavouritesAsync(); + PVOutputArrayResponse response = await client.Favourite.GetFavouritesAsync(); testProvider.VerifyNoOutstandingExpectation(); AssertStandardResponse(response); } @@ -35,7 +36,7 @@ public async Task FavouriteReader_ForResponse_CreatesCorrectObjects() { IEnumerable result = await TestUtility.ExecuteArrayReaderByTypeAsync(FAVOURITE_RESPONSE_SINGLE); - var favourite = result.First(); + IFavourite favourite = result.First(); Assert.Multiple(() => { Assert.That(favourite.SystemId, Is.EqualTo(21)); Assert.That(favourite.SystemName, Is.EqualTo("PVOutput Demo")); diff --git a/tests/PVOutput.Net.Tests/Modules/System/SystemServiceTests.cs b/tests/PVOutput.Net.Tests/Modules/System/SystemServiceTests.cs index 10713de..932a5e6 100644 --- a/tests/PVOutput.Net.Tests/Modules/System/SystemServiceTests.cs +++ b/tests/PVOutput.Net.Tests/Modules/System/SystemServiceTests.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System; using System.Linq; +using PVOutput.Net.Responses; namespace PVOutput.Net.Tests.Modules.System { @@ -24,7 +25,7 @@ public async Task SystemService_GetOwnSystem_CallsCorrectUri() testProvider.ExpectUriFromBase(GETSYSTEM_URL) .RespondPlainText(SYSTEM_RESPONSE_EXTENDED); - var response = await client.System.GetOwnSystemAsync(); + PVOutputResponse response = await client.System.GetOwnSystemAsync(); testProvider.VerifyNoOutstandingExpectation(); AssertStandardResponse(response); } @@ -38,7 +39,7 @@ public async Task SystemService_GetOtherSystem_CallsCorrectUri() .WithQueryString("sid1=54321") .RespondPlainText(SYSTEM_RESPONSE_EXTENDED); - var response = await client.System.GetOtherSystemAsync(54321); + PVOutputResponse response = await client.System.GetOtherSystemAsync(54321); testProvider.VerifyNoOutstandingExpectation(); AssertStandardResponse(response); } @@ -52,7 +53,7 @@ public async Task SystemService_PostSystem_CallsCorrectUri() .WithExactQueryString("sid=54321&name=New%20name&v7l=New%20power&v7u=W") .RespondPlainText(""); - var response = await client.System.PostSystem(54321, "New name", new List() { new ExtendedDataDefinition() { Label = "New power", Unit = "W" } }); + PVOutputBasicResponse response = await client.System.PostSystem(54321, "New name", new List() { new ExtendedDataDefinition() { Label = "New power", Unit = "W" } }); testProvider.VerifyNoOutstandingExpectation(); AssertStandardResponse(response); } @@ -195,8 +196,8 @@ public async Task SystemReader_ForResponseWithoutEstimates_CreatesCorrectObject( public async Task SystemReader_ForResponseWithIncompleteExtendedProperties_CreatesCorrectObject() { ISystem result = await TestUtility.ExecuteObjectReaderByTypeAsync(SYSTEM_RESPONSE_WITH_MINIMALEXTENDEDDATA); - var secondDataConfig = result.ExtendedDataConfig[1]; - var thirdDataConfig = result.ExtendedDataConfig[2]; + ExtendedDataConfiguration secondDataConfig = result.ExtendedDataConfig[1]; + ExtendedDataConfiguration thirdDataConfig = result.ExtendedDataConfig[2]; Assert.Multiple(() => {