From 5b777b4b1800c79770681371e9fd35d3225255ed Mon Sep 17 00:00:00 2001 From: Mike-E <2931376+Mike-E-angelo@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:35:28 -0500 Subject: [PATCH] Addressed Solution Warnings (#596) --- .../Generics/GenericSerializer.cs | 15 ++++++----- .../Parametrized/ParametrizedConstructors.cs | 4 +-- .../ExtendedXmlSerializer.Samples/Program.cs | 6 ++--- .../Conversion/StructureConverter.cs | 4 +-- .../Members/InstanceMemberSerializations.cs | 4 +-- .../ContentModel/Reflection/TypePartMapper.cs | 8 +++--- src/ExtendedXmlSerializer/Core/Extensions.cs | 2 +- .../Core/Parsing/Extensions.cs | 2 +- .../Core/Sources/ConditionalSource.cs | 2 +- .../Core/TypedSortOrder.cs | 4 +-- .../ExtendedXmlSerializer.csproj | 3 ++- .../ExtensionModel/Content/Contents.cs | 2 +- .../RuntimeSerializationExceptionMessage.cs | 2 +- .../Markup/MarkupExtensionPartsEvaluator.cs | 2 +- .../ExtensionModel/Services.cs | 2 +- .../ExtensionModel/Types/Activators.cs | 2 +- .../Types/AllConstructorsExtension.cs | 2 +- .../Xml/Classic/TypeIdentity.cs | 2 +- .../ExtensionModel/Xml/XmlWriter.cs | 2 +- .../ReflectionModel/ConstructedActivators.cs | 8 +++--- .../ReflectionModel/Defaults.cs | 2 +- .../VweCore/Geometry/LeveledRectangle.cs | 2 +- .../VweCore/Geometry/MathExtensions.cs | 10 +++---- test/.External/VweCore/Geometry/Point2D.cs | 4 +-- .../Geometry/SlopeInterceptEquation.cs | 6 ++--- test/.External/VweCore/Node.cs | 4 +-- test/.External/VweCore/StorageRow.cs | 8 +++--- ...lizer.Tests.ReportedIssues.Issue502.csproj | 1 + .../Issue502Tests.cs | 26 +++++++++---------- ...dXmlSerializer.Tests.ReportedIssues.csproj | 3 ++- .../Issue199Tests.cs | 2 +- .../Issue563Tests.cs | 5 +++- .../Issue565Tests.cs | 2 ++ .../ExtendedXmlSerializer.Tests.csproj | 4 +-- .../Xml/ExtendedXmlSerializerTests.cs | 5 ++-- 35 files changed, 85 insertions(+), 77 deletions(-) diff --git a/samples/ExtendedXmlSerializer.Samples/Generics/GenericSerializer.cs b/samples/ExtendedXmlSerializer.Samples/Generics/GenericSerializer.cs index 81afc4548..c82f79fde 100644 --- a/samples/ExtendedXmlSerializer.Samples/Generics/GenericSerializer.cs +++ b/samples/ExtendedXmlSerializer.Samples/Generics/GenericSerializer.cs @@ -4,7 +4,7 @@ namespace ExtendedXmlSerializer.Samples.Generics { - public class GenericSerializer + public class GenericSerializer { private IExtendedXmlSerializer serializer; @@ -46,7 +46,7 @@ public static void SerializeAndDeserialize() var data = srl.SerializeProject(prj); - var obj = srl.DeserializeProject(data); + srl.DeserializeProject(data); } @@ -78,20 +78,20 @@ public Project(string name, int id) Id = id; } - public string Name { get; set; } = "MY project"; + public string Name { get; set; } public int Id { get; } public string Path => @"C:/my/fake/path"; public IList> Sites { get; } = new List>(); } - public class SpecificClass : SiteBase + public sealed class SpecificClass : SiteBase { public SpecificClass() { - this.Name = "Specific class"; - this.UserDescription = "Class description"; - this.Context = new Context(); + Name = "Specific class"; + UserDescription = "Class description"; + Context = new Context(); } @@ -105,6 +105,7 @@ public abstract class SiteBase : ISite where TSiteCo { public string Name { get; set; } public string UserDescription { get; set; } + // ReSharper disable once MemberHidesStaticFromOuterClass public abstract TSiteContext Context { get; set; } } diff --git a/samples/ExtendedXmlSerializer.Samples/Parametrized/ParametrizedConstructors.cs b/samples/ExtendedXmlSerializer.Samples/Parametrized/ParametrizedConstructors.cs index e816ad476..1f3004b2d 100644 --- a/samples/ExtendedXmlSerializer.Samples/Parametrized/ParametrizedConstructors.cs +++ b/samples/ExtendedXmlSerializer.Samples/Parametrized/ParametrizedConstructors.cs @@ -3,7 +3,7 @@ namespace ExtendedXmlSerializer.Samples.Parametrized { - public static class ParametrizedConstructors + public static class ParametrizedConstructors { public static void SerializeAndDeserialize() { @@ -22,7 +22,7 @@ public static void SerializeAndDeserialize() dt.Data.Add(7); var data = srl.Serialize(dt); - var obj = dsrl.Deserialize(data); + dsrl.Deserialize(data); } public class DataHolder diff --git a/samples/ExtendedXmlSerializer.Samples/Program.cs b/samples/ExtendedXmlSerializer.Samples/Program.cs index 0b3a397bf..8bd169d97 100644 --- a/samples/ExtendedXmlSerializer.Samples/Program.cs +++ b/samples/ExtendedXmlSerializer.Samples/Program.cs @@ -33,9 +33,9 @@ namespace ExtendedXmlSerializer.Samples { - using ExtendedXmlSerializer.Samples.Generics; - using ExtendedXmlSerializer.Samples.Parametrized; - using FluentApi; + using FluentApi; + using Generics; + using Parametrized; public class Program { diff --git a/src/ExtendedXmlSerializer/ContentModel/Conversion/StructureConverter.cs b/src/ExtendedXmlSerializer/ContentModel/Conversion/StructureConverter.cs index cd4e92960..e306c2bf3 100644 --- a/src/ExtendedXmlSerializer/ContentModel/Conversion/StructureConverter.cs +++ b/src/ExtendedXmlSerializer/ContentModel/Conversion/StructureConverter.cs @@ -1,5 +1,5 @@ -using System.Reflection; using ExtendedXmlSerializer.Core; +using System.Reflection; namespace ExtendedXmlSerializer.ContentModel.Conversion { @@ -11,7 +11,7 @@ sealed class StructureConverter : IConverter where T : struct public bool IsSatisfiedBy(TypeInfo parameter) => _converter.IsSatisfiedBy(parameter); - public T? Parse(string data) => data.NullIfEmpty() != null ? _converter.Parse(data) : (T?)null; + public T? Parse(string data) => data.NullIfEmpty() != null ? _converter.Parse(data) : null; public string Format(T? instance) => instance.HasValue ? _converter.Format(instance.Value) : null; } diff --git a/src/ExtendedXmlSerializer/ContentModel/Members/InstanceMemberSerializations.cs b/src/ExtendedXmlSerializer/ContentModel/Members/InstanceMemberSerializations.cs index 53ee2ddbd..6cdef1b2a 100644 --- a/src/ExtendedXmlSerializer/ContentModel/Members/InstanceMemberSerializations.cs +++ b/src/ExtendedXmlSerializer/ContentModel/Members/InstanceMemberSerializations.cs @@ -1,6 +1,6 @@ -using System.Reflection; using ExtendedXmlSerializer.Core.Specifications; using ExtendedXmlSerializer.ReflectionModel; +using System.Reflection; namespace ExtendedXmlSerializer.ContentModel.Members { @@ -21,7 +21,7 @@ public InstanceMemberSerializations(ISpecification specification, public IInstanceMemberSerialization Get(TypeInfo parameter) => _specification.IsSatisfiedBy(parameter) - ? (IInstanceMemberSerialization)new InstanceMemberSerialization(parameter, _serializations) + ? new InstanceMemberSerialization(parameter, _serializations) : new FixedInstanceMemberSerialization(_serializations.Get(parameter)); } } \ No newline at end of file diff --git a/src/ExtendedXmlSerializer/ContentModel/Reflection/TypePartMapper.cs b/src/ExtendedXmlSerializer/ContentModel/Reflection/TypePartMapper.cs index ab1b00edb..3bb5a7d28 100644 --- a/src/ExtendedXmlSerializer/ContentModel/Reflection/TypePartMapper.cs +++ b/src/ExtendedXmlSerializer/ContentModel/Reflection/TypePartMapper.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Immutable; -using System.Linq; using ExtendedXmlSerializer.ContentModel.Conversion; using ExtendedXmlSerializer.ContentModel.Identification; using ExtendedXmlSerializer.Core.Sources; +using System; +using System.Collections.Immutable; +using System.Linq; namespace ExtendedXmlSerializer.ContentModel.Reflection { @@ -26,7 +26,7 @@ public TypeParts Get(TypeParts parameter) arguments.HasValue ? arguments.Value.Select(_selector) .ToImmutableArray - : (Func>)null); + : null); return result; } } diff --git a/src/ExtendedXmlSerializer/Core/Extensions.cs b/src/ExtendedXmlSerializer/Core/Extensions.cs index 03fc8aa51..f50d08fe7 100644 --- a/src/ExtendedXmlSerializer/Core/Extensions.cs +++ b/src/ExtendedXmlSerializer/Core/Extensions.cs @@ -152,7 +152,7 @@ public static TValue Get(this IReadOnlyDictionary ta where TValue : struct => AssignedSpecification.Default.IsSatisfiedBy(key) && target.TryGetValue(key, out var result) ? result - : (TValue?)null; + : null; public static IEnumerable Appending(this IEnumerable @this, params T[] items) => @this.Concat(items); diff --git a/src/ExtendedXmlSerializer/Core/Parsing/Extensions.cs b/src/ExtendedXmlSerializer/Core/Parsing/Extensions.cs index d6faf07ef..fd0487031 100644 --- a/src/ExtendedXmlSerializer/Core/Parsing/Extensions.cs +++ b/src/ExtendedXmlSerializer/Core/Parsing/Extensions.cs @@ -18,7 +18,7 @@ public static T ParseAsOptional(this Parser @this, string data) public static Func Build(this IOption @this) => @this.IsDefined ? new Func(@this.Get) : null; public static T? GetAssigned(this IOption @this) where T : struct - => @this.IsDefined ? @this.Get() : (T?)null; + => @this.IsDefined ? @this.Get() : null; public static T Get(this IParsing @this, string parameter) => @this.Get(Inputs.Default.Get(parameter)) .Value; diff --git a/src/ExtendedXmlSerializer/Core/Sources/ConditionalSource.cs b/src/ExtendedXmlSerializer/Core/Sources/ConditionalSource.cs index c0ec07866..3a729c7b6 100644 --- a/src/ExtendedXmlSerializer/Core/Sources/ConditionalSource.cs +++ b/src/ExtendedXmlSerializer/Core/Sources/ConditionalSource.cs @@ -26,7 +26,7 @@ public ConditionalSource(ISpecification specification, ISpecificatio /// public ConditionalSource(Func specification, Func result, Func source) - : this(specification, result, source, x => default) {} + : this(specification, result, source, _ => default) {} /// public ConditionalSource(Func specification, Func result, diff --git a/src/ExtendedXmlSerializer/Core/TypedSortOrder.cs b/src/ExtendedXmlSerializer/Core/TypedSortOrder.cs index e4bd45322..5b2d47a74 100644 --- a/src/ExtendedXmlSerializer/Core/TypedSortOrder.cs +++ b/src/ExtendedXmlSerializer/Core/TypedSortOrder.cs @@ -1,10 +1,10 @@ -using System.Reflection; using ExtendedXmlSerializer.Core.Sources; +using System.Reflection; namespace ExtendedXmlSerializer.Core { sealed class TypedSortOrder : StructureCache, ITypedSortOrder { - public TypedSortOrder() : base(info => 1) {} + public TypedSortOrder() : base(_ => 1) {} } } \ No newline at end of file diff --git a/src/ExtendedXmlSerializer/ExtendedXmlSerializer.csproj b/src/ExtendedXmlSerializer/ExtendedXmlSerializer.csproj index 44351e4d3..650df8e61 100644 --- a/src/ExtendedXmlSerializer/ExtendedXmlSerializer.csproj +++ b/src/ExtendedXmlSerializer/ExtendedXmlSerializer.csproj @@ -7,7 +7,8 @@ Wojciech Nagórski;Michael DeMond netstandard2.0 ExtendedXmlSerializer - $(BaseIntermediateOutputPath)\$(Configuration)\$(TargetFramework)\ExtendedXmlSerializer.xml + + $(BaseIntermediateOutputPath)\$(Configuration)\$(TargetFramework)\ExtendedXmlSerializer.xml preview diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Content/Contents.cs b/src/ExtendedXmlSerializer/ExtensionModel/Content/Contents.cs index c3693bafb..00f0ee9f4 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Content/Contents.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Content/Contents.cs @@ -22,7 +22,7 @@ public sealed class Contents : ISerializerExtension /// public IServiceRepository Get(IServiceRepository parameter) - => parameter.RegisterConstructorDependency((provider, info) => provider.Get()) + => parameter.RegisterConstructorDependency((provider, _) => provider.Get()) .Register() .DecorateContentsWith() diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Content/Members/RuntimeSerializationExceptionMessage.cs b/src/ExtendedXmlSerializer/ExtensionModel/Content/Members/RuntimeSerializationExceptionMessage.cs index 3845823ef..1afbeecc5 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Content/Members/RuntimeSerializationExceptionMessage.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Content/Members/RuntimeSerializationExceptionMessage.cs @@ -11,7 +11,7 @@ sealed class RuntimeSerializationExceptionMessage = new RuntimeSerializationExceptionMessage(); RuntimeSerializationExceptionMessage() : - base(x => @"Parameterized Content is enabled on the container. By default, the type must satisfy the following rules if a public parameterless constructor is not found: + base(_ => @"Parameterized Content is enabled on the container. By default, the type must satisfy the following rules if a public parameterless constructor is not found: - Each member must not already be marked as an explicit contract - Must be a public fields / property. diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Markup/MarkupExtensionPartsEvaluator.cs b/src/ExtendedXmlSerializer/ExtensionModel/Markup/MarkupExtensionPartsEvaluator.cs index cdb0a2944..4a0eb7545 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Markup/MarkupExtensionPartsEvaluator.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Markup/MarkupExtensionPartsEvaluator.cs @@ -160,7 +160,7 @@ static TypeParts Copy(TypeParts parameter) var array = parameter.GetArguments() ?.ToArray(); var result = new TypeParts(string.Concat(parameter.Name, Extension), parameter.Identifier, - array != null ? array.ToImmutableArray : (Func>)null, + array != null ? array.ToImmutableArray : null, parameter.Dimensions); return result; } diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Services.cs b/src/ExtendedXmlSerializer/ExtensionModel/Services.cs index fa20a564e..2f1a3d508 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Services.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Services.cs @@ -152,7 +152,7 @@ public IServiceRepository Register(Func fa public IServiceRepository RegisterFallback(Func predicate, Func factory) => new Services(_container, - _registry.RegisterFallback((type, s) => predicate(type), + _registry.RegisterFallback((type, _) => predicate(type), request => factory(request.ServiceType))); public IServiceRepository RegisterConstructorDependency( diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Types/Activators.cs b/src/ExtendedXmlSerializer/ExtensionModel/Types/Activators.cs index 31a174722..f099bac04 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Types/Activators.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Types/Activators.cs @@ -29,7 +29,7 @@ protected override IActivator Create(Type parameter) var result = singleton != null ? activate ? new Activator(_activators.Build(parameter), singleton) - : (IActivator)new ReflectionModel.Activator(singleton.Self) + : new ReflectionModel.Activator(singleton.Self) : activator(); return result; } diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Types/AllConstructorsExtension.cs b/src/ExtendedXmlSerializer/ExtensionModel/Types/AllConstructorsExtension.cs index a87c3bb8d..4f96d2ef3 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Types/AllConstructorsExtension.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Types/AllConstructorsExtension.cs @@ -10,7 +10,7 @@ sealed class AllConstructorsExtension : ISerializerExtension AllConstructorsExtension() {} public IServiceRepository Get(IServiceRepository parameter) - => parameter.Decorate((provider, constructors) => new AllConstructors(constructors)); + => parameter.Decorate((_, constructors) => new AllConstructors(constructors)); void ICommand.Execute(IServices parameter) {} } diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Xml/Classic/TypeIdentity.cs b/src/ExtendedXmlSerializer/ExtensionModel/Xml/Classic/TypeIdentity.cs index 99a036167..704bc8b3c 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Xml/Classic/TypeIdentity.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Xml/Classic/TypeIdentity.cs @@ -11,7 +11,7 @@ class TypeIdentity : ITypeIdentity where T : Attribute public TypeIdentity(Func identity) => _identity = identity; public Key? Get(TypeInfo parameter) - => parameter.IsDefined(typeof(T)) ? (Key?)_identity(parameter.GetCustomAttribute()) : null; + => parameter.IsDefined(typeof(T)) ? _identity(parameter.GetCustomAttribute()) : null; } sealed class TypeIdentity : ITypeIdentity diff --git a/src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlWriter.cs b/src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlWriter.cs index 947dcaf6b..acfe26099 100644 --- a/src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlWriter.cs +++ b/src/ExtendedXmlSerializer/ExtensionModel/Xml/XmlWriter.cs @@ -154,7 +154,7 @@ TypeParts Get(TypeParts parameter) arguments.HasValue ? arguments.Value.Select(_selector) .ToImmutableArray - : (Func>)null, parameter.Dimensions); + : null, parameter.Dimensions); return result; } } diff --git a/src/ExtendedXmlSerializer/ReflectionModel/ConstructedActivators.cs b/src/ExtendedXmlSerializer/ReflectionModel/ConstructedActivators.cs index b1970a353..e507cb9c2 100644 --- a/src/ExtendedXmlSerializer/ReflectionModel/ConstructedActivators.cs +++ b/src/ExtendedXmlSerializer/ReflectionModel/ConstructedActivators.cs @@ -52,10 +52,10 @@ sealed class DefaultParameters : IParameterizedSource public Expression Get(ParameterInfo parameter) => parameter.IsDefined(typeof(ParamArrayAttribute)) - ? (Expression)Expression.NewArrayInit(parameter.ParameterType.GetElementType() ?? - throw new - InvalidOperationException("Element Type not found."), - Initializers) + ? Expression.NewArrayInit(parameter.ParameterType.GetElementType() ?? + throw new + InvalidOperationException("Element Type not found."), + Initializers) : Expression.Default(parameter.ParameterType); } } diff --git a/src/ExtendedXmlSerializer/ReflectionModel/Defaults.cs b/src/ExtendedXmlSerializer/ReflectionModel/Defaults.cs index 2711de6ff..538e869e5 100644 --- a/src/ExtendedXmlSerializer/ReflectionModel/Defaults.cs +++ b/src/ExtendedXmlSerializer/ReflectionModel/Defaults.cs @@ -14,6 +14,6 @@ static class Defaults public static Func ExpressionZip { get; } = (expression, type) => type.IsAssignableFrom(expression.Type) ? expression - : (Expression)Expression.Convert(expression, type); + : Expression.Convert(expression, type); } } \ No newline at end of file diff --git a/test/.External/VweCore/Geometry/LeveledRectangle.cs b/test/.External/VweCore/Geometry/LeveledRectangle.cs index 0d92ab47e..6a1411f36 100644 --- a/test/.External/VweCore/Geometry/LeveledRectangle.cs +++ b/test/.External/VweCore/Geometry/LeveledRectangle.cs @@ -38,7 +38,7 @@ public LeveledRectangle(Point2D firstPoint, Point2D secondPoint) public bool IsEmpty => LowerLeft.Equals(UpperRight); - public Point2D Center => new Point2D(LowerLeft.X + (Width / 2), LowerLeft.Y + (Height / 2)); + public Point2D Center => new Point2D(LowerLeft.X + Width / 2, LowerLeft.Y + Height / 2); public bool Equals(LeveledRectangle other) => LowerLeft.Equals(other.LowerLeft) && UpperRight.Equals(other.UpperRight); diff --git a/test/.External/VweCore/Geometry/MathExtensions.cs b/test/.External/VweCore/Geometry/MathExtensions.cs index 9404939c8..24bec65b7 100644 --- a/test/.External/VweCore/Geometry/MathExtensions.cs +++ b/test/.External/VweCore/Geometry/MathExtensions.cs @@ -4,9 +4,9 @@ namespace VweCore.Geometry { public static class MathExtensions { - public static double ToRadians(this double angleInDegrees) => (angleInDegrees * Math.PI) / 180.0; + public static double ToRadians(this double angleInDegrees) => angleInDegrees * Math.PI / 180.0; - public static double ToDegrees(this double angleInRadians) => (angleInRadians * 180) / Math.PI; + public static double ToDegrees(this double angleInRadians) => angleInRadians * 180 / Math.PI; public static double Square(this double value) => value * value; @@ -31,21 +31,21 @@ public static bool TryCalculateSlope(this Point2D point, Point2D other, out doub return true; } - public static double CalculateYIntercept(this Point2D point, double slope) => point.Y - (slope * point.X); + public static double CalculateYIntercept(this Point2D point, double slope) => point.Y - slope * point.X; public static (double xDistance, double yDistance) CalculateDistances(this Point2D point, Point2D other) => (point.X - other.X, point.Y - other.Y); public static double NormalizeAngleInDegrees(this double angleInDegrees) { if (angleInDegrees < 0.0) - return 360.0 + (angleInDegrees % -360.0); + return 360.0 + angleInDegrees % -360.0; if (angleInDegrees < 360.0) return angleInDegrees; return angleInDegrees % 360.0; } - public static double CalculateDotProduct(this Point2D point, Point2D other) => (point.X * other.X) + (point.Y * other.Y); + public static double CalculateDotProduct(this Point2D point, Point2D other) => point.X * other.X + point.Y * other.Y; public static double CalculateDirectionAngle(this Point2D vector) => Math.Atan2(vector.Y, vector.X).ToDegrees(); diff --git a/test/.External/VweCore/Geometry/Point2D.cs b/test/.External/VweCore/Geometry/Point2D.cs index 48cad9d4d..3d5d020e9 100644 --- a/test/.External/VweCore/Geometry/Point2D.cs +++ b/test/.External/VweCore/Geometry/Point2D.cs @@ -64,9 +64,9 @@ public Point2D TranslateToOrigin(Point2D referencePoint) => public Point2D TranslateBackFromOrigin(Point2D referencePoint) => new Point2D(X + referencePoint.X, Y + referencePoint.Y); - public double CalculateRotatedXCoordinate(double angleInRadians) => (X * Math.Cos(angleInRadians)) - (Y * Math.Sin(angleInRadians)); + public double CalculateRotatedXCoordinate(double angleInRadians) => X * Math.Cos(angleInRadians) - Y * Math.Sin(angleInRadians); - public double CalculateRotatedYCoordinate(double angleInRadians) => (X * Math.Sin(angleInRadians)) + (Y * Math.Cos(angleInRadians)); + public double CalculateRotatedYCoordinate(double angleInRadians) => X * Math.Sin(angleInRadians) + Y * Math.Cos(angleInRadians); public static bool operator !=(Point2D left, Point2D right) => !left.Equals(right); diff --git a/test/.External/VweCore/Geometry/SlopeInterceptEquation.cs b/test/.External/VweCore/Geometry/SlopeInterceptEquation.cs index 96e18ed24..807e2e584 100644 --- a/test/.External/VweCore/Geometry/SlopeInterceptEquation.cs +++ b/test/.External/VweCore/Geometry/SlopeInterceptEquation.cs @@ -30,7 +30,7 @@ public override int GetHashCode() public static bool operator !=(SlopeInterceptEquation left, SlopeInterceptEquation right) => !left.Equals(right); - public double CalculateY(double x) => (x * Slope) + YIntercept; + public double CalculateY(double x) => x * Slope + YIntercept; public bool ContainsPoint(Point2D point) => CalculateY(point.X).IsApproximately(point.Y); @@ -73,8 +73,8 @@ public Point2D GetPointByDistance(double x, double distance, AbscissaDirection d var x2 = x + xDistance; var pointX = direction == AbscissaDirection.LeftToRight - ? (x1.IsGreaterThanOrApproximatelyEqualTo(x) ? x1 : x2) - : (x1.IsLessThanOrApproximatelyEqualTo(x) ? x1 : x2); + ? x1.IsGreaterThanOrApproximatelyEqualTo(x) ? x1 : x2 + : x1.IsLessThanOrApproximatelyEqualTo(x) ? x1 : x2; return new Point2D(pointX, CalculateY(pointX)); } diff --git a/test/.External/VweCore/Node.cs b/test/.External/VweCore/Node.cs index 7385cbf80..d6c070f08 100644 --- a/test/.External/VweCore/Node.cs +++ b/test/.External/VweCore/Node.cs @@ -1,6 +1,6 @@ +using Light.GuardClauses; using System; using System.Collections.Generic; -using Light.GuardClauses; using VweCore.Geometry; using VweCore.Translations; @@ -43,7 +43,7 @@ public NodeLink AddLinkedNode(Node node, int nodeLinkId, bool isBidirectional = Node2 = node, Direction = isBidirectional ? NodeLinkDirection.Bidirectional : NodeLinkDirection.FromNode1ToNode2, DrivingDirectionFromNode1 = NodeLinkDrivingDirection.Straight, - DrivingDirectionFromNode2 = isBidirectional ? NodeLinkDrivingDirection.Straight : (NodeLinkDrivingDirection?)null + DrivingDirectionFromNode2 = isBidirectional ? NodeLinkDrivingDirection.Straight : null }; NodeLinks.Add(nodeLink); node.NodeLinks.Add(nodeLink); diff --git a/test/.External/VweCore/StorageRow.cs b/test/.External/VweCore/StorageRow.cs index f5e9ff8f7..144c3c054 100644 --- a/test/.External/VweCore/StorageRow.cs +++ b/test/.External/VweCore/StorageRow.cs @@ -1,6 +1,6 @@ -using System; +using Light.GuardClauses; +using System; using System.Collections.Generic; -using Light.GuardClauses; using VweCore.Abstractions; using VweCore.Geometry; using VweCore.Translations; @@ -72,7 +72,7 @@ public StorageRow Clone(int id) => public Ray2D GetPerpendicularRay() { - var referencePoint = new Point2D(Position.X + (Width / 2), Position.Y).RotateAroundReferencePoint(AngleInDegrees, Position); + var referencePoint = new Point2D(Position.X + Width / 2, Position.Y).RotateAroundReferencePoint(AngleInDegrees, Position); return new Ray2D(referencePoint, AngleInDegrees); } @@ -119,7 +119,7 @@ public StorageRow AddStorageLocationAndAdjustWidthIfNecessary(StorageLocation st minimumWidth += StorageLocations[i].Diameter + StorageLocationPadding + StorageLocationPadding; } - var offsetForNewLocation = -(minimumWidth + StorageLocationPadding + (storageLocation.Diameter / 2)); + var offsetForNewLocation = -(minimumWidth + StorageLocationPadding + storageLocation.Diameter / 2); minimumWidth += storageLocation.Diameter + StorageLocationPadding + StorageLocationPadding; return (minimumWidth, offsetForNewLocation); } diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502.csproj b/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502.csproj index 28031b340..2f8f09896 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502.csproj +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502.csproj @@ -2,6 +2,7 @@ net462 + net6.0; net7.0;$(ClassicFramework) latest $(NoWarn);CS8981 diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/Issue502Tests.cs b/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/Issue502Tests.cs index 93e920a2b..6302a2ae7 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/Issue502Tests.cs +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues.Issue502/Issue502Tests.cs @@ -7,7 +7,7 @@ namespace ExtendedXmlSerializer.Tests.ReportedIssues.Issue502 { - public sealed class Issue502Tests + public sealed class Issue502Tests { private readonly ITestOutputHelper _output; @@ -48,8 +48,8 @@ public void SerializeMapWithStorageLocationAndStorageRow() { var serializer = XmlSerializer.CreateDefaultSerializer(); - var storageLocation = new StorageLocation() { }; - var storageRow = new StorageRow() { StorageLocations = { storageLocation } }; + var storageLocation = new StorageLocation(); + var storageRow = new StorageRow { StorageLocations = { storageLocation } }; storageLocation.StorageRow = storageRow; var map = new Map(); map.Add(storageRow); @@ -67,10 +67,10 @@ public void SerializeStorageRow() { var serializer = XmlSerializer.CreateDefaultSerializer(); - var markerPoint = new MarkerPoint() { }; - var storageLocation = new StorageLocation() { MarkerPoints = new List(){markerPoint}}; + var markerPoint = new MarkerPoint(); + var storageLocation = new StorageLocation { MarkerPoints = new List {markerPoint}}; markerPoint.StorageLocation = storageLocation; - var storageRow = new StorageRow() {StorageLocations = {storageLocation}}; + var storageRow = new StorageRow {StorageLocations = {storageLocation}}; storageLocation.StorageRow = storageRow; var xml = serializer.SerializeIndented(storageRow); @@ -86,12 +86,12 @@ public void SerializeSmallMap() { var serializer = XmlSerializer.CreateDefaultSerializer(); - var markerPoint = new MarkerPoint() { }; - var storageLocation = new StorageLocation() { MarkerPoints = new List(){markerPoint}}; + var markerPoint = new MarkerPoint(); + var storageLocation = new StorageLocation { MarkerPoints = new List {markerPoint}}; markerPoint.StorageLocation = storageLocation; - var storageRow = new StorageRow() { StorageLocations = { storageLocation } }; + var storageRow = new StorageRow { StorageLocations = { storageLocation } }; storageLocation.StorageRow = storageRow; - var map = new Map(){Name = "test"}; + var map = new Map {Name = "test"}; map.Add(storageRow); map.Add(storageLocation); map.Add(markerPoint); @@ -110,12 +110,12 @@ public void SerializeHomeNodeNotMarkerPoint() { var serializer = XmlSerializer.CreateDefaultSerializer(); - var somePoint = new HallwayNode(){Id = 3}; + var somePoint = new HallwayNode {Id = 3}; var storageLocation = new StorageLocation(); - var markerPoint = new MarkerPoint() { StorageLocation = storageLocation}; + var markerPoint = new MarkerPoint { StorageLocation = storageLocation}; storageLocation.MarkerPoints.Add(markerPoint); - var storageRow = new StorageRow() { StorageLocations = { storageLocation } }; + var storageRow = new StorageRow { StorageLocations = { storageLocation } }; storageLocation.StorageRow = storageRow; var map = new Map(); map.Add(somePoint); diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues/ExtendedXmlSerializer.Tests.ReportedIssues.csproj b/test/ExtendedXmlSerializer.Tests.ReportedIssues/ExtendedXmlSerializer.Tests.ReportedIssues.csproj index 6f9c8f495..3409d22e4 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues/ExtendedXmlSerializer.Tests.ReportedIssues.csproj +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues/ExtendedXmlSerializer.Tests.ReportedIssues.csproj @@ -1,4 +1,5 @@ - + + net462 diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue199Tests.cs b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue199Tests.cs index c8db2109a..468a4cbc7 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue199Tests.cs +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue199Tests.cs @@ -52,7 +52,7 @@ void AllTypes() @""); } - [System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "1.0.0.0"), SerializableAttribute, + [System.CodeDom.Compiler.GeneratedCodeAttribute("XmlSchemaClassGenerator", "1.0.0.0"), Serializable, System.Xml.Serialization.XmlTypeAttribute("PatientVerificationRequest", Namespace = "http://hic.gov.au/hiconline/hiconline/version-4"), System.Diagnostics.DebuggerStepThroughAttribute, System.ComponentModel.DesignerCategoryAttribute("code"), System.Xml.Serialization.XmlRootAttribute( diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue563Tests.cs b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue563Tests.cs index 5e64328eb..2e4276fe0 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue563Tests.cs +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue563Tests.cs @@ -1,6 +1,7 @@ using ExtendedXmlSerializer.Configuration; using ExtendedXmlSerializer.Tests.ReportedIssues.Support; using FluentAssertions; +using JetBrains.Annotations; using System.Collections.Generic; using Xunit; @@ -18,9 +19,11 @@ public void Verify() sealed class Subject { + // ReSharper disable once CollectionNeverUpdated.Local public List ParentKey { get; set; } = new (); - public byte[] Id { get; set; } + public byte[] Id { get; [UsedImplicitly] set; } + [UsedImplicitly] public List Key { get diff --git a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue565Tests.cs b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue565Tests.cs index 84b97f9f8..14bff2dbe 100644 --- a/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue565Tests.cs +++ b/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue565Tests.cs @@ -1,6 +1,7 @@ using ExtendedXmlSerializer.Configuration; using ExtendedXmlSerializer.Tests.ReportedIssues.Support; using FluentAssertions; +using JetBrains.Annotations; using System.Linq; using System.Text; using Xunit; @@ -37,6 +38,7 @@ public void VerifyExclude() sealed class Model { + [UsedImplicitly] public Model(byte[] data, IDispenseEntity entity) : this(Encoding.UTF8.GetString(data), data, entity) {} public Model(string key, IDispenseEntity entity) : this(key, Encoding.UTF8.GetBytes(key), entity) {} diff --git a/test/ExtendedXmlSerializer.Tests/ExtendedXmlSerializer.Tests.csproj b/test/ExtendedXmlSerializer.Tests/ExtendedXmlSerializer.Tests.csproj index 51af3a33a..b56937221 100644 --- a/test/ExtendedXmlSerializer.Tests/ExtendedXmlSerializer.Tests.csproj +++ b/test/ExtendedXmlSerializer.Tests/ExtendedXmlSerializer.Tests.csproj @@ -1,5 +1,5 @@  - + ExtendedXmlSerializer.Tests net462 @@ -10,7 +10,7 @@ $(NoWarn);CS8981 - + $(DefineConstants);CORE diff --git a/test/ExtendedXmlSerializer.Tests/ExtensionModel/Xml/ExtendedXmlSerializerTests.cs b/test/ExtendedXmlSerializer.Tests/ExtensionModel/Xml/ExtendedXmlSerializerTests.cs index 9cbd07a6c..24408bf55 100644 --- a/test/ExtendedXmlSerializer.Tests/ExtensionModel/Xml/ExtendedXmlSerializerTests.cs +++ b/test/ExtendedXmlSerializer.Tests/ExtensionModel/Xml/ExtendedXmlSerializerTests.cs @@ -5,7 +5,6 @@ using JetBrains.Annotations; using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using Xunit; @@ -376,7 +375,7 @@ public void ClassWithObjectProperty() [Fact] public void Point() { - var expected = new PointProperty { Point = new Point(10, 20) }; + var expected = new PointProperty { Point = new System.Drawing.Point(10, 20) }; var actual = new SerializationSupport().Assert(expected, @"1020"); @@ -447,7 +446,7 @@ class GuidProperty #if !CORE class PointProperty { - public Point Point { get; set; } + public System.Drawing.Point Point { get; set; } }