diff --git a/.editorconfig b/.editorconfig index 5325ea92..50a8ac8e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -38,10 +38,10 @@ dotnet_style_predefined_type_for_locals_parameters_members = false : error dotnet_style_predefined_type_for_member_access = false : error # Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity : silent -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity : silent -dotnet_style_parentheses_in_other_operators = never_if_unnecessary : silent -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity : silent +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity : suggestion +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity : suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary : suggestion +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity : suggestion # Modifier preferences dotnet_style_require_accessibility_modifiers = for_non_interface_members : silent @@ -231,4 +231,19 @@ dotnet_diagnostic.CA1027.severity = silent dotnet_diagnostic.CA1031.severity = silent # IDE0075: Simplify conditional expression -dotnet_style_prefer_simplified_boolean_expressions = false : none \ No newline at end of file +dotnet_style_prefer_simplified_boolean_expressions = false : none + +# PH_S002: Monitor Discouraged Sync Object +dotnet_diagnostic.PH_S002.severity = none + +# PH_S005: Fake-Async Methods +dotnet_diagnostic.PH_S005.severity = none + +# PH_B007: Non-Atomic Access to Concurrent Collection +dotnet_diagnostic.PH_B007.severity = silent + +# PH_P006: Discouraged Monitor Method +dotnet_diagnostic.PH_P006.severity = silent + +# PH_P007: Unused Cancellation Token +dotnet_diagnostic.PH_P007.severity = silent \ No newline at end of file diff --git a/RapidField.SolidInstruments.sln b/RapidField.SolidInstruments.sln index 49c401c9..47b95e96 100644 --- a/RapidField.SolidInstruments.sln +++ b/RapidField.SolidInstruments.sln @@ -399,6 +399,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RapidField.SolidInstruments EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RapidField.SolidInstruments.DataAccess.DotNetNative.Ef", "src\RapidField.SolidInstruments.DataAccess.DotNetNative.Ef\RapidField.SolidInstruments.DataAccess.DotNetNative.Ef.csproj", "{F20759D5-D39D-4C31-8A23-AEAA606776E6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RapidField.SolidInstruments.Example.Domain.AccessControl", "example\RapidField.SolidInstruments.Example.Domain.AccessControl\RapidField.SolidInstruments.Example.Domain.AccessControl.csproj", "{7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -613,6 +615,10 @@ Global {F20759D5-D39D-4C31-8A23-AEAA606776E6}.Debug|Any CPU.Build.0 = Debug|Any CPU {F20759D5-D39D-4C31-8A23-AEAA606776E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {F20759D5-D39D-4C31-8A23-AEAA606776E6}.Release|Any CPU.Build.0 = Release|Any CPU + {7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -686,6 +692,7 @@ Global {8FFB8E4C-5858-4D18-B8DA-D669EED643AB} = {F58E05BE-9DC6-41B4-8324-C006F6CE7CC7} {266AC8D7-BDA0-42B0-B473-9025EDEB8DF8} = {F58E05BE-9DC6-41B4-8324-C006F6CE7CC7} {F20759D5-D39D-4C31-8A23-AEAA606776E6} = {F58E05BE-9DC6-41B4-8324-C006F6CE7CC7} + {7B185E3A-3A26-4188-9FB4-DED7E4EF5C3D} = {BEB60D41-11BB-4C6E-8F5D-1E7990A27C34} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {834FCFB0-DA00-4ABD-9424-6FE1398A9F6E} diff --git a/en-US_User.dic b/en-US_User.dic index 2a643767..814500ed 100644 --- a/en-US_User.dic +++ b/en-US_User.dic @@ -8,6 +8,7 @@ apidoc appveyor assignees astextplain +Async atm Autofac backmerge diff --git a/example/RapidField.SolidInstruments.Example.Domain.AccessControl/AssemblyAttributes.cs b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/AssemblyAttributes.cs new file mode 100644 index 00000000..a32e4acd --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/AssemblyAttributes.cs @@ -0,0 +1,7 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System.Runtime.CompilerServices; + +[assembly: DisablePrivateReflection()] \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain.AccessControl/README.md b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/README.md new file mode 100644 index 00000000..be347761 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/README.md @@ -0,0 +1,30 @@ + + +[![Solid Instruments](../../SolidInstruments.Logo.Color.Transparent.500w.png)](../../README.md) +- - - + +# RapidField.SolidInstruments.Example.Domain + +This document describes the purpose of the [`RapidField.SolidInstruments.Example.Domain.AccessControl`]() project. + +## Purpose + +This project demonstrates access control domain logic utilizing the **Solid Instruments** [data access](../../src/RapidField.SolidInstruments.DataAccess/README.md) and [messaging](../../src/RapidField.SolidInstruments.Messaging/README.md) constructs. + +## License + +[![License](https://img.shields.io/github/license/rapidfield/solid-instruments?style=flat&color=lightseagreen&label=license&logo=open-access&logoColor=lightgrey)](../../LICENSE.txt) + +**Solid Instruments** is [MIT-licensed](https://en.wikipedia.org/wiki/MIT_License). Review the [license terms](../../LICENSE.txt) for more information. + +
+ +- - - + +
+ +[![RapidField](../../RapidField.Logo.Color.Black.Transparent.200w.png)](https://www.rapidfield.com) + +###### Copyright (c) RapidField LLC. All rights reserved. "RapidField" and "Solid Instruments" are trademarks of RapidField LLC. \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain.AccessControl/RapidField.SolidInstruments.Example.Domain.AccessControl.csproj b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/RapidField.SolidInstruments.Example.Domain.AccessControl.csproj new file mode 100644 index 00000000..81c381fb --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/RapidField.SolidInstruments.Example.Domain.AccessControl.csproj @@ -0,0 +1,35 @@ + + + + + Solid Instruments contributors + RapidField + Copyright (c) RapidField LLC. All rights reserved. + Solid Instruments + This project demonstrates access control domain logic utilizing the Solid Instruments data access and messaging constructs. + $(BuildVersion) + netstandard2.1 + latest + + + bin\Debug\netstandard2.1\RapidField.SolidInstruments.Example.Domain.AccessControl.xml + true + + + + bin\Release\netstandard2.1\RapidField.SolidInstruments.Example.Domain.AccessControl.xml + true + + + + + + + + + + + + \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/CreateDomainModelCommand.cs b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/CreateDomainModelCommand.cs new file mode 100644 index 00000000..53e9c347 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/CreateDomainModelCommand.cs @@ -0,0 +1,129 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelCreatedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User +{ + /// + /// Represents a command to create a . + /// + [DataContract(Name = DataContractName)] + public sealed class CreateDomainModelCommand : CreateDomainModelReportableCommand + { + /// + /// Initializes a new instance of the class. + /// + public CreateDomainModelCommand() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is equal to . + /// + public CreateDomainModelCommand(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// is . + /// + public CreateDomainModelCommand(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public CreateDomainModelCommand(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// is -or- is . + /// + public CreateDomainModelCommand(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public CreateDomainModelCommand(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "CreateUserEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/DeleteDomainModelCommand.cs b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/DeleteDomainModelCommand.cs new file mode 100644 index 00000000..7106af34 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/DeleteDomainModelCommand.cs @@ -0,0 +1,129 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelDeletedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User +{ + /// + /// Represents a command to delete a . + /// + [DataContract(Name = DataContractName)] + public sealed class DeleteDomainModelCommand : DeleteDomainModelReportableCommand + { + /// + /// Initializes a new instance of the class. + /// + public DeleteDomainModelCommand() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is equal to . + /// + public DeleteDomainModelCommand(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// is . + /// + public DeleteDomainModelCommand(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public DeleteDomainModelCommand(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// is -or- is . + /// + public DeleteDomainModelCommand(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DeleteDomainModelCommand(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "DeleteUserEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/UpdateDomainModelCommand.cs b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/UpdateDomainModelCommand.cs new file mode 100644 index 00000000..aec749fd --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Commands/ModelState/User/UpdateDomainModelCommand.cs @@ -0,0 +1,129 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelUpdatedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User +{ + /// + /// Represents a command to update a . + /// + [DataContract(Name = DataContractName)] + public sealed class UpdateDomainModelCommand : UpdateDomainModelReportableCommand + { + /// + /// Initializes a new instance of the class. + /// + public UpdateDomainModelCommand() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is equal to . + /// + public UpdateDomainModelCommand(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// is . + /// + public UpdateDomainModelCommand(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public UpdateDomainModelCommand(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// is -or- is . + /// + public UpdateDomainModelCommand(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The desired state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the command. + /// + /// + /// A unique identifier that is assigned to related commands. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public UpdateDomainModelCommand(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UpdateUserEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelCreatedEvent.cs b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelCreatedEvent.cs new file mode 100644 index 00000000..03d0038e --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelCreatedEvent.cs @@ -0,0 +1,180 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Events.ModelState.User +{ + /// + /// Represents information about the creation of a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelCreatedEvent : DomainModelCreatedEvent + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelCreatedEvent() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is equal to . + /// + public DomainModelCreatedEvent(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// is . + /// + public DomainModelCreatedEvent(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public DomainModelCreatedEvent(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// is -or- is . + /// + public DomainModelCreatedEvent(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity) + : base(model, labels, verbosity) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to -or- + /// is equal to . + /// + public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity, Guid correlationIdentifier) + : base(model, labels, verbosity, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserCreatedEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelDeletedEvent.cs b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelDeletedEvent.cs new file mode 100644 index 00000000..5aef3b33 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelDeletedEvent.cs @@ -0,0 +1,180 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Events.ModelState.User +{ + /// + /// Represents information about the deletion of a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelDeletedEvent : DomainModelDeletedEvent + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelDeletedEvent() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is equal to . + /// + public DomainModelDeletedEvent(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// is . + /// + public DomainModelDeletedEvent(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public DomainModelDeletedEvent(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// is -or- is . + /// + public DomainModelDeletedEvent(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity) + : base(model, labels, verbosity) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to -or- + /// is equal to . + /// + public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity, Guid correlationIdentifier) + : base(model, labels, verbosity, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserDeletedEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelUpdatedEvent.cs b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelUpdatedEvent.cs new file mode 100644 index 00000000..ab84c5d5 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Events/ModelState/User/DomainModelUpdatedEvent.cs @@ -0,0 +1,180 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.EventAuthoring; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Events.ModelState.User +{ + /// + /// Represents information about an update to a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelUpdatedEvent : DomainModelUpdatedEvent + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelUpdatedEvent() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is equal to . + /// + public DomainModelUpdatedEvent(Guid correlationIdentifier) + : base(correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// is . + /// + public DomainModelUpdatedEvent(DomainModel model) + : base(model) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is . + /// + /// + /// is equal to . + /// + public DomainModelUpdatedEvent(DomainModel model, Guid correlationIdentifier) + : base(model, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// is -or- is . + /// + public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels) + : base(model, labels) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, Guid correlationIdentifier) + : base(model, labels, correlationIdentifier) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// is -or- is . + /// + /// + /// is equal to . + /// + public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity) + : base(model, labels, verbosity) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The resulting state of the associated domain model. + /// + /// + /// A collection of textual labels that provide categorical and/or contextual information about the event. + /// + /// + /// The verbosity level of the event. The default value is + /// + /// + /// A unique identifier that is assigned to related events. + /// + /// + /// is -or- is . + /// + /// + /// is equal to -or- + /// is equal to . + /// + public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, EventVerbosity verbosity, Guid correlationIdentifier) + : base(model, labels, verbosity, correlationIdentifier) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserUpdatedEvent"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/CreateDomainModelCommandMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/CreateDomainModelCommandMessage.cs new file mode 100644 index 00000000..8b360061 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/CreateDomainModelCommandMessage.cs @@ -0,0 +1,53 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelCommand = RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User.CreateDomainModelCommand; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelCreatedEvent; +using ReportedEventMessage = RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User.DomainModelCreatedEventMessage; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Command.ModelState.User +{ + using DomainModelCommandMessage = Messaging.CommandMessages.CreateDomainModelCommandMessage; + + /// + /// Represents a message that contains a command to create a . + /// + [DataContract(Name = DataContractName)] + public sealed class CreateDomainModelCommandMessage : DomainModelCommandMessage + { + /// + /// Initializes a new instance of the class. + /// + public CreateDomainModelCommandMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated command. + /// + /// + /// is . + /// + public CreateDomainModelCommandMessage(DomainModelCommand commandObject) + : base(commandObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "CreateUserCommandMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/DeleteDomainModelCommandMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/DeleteDomainModelCommandMessage.cs new file mode 100644 index 00000000..bc2f3839 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/DeleteDomainModelCommandMessage.cs @@ -0,0 +1,53 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelCommand = RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User.DeleteDomainModelCommand; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelDeletedEvent; +using ReportedEventMessage = RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User.DomainModelDeletedEventMessage; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Command.ModelState.User +{ + using DomainModelCommandMessage = Messaging.CommandMessages.DeleteDomainModelCommandMessage; + + /// + /// Represents a message that contains a command to delete a . + /// + [DataContract(Name = DataContractName)] + public sealed class DeleteDomainModelCommandMessage : DomainModelCommandMessage + { + /// + /// Initializes a new instance of the class. + /// + public DeleteDomainModelCommandMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated command. + /// + /// + /// is . + /// + public DeleteDomainModelCommandMessage(DomainModelCommand commandObject) + : base(commandObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "DeleteUserCommandMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/UpdateDomainModelCommandMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/UpdateDomainModelCommandMessage.cs new file mode 100644 index 00000000..0fb32fff --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Command/ModelState/User/UpdateDomainModelCommandMessage.cs @@ -0,0 +1,53 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelCommand = RapidField.SolidInstruments.Example.Domain.Commands.ModelState.User.UpdateDomainModelCommand; +using ReportedEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelUpdatedEvent; +using ReportedEventMessage = RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User.DomainModelUpdatedEventMessage; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Command.ModelState.User +{ + using DomainModelCommandMessage = Messaging.CommandMessages.UpdateDomainModelCommandMessage; + + /// + /// Represents a message that contains a command to update a . + /// + [DataContract(Name = DataContractName)] + public sealed class UpdateDomainModelCommandMessage : DomainModelCommandMessage + { + /// + /// Initializes a new instance of the class. + /// + public UpdateDomainModelCommandMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated command. + /// + /// + /// is . + /// + public UpdateDomainModelCommandMessage(DomainModelCommand commandObject) + : base(commandObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UpdateUserCommandMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelCreatedEventMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelCreatedEventMessage.cs new file mode 100644 index 00000000..4fdd5f5b --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelCreatedEventMessage.cs @@ -0,0 +1,51 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelCreatedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User +{ + using DomainModelEventMessage = Messaging.EventMessages.DomainModelCreatedEventMessage; + + /// + /// Represents a message that provides notification about the creation of a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelCreatedEventMessage : DomainModelEventMessage + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelCreatedEventMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated event. + /// + /// + /// is . + /// + public DomainModelCreatedEventMessage(DomainModelEvent eventObject) + : base(eventObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserCreatedEventMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelDeletedEventMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelDeletedEventMessage.cs new file mode 100644 index 00000000..3f5c1a60 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelDeletedEventMessage.cs @@ -0,0 +1,51 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelDeletedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User +{ + using DomainModelEventMessage = Messaging.EventMessages.DomainModelDeletedEventMessage; + + /// + /// Represents a message that provides notification about the deletion of a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelDeletedEventMessage : DomainModelEventMessage + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelDeletedEventMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated event. + /// + /// + /// is . + /// + public DomainModelDeletedEventMessage(DomainModelEvent eventObject) + : base(eventObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserDeletedEventMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelUpdatedEventMessage.cs b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelUpdatedEventMessage.cs new file mode 100644 index 00000000..0d406009 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Messages/Event/ModelState/User/DomainModelUpdatedEventMessage.cs @@ -0,0 +1,51 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using System.Diagnostics; +using System.Runtime.Serialization; +using DomainModel = RapidField.SolidInstruments.Example.Domain.Models.User.DomainModel; +using DomainModelEvent = RapidField.SolidInstruments.Example.Domain.Events.ModelState.User.DomainModelUpdatedEvent; + +namespace RapidField.SolidInstruments.Example.Domain.Messages.Event.ModelState.User +{ + using DomainModelEventMessage = Messaging.EventMessages.DomainModelUpdatedEventMessage; + + /// + /// Represents a message that provides notification about an update to a . + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModelUpdatedEventMessage : DomainModelEventMessage + { + /// + /// Initializes a new instance of the class. + /// + public DomainModelUpdatedEventMessage() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The associated event. + /// + /// + /// is . + /// + public DomainModelUpdatedEventMessage(DomainModelEvent eventObject) + : base(eventObject) + { + return; + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "UserUpdatedEventMessage"; + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.cs new file mode 100644 index 00000000..289ab5ef --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.cs @@ -0,0 +1,182 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using RapidField.SolidInstruments.Core.ArgumentValidation; +using RapidField.SolidInstruments.Cryptography.Secrets; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.Serialization; +using BaseDomainModel = RapidField.SolidInstruments.Core.Domain.GlobalIdentityDomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Models.User +{ + /// + /// Represents a user. + /// + [DataContract(Name = DataContractName)] + public sealed class DomainModel : BaseDomainModel, IAggregateDomainModel + { + /// + /// Initializes a new instance of the class. + /// + public DomainModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the domain model. + /// + [DebuggerHidden] + internal DomainModel(Guid identifier) + : base(identifier) + { + return; + } + + /// + /// Gets or sets the email address of the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + [DataMember] + public String EmailAddress + { + get => EmailAddressValue; + set => EmailAddressValue = value.RejectIf().IsNullOrEmpty(nameof(EmailAddress)); + } + + /// + /// Gets or sets the name of the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + [DataMember] + public String Name + { + get => NameValue; + set => NameValue = value.RejectIf().IsNullOrEmpty(nameof(Name)); + } + + /// + /// Gets or sets the hashed password for the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + [DataMember] + public String PasswordHash + { + get => PasswordHashValue; + set => PasswordHashValue = value.RejectIf().IsNullOrEmpty(nameof(PasswordHash)); + } + + /// + /// Represents the name that is used when representing this type in serialization and transport contexts. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const String DataContractName = "User"; + + /// + /// Represents the email address for the current . + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + [IgnoreDataMember] + private String EmailAddressValue; + + /// + /// Represents the name of the current . + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + [IgnoreDataMember] + private String NameValue; + + /// + /// Represents the hashed password for the current . + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + [IgnoreDataMember] + private String PasswordHashValue; + + /// + /// Contains a collection of known instances. + /// + internal static class Named + { + /// + /// Returns a collection of all known instances. + /// + /// + /// A collection of all known instances. + /// + [DebuggerHidden] + internal static IEnumerable All() => new DomainModel[] + { + StevenCallahan, + TomSmith + }; + + /// + /// Calculates a secure, Base64-encoded hash value for the specified password. + /// + /// + /// The plaintext password. + /// + /// + /// The resulting hash value. + /// + /// + /// is empty. + /// + /// + /// is . + /// + [DebuggerHidden] + private static String GetPasswordHash(String plaintextPassword) + { + using var password = Password.FromAsciiString(plaintextPassword); + return password.CalculateSecureHashString(); + } + + /// + /// Gets the Steven Callahan user. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + internal static DomainModel StevenCallahan => new DomainModel(Guid.Parse("a04fc5b0-1a67-43ff-89af-750128398d8a")) + { + EmailAddress = "steven.callahan@example.com", + Name = "Steven Callahan", + PasswordHash = GetPasswordHash("My name is Steven. 321") + }; + + /// + /// Gets the Tom Smith user. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + internal static DomainModel TomSmith => new DomainModel(Guid.Parse("01b7e51c-95e1-4eb1-aba6-1db0657a0fa3")) + { + EmailAddress = "tom.smith@example.com", + Name = "Tom Smith", + PasswordHash = GetPasswordHash("My name is Tom. 321") + }; + } + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/IAggregateDomainModel.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/IAggregateDomainModel.cs new file mode 100644 index 00000000..e84d39d8 --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/IAggregateDomainModel.cs @@ -0,0 +1,61 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using System; +using IBaseDomainModel = RapidField.SolidInstruments.Core.Domain.IGlobalIdentityAggregateDomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Models.User +{ + /// + /// Represents a user. + /// + public interface IAggregateDomainModel : IBaseDomainModel, IValueDomainModel + { + /// + /// Gets or sets the email address for the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + public new String EmailAddress + { + get; + set; + } + + /// + /// Gets or sets the name of the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + public new String Name + { + get; + set; + } + + /// + /// Gets or sets the hashed password for the current . + /// + /// + /// is empty. + /// + /// + /// is . + /// + public String PasswordHash + { + get; + set; + } + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/IValueDomainModel.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/IValueDomainModel.cs new file mode 100644 index 00000000..a24f6c6e --- /dev/null +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/IValueDomainModel.cs @@ -0,0 +1,31 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using System; +using IBaseDomainModel = RapidField.SolidInstruments.Core.Domain.IGlobalIdentityValueDomainModel; + +namespace RapidField.SolidInstruments.Example.Domain.Models.User +{ + /// + /// Represents a user. + /// + public interface IValueDomainModel : IBaseDomainModel + { + /// + /// Gets the email address for the current . + /// + public String EmailAddress + { + get; + } + + /// + /// Gets the name of the current . + /// + public String Name + { + get; + } + } +} \ No newline at end of file diff --git a/example/RapidField.SolidInstruments.Example.Domain/README.md b/example/RapidField.SolidInstruments.Example.Domain/README.md index 720664c8..e3674583 100644 --- a/example/RapidField.SolidInstruments.Example.Domain/README.md +++ b/example/RapidField.SolidInstruments.Example.Domain/README.md @@ -11,7 +11,7 @@ This document describes the purpose of the [`RapidField.SolidInstruments.Example ## Purpose -This project houses sample domain machinery that utilizes **Solid Instruments** [data access](../../src/RapidField.SolidInstruments.DataAccess/README.md) and [messaging](../../src/RapidField.SolidInstruments.Messaging/README.md) constructs. +This project houses a sample collection of shared domain models that utilize the **Solid Instruments** [messaging](../../src/RapidField.SolidInstruments.Messaging/README.md) constructs. ## License diff --git a/example/RapidField.SolidInstruments.Example.Domain/RapidField.SolidInstruments.Example.Domain.csproj b/example/RapidField.SolidInstruments.Example.Domain/RapidField.SolidInstruments.Example.Domain.csproj index 901c401e..7df486db 100644 --- a/example/RapidField.SolidInstruments.Example.Domain/RapidField.SolidInstruments.Example.Domain.csproj +++ b/example/RapidField.SolidInstruments.Example.Domain/RapidField.SolidInstruments.Example.Domain.csproj @@ -8,7 +8,7 @@ Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in RapidField Copyright (c) RapidField LLC. All rights reserved. Solid Instruments - This project houses sample domain machinery that utilizes Solid Instruments data access and messaging constructs. + This project houses a sample collection of shared domain models that utilize the Solid Instruments messaging constructs. $(BuildVersion) netstandard2.1 latest @@ -28,8 +28,8 @@ Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in - - + + \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Collections/BinaryTreeNode.cs b/src/RapidField.SolidInstruments.Collections/BinaryTreeNode.cs index dff7978e..d67698dd 100644 --- a/src/RapidField.SolidInstruments.Collections/BinaryTreeNode.cs +++ b/src/RapidField.SolidInstruments.Collections/BinaryTreeNode.cs @@ -118,7 +118,7 @@ public BinaryTreeNode(T value, BinaryTreeNode leftChild, BinaryTreeNode ri private BinaryTreeNode(T value, BinaryTreeNode leftChild, BinaryTreeNode rightChild, Boolean rejectNullLeftChild, Boolean rejectNullRightChild) : base(value, 2) { - if (leftChild is null == false) + if ((leftChild is null) == false) { if (AddChild(leftChild) == false) { @@ -130,7 +130,7 @@ private BinaryTreeNode(T value, BinaryTreeNode leftChild, BinaryTreeNode r leftChild.RejectIf().IsNull(nameof(leftChild)); } - if (rightChild is null == false) + if ((rightChild is null) == false) { if (AddChild(rightChild) == false) { diff --git a/src/RapidField.SolidInstruments.Collections/CircularBuffer.cs b/src/RapidField.SolidInstruments.Collections/CircularBuffer.cs index 16540afd..6ac70ef2 100644 --- a/src/RapidField.SolidInstruments.Collections/CircularBuffer.cs +++ b/src/RapidField.SolidInstruments.Collections/CircularBuffer.cs @@ -58,7 +58,7 @@ public T this[Int32 index] { using (var controlToken = StateControl.Enter()) { - var adjustedIndex = (ReadIndex + index); + var adjustedIndex = ReadIndex + index; return (adjustedIndex < Capacity) ? ElementArray[adjustedIndex] : ElementArray[adjustedIndex - Capacity]; } } diff --git a/src/RapidField.SolidInstruments.Collections/Extensions/ITreeNodeExtensions.cs b/src/RapidField.SolidInstruments.Collections/Extensions/ITreeNodeExtensions.cs index ce571db6..7c353ec5 100644 --- a/src/RapidField.SolidInstruments.Collections/Extensions/ITreeNodeExtensions.cs +++ b/src/RapidField.SolidInstruments.Collections/Extensions/ITreeNodeExtensions.cs @@ -249,7 +249,7 @@ public static TResult TraverseUp(this ITreeNode target, Func public T[] ToArray(Int32 startIndex, Int32 count) { - var indexCeiling = (startIndex.RejectIf().IsLessThan(0, nameof(startIndex)) + count.RejectIf().IsLessThan(0, nameof(count))); + var indexCeiling = startIndex.RejectIf().IsLessThan(0, nameof(startIndex)) + count.RejectIf().IsLessThan(0, nameof(count)); lock (SyncRoot) { diff --git a/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs b/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs index 5bf9f23a..5387910a 100644 --- a/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs +++ b/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs @@ -242,7 +242,7 @@ public Int32 Length /// /// Gets the length of the memory field, in bytes. /// - public Int32 LengthInBytes => (Length * StructureSize); + public Int32 LengthInBytes => Length * StructureSize; /// /// Gets a for the current . diff --git a/src/RapidField.SolidInstruments.Collections/TreeNode.cs b/src/RapidField.SolidInstruments.Collections/TreeNode.cs index 59a8b1dc..b9c9e628 100644 --- a/src/RapidField.SolidInstruments.Collections/TreeNode.cs +++ b/src/RapidField.SolidInstruments.Collections/TreeNode.cs @@ -340,7 +340,7 @@ public IEnumerable> Children /// /// When true, is an empty collection. /// - public Boolean IsLeaf => (ChildrenReference.Any() == false); + public Boolean IsLeaf => ChildrenReference.Any() == false; /// /// Gets a value indicating whether or not the current is a root node (a node without a parent). @@ -348,7 +348,7 @@ public IEnumerable> Children /// /// When true, is a null reference. /// - public Boolean IsRoot => (ParentReference is null); + public Boolean IsRoot => ParentReference is null; /// /// Gets the parent node of the current , or if the current diff --git a/src/RapidField.SolidInstruments.Command/DomainCommand.cs b/src/RapidField.SolidInstruments.Command/DomainCommand.cs index f9e75fe8..f6cf555c 100644 --- a/src/RapidField.SolidInstruments.Command/DomainCommand.cs +++ b/src/RapidField.SolidInstruments.Command/DomainCommand.cs @@ -54,7 +54,7 @@ public DomainCommand(Guid correlationIdentifier) public DomainCommand(IEnumerable labels) : base() { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// @@ -75,7 +75,7 @@ public DomainCommand(IEnumerable labels) public DomainCommand(IEnumerable labels, Guid correlationIdentifier) : base(correlationIdentifier) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// @@ -138,7 +138,7 @@ public DomainCommand(Guid correlationIdentifier) public DomainCommand(IEnumerable labels) : base() { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// @@ -159,7 +159,7 @@ public DomainCommand(IEnumerable labels) public DomainCommand(IEnumerable labels, Guid correlationIdentifier) : base(correlationIdentifier) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// diff --git a/src/RapidField.SolidInstruments.Command/TextualCommand.cs b/src/RapidField.SolidInstruments.Command/TextualCommand.cs index 9623e92d..142d2740 100644 --- a/src/RapidField.SolidInstruments.Command/TextualCommand.cs +++ b/src/RapidField.SolidInstruments.Command/TextualCommand.cs @@ -57,7 +57,7 @@ public TextualCommand(String value) public TextualCommand(String value, IEnumerable labels) : base() { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); Metadata = new Dictionary(); Value = value.RejectIf().IsNull(nameof(value)); } diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs index c0c66c4d..9ed6ffa1 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs @@ -320,7 +320,7 @@ public ConcurrencyControlConsumptionState ConsumptionState /// Represents the highest assignable token identifier. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 MaximumTokenIdentifier = (Int32.MaxValue - 256); + private const Int32 MaximumTokenIdentifier = Int32.MaxValue - 256; /// /// Represents the maximum length of time to block a thread before raising an exception, or diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlOperationException.cs b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlOperationException.cs index b40611da..e1eb161e 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlOperationException.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlOperationException.cs @@ -56,7 +56,7 @@ public ConcurrencyControlOperationException(Exception innerException) /// The exception that is the cause of the current exception. /// public ConcurrencyControlOperationException(String message, Exception innerException) - : base((message ?? ConstructMessage(innerException is null == false)), innerException) + : base(message ?? ConstructMessage((innerException is null) == false), innerException) { return; } diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs index 456f0e90..7bae48c4 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs @@ -70,7 +70,7 @@ internal ConcurrencyControlToken(SynchronizationContext context, Thread granteeT /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(ConcurrencyControlToken a, IConcurrencyControlToken b) => (a == b) == false; + public static Boolean operator !=(ConcurrencyControlToken a, IConcurrencyControlToken b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -85,7 +85,7 @@ internal ConcurrencyControlToken(SynchronizationContext context, Thread granteeT /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(ConcurrencyControlToken a, IConcurrencyControlToken b) => a.CompareTo(b) == -1; + public static Boolean operator <(ConcurrencyControlToken a, IConcurrencyControlToken b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another @@ -101,7 +101,7 @@ internal ConcurrencyControlToken(SynchronizationContext context, Thread granteeT /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(ConcurrencyControlToken a, IConcurrencyControlToken b) => a.CompareTo(b) < 1; + public static Boolean operator <=(ConcurrencyControlToken a, IConcurrencyControlToken b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -142,7 +142,7 @@ internal ConcurrencyControlToken(SynchronizationContext context, Thread granteeT /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(ConcurrencyControlToken a, IConcurrencyControlToken b) => a.CompareTo(b) == 1; + public static Boolean operator >(ConcurrencyControlToken a, IConcurrencyControlToken b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to @@ -158,7 +158,7 @@ internal ConcurrencyControlToken(SynchronizationContext context, Thread granteeT /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(ConcurrencyControlToken a, IConcurrencyControlToken b) => a.CompareTo(b) > -1; + public static Boolean operator >=(ConcurrencyControlToken a, IConcurrencyControlToken b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Instructs the current to wait for the specified task to complete before releasing @@ -277,7 +277,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(IConcurrencyControlToken other) => (Identifier == other.Identifier); + public Boolean Equals(IConcurrencyControlToken other) => Identifier == other.Identifier; /// /// Returns the hash code for this instance. @@ -343,25 +343,10 @@ public Boolean Poll(Boolean raiseExceptionIfInactive, Boolean raiseExceptionIfEx { if (IsActive) { - if (IsExpired) - { - if (raiseExceptionIfExpired) - { - throw new SystemTimeoutException("The concurrency control token is expired."); - } - - return false; - } - - return true; + return IsExpired ? raiseExceptionIfExpired ? throw new SystemTimeoutException("The concurrency control token is expired.") : false : true; } - if (raiseExceptionIfInactive) - { - throw new ConcurrencyControlOperationException("Control has been relinquished to other threads."); - } - - return false; + return raiseExceptionIfInactive ? throw new ConcurrencyControlOperationException("Control has been relinquished to other threads.") : false; } /// @@ -457,7 +442,7 @@ public Int32 Identifier /// /// Gets a value indicating whether or not the associated thread currently has control of the resource. /// - public Boolean IsActive => (IsActiveValue == IsActiveTrue); + public Boolean IsActive => IsActiveValue == IsActiveTrue; /// /// Gets a value indicating whether or not the expiration threshold for the token has been exceeded. diff --git a/src/RapidField.SolidInstruments.Core/DateTimeRange.cs b/src/RapidField.SolidInstruments.Core/DateTimeRange.cs index 99c69808..5a1fbee1 100644 --- a/src/RapidField.SolidInstruments.Core/DateTimeRange.cs +++ b/src/RapidField.SolidInstruments.Core/DateTimeRange.cs @@ -92,7 +92,7 @@ public DateTimeRange(DateTime start, DateTime end, DateTimeRangeGranularity gran /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(DateTimeRange dateTimeRangeOne, DateTimeRange dateTimeRangeTwo) => (dateTimeRangeOne == dateTimeRangeTwo) == false; + public static Boolean operator !=(DateTimeRange dateTimeRangeOne, DateTimeRange dateTimeRangeTwo) => dateTimeRangeOne == dateTimeRangeTwo == false; /// /// Determines whether or not two specified instances are equal. @@ -205,7 +205,7 @@ public static Boolean TryParse(String input, out DateTimeRange result) /// if the provided value is within the bounds of the current range, otherwise /// . /// - public Boolean Contains(DateTime dateTime) => (dateTime >= Start && dateTime <= End); + public Boolean Contains(DateTime dateTime) => dateTime >= Start && dateTime <= End; /// /// Indicates whether or not the start and end points of the provided are within the bounds of @@ -218,7 +218,7 @@ public static Boolean TryParse(String input, out DateTimeRange result) /// if the provided range is within the bounds of the current range, otherwise /// . /// - public Boolean Contains(DateTimeRange dateTimeRange) => (dateTimeRange.Start >= Start && dateTimeRange.End <= End); + public Boolean Contains(DateTimeRange dateTimeRange) => dateTimeRange.Start >= Start && dateTimeRange.End <= End; /// /// Determines whether or not the current is equal to the specified . @@ -546,7 +546,7 @@ private void CalculateLengthInMonthsAndYears(out Int32 lengthInMonths, out Int32 { // The last days of each calendar month are treated equally for the purpose of this calculation. - var startAndEndPointsAreSameDayOfMonth = ((Start.IsLastDayOfMonth() && End.IsLastDayOfMonth()) || (Start.Day == End.Day)); + var startAndEndPointsAreSameDayOfMonth = (Start.IsLastDayOfMonth() && End.IsLastDayOfMonth()) || (Start.Day == End.Day); if (startAndEndPointsAreSameDayOfMonth) { @@ -591,7 +591,7 @@ private void CalculateLengthInMonthsAndYears(out Int32 lengthInMonths, out Int32 } // Add months calculated from full years. - lengthInMonths += (lengthInYears * 12); + lengthInMonths += lengthInYears * 12; if (endPrecedesStartDuringYear) { @@ -713,7 +713,7 @@ private void Initialize(DateTime start, DateTime end, DateTimeRangeGranularity g Granularity = granularity.RejectIf().IsEqualToValue(DateTimeRangeGranularity.Unspecified, nameof(granularity)); Start = start.Quantize(granularity); End = end.Quantize(granularity); - Length = (End - Start); + Length = End - Start; LazyLengthInDays = new Lazy(CalculateLengthInDays, LazyThreadSafetyMode.PublicationOnly); LazyLengthInHours = new Lazy(CalculateLengthInHours, LazyThreadSafetyMode.PublicationOnly); LazyLengthInMilliseconds = new Lazy(CalculateLengthInMilliseconds, LazyThreadSafetyMode.PublicationOnly); diff --git a/src/RapidField.SolidInstruments.Core/Extensions/BitArrayExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/BitArrayExtensions.cs index f53f7b9c..0bd552ac 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/BitArrayExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/BitArrayExtensions.cs @@ -47,7 +47,7 @@ public static BitArray PerformCircularShift(this BitArray target, BitShiftDirect case BitShiftDirection.Left: // Sign the shift count negative for left shifts. - directionalBitShiftCount = (bitShiftCount.RejectIf().IsLessThan(0, nameof(bitShiftCount)) * -1); + directionalBitShiftCount = bitShiftCount.RejectIf().IsLessThan(0, nameof(bitShiftCount)) * -1; break; case BitShiftDirection.Right: @@ -90,13 +90,13 @@ public static BitArray ReverseOrder(this BitArray target) } var reverseOrderBitArray = new BitArray(target); - var fieldMidPosition = (fieldLength / 2); + var fieldMidPosition = fieldLength / 2; for (var i = 0; i < fieldMidPosition; i++) { // Trade the current position bit for the mirror position bit. var currentPositionBit = reverseOrderBitArray[i]; - var mirrorPosition = (fieldLength - i - 1); + var mirrorPosition = fieldLength - i - 1; reverseOrderBitArray[i] = reverseOrderBitArray[mirrorPosition]; reverseOrderBitArray[mirrorPosition] = currentPositionBit; } @@ -150,18 +150,18 @@ public static String ToBinaryString(this BitArray target) private static Int32 DetermineNewCircularPosition(Int32 currentPosition, Int32 arrayLength, Int32 directionalShift) { // Perform an open-ended (non-circular) shift. - var newPosition = (currentPosition + directionalShift); + var newPosition = currentPosition + directionalShift; while (newPosition < 0) { // Rotate the field right to bring the new position back into frame. - newPosition = (newPosition + arrayLength); + newPosition += arrayLength; } while (newPosition >= arrayLength) { // Rotate the field left to bring the new position back into frame. - newPosition = (newPosition - arrayLength); + newPosition -= arrayLength; } return newPosition; diff --git a/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs index 7e4f5d2e..1b3a74df 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs @@ -131,16 +131,16 @@ public static Byte[] PerformCircularBitShift(this Byte[] target, BitShiftDirecti } var collectionByteLength = target.Length; - var collectionBitLength = (collectionByteLength * 8); - var simplifiedBitShiftCount = (bitShiftCount.RejectIf().IsLessThan(0, nameof(bitShiftCount)) % collectionBitLength); + var collectionBitLength = collectionByteLength * 8; + var simplifiedBitShiftCount = bitShiftCount.RejectIf().IsLessThan(0, nameof(bitShiftCount)) % collectionBitLength; if (simplifiedBitShiftCount == 0) { return target; } - var simplifiedByteShiftCount = (simplifiedBitShiftCount / 8); - var bitShiftRemainder = (simplifiedBitShiftCount % 8); + var simplifiedByteShiftCount = simplifiedBitShiftCount / 8; + var bitShiftRemainder = simplifiedBitShiftCount % 8; var outputBuffer = new Byte[collectionByteLength]; Int32 headIndex; Int32 readIndex; @@ -173,14 +173,14 @@ public static Byte[] PerformCircularBitShift(this Byte[] target, BitShiftDirecti { leftElement = target[readIndex]; rightElement = target[readIndex == (collectionByteLength - 1) ? 0 : (readIndex + 1)]; - outputBuffer[writeIndex] = unchecked((Byte)(leftElement >> bitShiftRemainder | rightElement << (8 - bitShiftRemainder))); + outputBuffer[writeIndex] = unchecked((Byte)((leftElement >> bitShiftRemainder) | (rightElement << (8 - bitShiftRemainder)))); } for (readIndex = 0; readIndex < headIndex; readIndex++, writeIndex++) { leftElement = target[readIndex]; rightElement = target[readIndex + 1]; - outputBuffer[writeIndex] = unchecked((Byte)(leftElement >> bitShiftRemainder | rightElement << (8 - bitShiftRemainder))); + outputBuffer[writeIndex] = unchecked((Byte)((leftElement >> bitShiftRemainder) | (rightElement << (8 - bitShiftRemainder)))); } } @@ -188,7 +188,7 @@ public static Byte[] PerformCircularBitShift(this Byte[] target, BitShiftDirecti case BitShiftDirection.Right: - headIndex = (collectionByteLength - simplifiedByteShiftCount); + headIndex = collectionByteLength - simplifiedByteShiftCount; if (bitShiftRemainder == 0) { @@ -211,14 +211,14 @@ public static Byte[] PerformCircularBitShift(this Byte[] target, BitShiftDirecti { leftElement = target[readIndex - 1]; rightElement = target[readIndex]; - outputBuffer[writeIndex] = unchecked((Byte)(leftElement >> (8 - bitShiftRemainder) | rightElement << bitShiftRemainder)); + outputBuffer[writeIndex] = unchecked((Byte)((leftElement >> (8 - bitShiftRemainder)) | (rightElement << bitShiftRemainder))); } for (readIndex = 0; readIndex < headIndex; readIndex++, writeIndex++) { leftElement = target[readIndex == 0 ? (collectionByteLength - 1) : (readIndex - 1)]; rightElement = target[readIndex]; - outputBuffer[writeIndex] = unchecked((Byte)(leftElement >> (8 - bitShiftRemainder) | rightElement << bitShiftRemainder)); + outputBuffer[writeIndex] = unchecked((Byte)((leftElement >> (8 - bitShiftRemainder)) | (rightElement << bitShiftRemainder))); } } diff --git a/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs index ee35807e..75819e0b 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs @@ -455,7 +455,7 @@ internal static Boolean TryParseExtendedFormatDateTimeString(String dateTimeStri return true; } - return DateTime.TryParse(dateTimeString, formatProvider, (DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind), out result); + return DateTime.TryParse(dateTimeString, formatProvider, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind, out result); } /// @@ -498,7 +498,7 @@ internal static Boolean TryParseExtendedFormatDateTimeString(String dateTimeStri internal static Boolean TryParseFullDetailDateTimeString(String dateTimeString, IFormatProvider formatProvider, out DateTime result) { var dateTimeStringFormat = dateTimeString.Contains(DateTimeZoneUtcFormat) ? FullDetailDateTimeFormatTemplate.ApplyFormat(DateTimeZoneUtcFormat) : FullDetailDateTimeFormatTemplate.ApplyFormat(DateTimeZoneLocalFormat); - return DateTime.TryParseExact(dateTimeString, dateTimeStringFormat, formatProvider, (DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind), out result); + return DateTime.TryParseExact(dateTimeString, dateTimeStringFormat, formatProvider, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind, out result); } /// @@ -538,7 +538,7 @@ internal static Boolean TryParseFullDetailDateTimeString(String dateTimeString, /// . /// [DebuggerHidden] - internal static Boolean TryParseSerializedDateTimeString(String dateTimeString, IFormatProvider formatProvider, out DateTime result) => DateTime.TryParseExact(dateTimeString, SerializedDateTimeFormat, formatProvider, (DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind), out result); + internal static Boolean TryParseSerializedDateTimeString(String dateTimeString, IFormatProvider formatProvider, out DateTime result) => DateTime.TryParseExact(dateTimeString, SerializedDateTimeFormat, formatProvider, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind, out result); /// /// Constructs and returns a detailed format string using the time zone kind of the provided . diff --git a/src/RapidField.SolidInstruments.Core/Extensions/IEnumerableExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/IEnumerableExtensions.cs index fd5adc43..a360343c 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/IEnumerableExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/IEnumerableExtensions.cs @@ -84,6 +84,6 @@ public static Boolean IsEquivalentTo(this IEnumerable target, IEnumerable< /// if the current is or empty, otherwise /// . /// - public static Boolean IsNullOrEmpty(this IEnumerable target) => (target is null || target.Count() == 0); + public static Boolean IsNullOrEmpty(this IEnumerable target) => target is null || target.Count() == 0; } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Core/Extensions/StringExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/StringExtensions.cs index c479cc29..f43affdd 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/StringExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/StringExtensions.cs @@ -92,7 +92,7 @@ public static class StringExtensions /// if the current is or empty, otherwise /// . /// - public static Boolean IsNullOrEmpty(this String target) => (target is null || target.Length == 0); + public static Boolean IsNullOrEmpty(this String target) => target is null || target.Length == 0; /// /// Indicates whether or not the current is , empty or consists only of @@ -105,7 +105,7 @@ public static class StringExtensions /// if the current is or empty, otherwise /// . /// - public static Boolean IsNullOrWhiteSpace(this String target) => (String.IsNullOrWhiteSpace(target)); + public static Boolean IsNullOrWhiteSpace(this String target) => String.IsNullOrWhiteSpace(target); /// /// Indicates whether or not the specified regular expression pattern finds a match in the current . diff --git a/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs index 34e5ce45..c954887e 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs @@ -85,7 +85,7 @@ public static Uri AppendQueryStringData(this Uri target, IDictionary has been disposed or is currently in the /// process of being disposed. /// - protected Boolean IsDisposedOrDisposing => (IsDisposed || IsDisposing); + protected Boolean IsDisposedOrDisposing => IsDisposed || IsDisposing; /// /// Gets a value indicating whether or not the current is currently in the process of being diff --git a/src/RapidField.SolidInstruments.Core/Model.cs b/src/RapidField.SolidInstruments.Core/Model.cs index 675bdec5..e1f387d9 100644 --- a/src/RapidField.SolidInstruments.Core/Model.cs +++ b/src/RapidField.SolidInstruments.Core/Model.cs @@ -55,7 +55,7 @@ protected Model(TIdentifier identifier) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Model a, IModel b) => (a == b) == false; + public static Boolean operator !=(Model a, IModel b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -70,7 +70,7 @@ protected Model(TIdentifier identifier) /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(Model a, IModel b) => a.CompareTo(b) == -1; + public static Boolean operator <(Model a, IModel b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another @@ -86,7 +86,7 @@ protected Model(TIdentifier identifier) /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Model a, IModel b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Model a, IModel b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -102,11 +102,11 @@ protected Model(TIdentifier identifier) /// public static Boolean operator ==(Model a, IModel b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -127,7 +127,7 @@ protected Model(TIdentifier identifier) /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(Model a, IModel b) => a.CompareTo(b) == 1; + public static Boolean operator >(Model a, IModel b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another @@ -143,7 +143,7 @@ protected Model(TIdentifier identifier) /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Model a, IModel b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Model a, IModel b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Compares the current to the specified object and returns an indication of their @@ -225,7 +225,7 @@ protected Model() /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Model a, IModel b) => (a == b) == false; + public static Boolean operator !=(Model a, IModel b) => a == b == false; /// /// Determines whether or not two specified instances are equal. @@ -241,11 +241,11 @@ protected Model() /// public static Boolean operator ==(Model a, IModel b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } diff --git a/src/RapidField.SolidInstruments.Core/Nix.cs b/src/RapidField.SolidInstruments.Core/Nix.cs index 79103e8f..8847f2de 100644 --- a/src/RapidField.SolidInstruments.Core/Nix.cs +++ b/src/RapidField.SolidInstruments.Core/Nix.cs @@ -43,7 +43,7 @@ private Nix(Byte value) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Nix a, Nix b) => (a == b) == false; + public static Boolean operator !=(Nix a, Nix b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified instance. @@ -147,7 +147,7 @@ private Nix(Byte value) /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied /// instance; zero if they are equal. /// - public Int32 CompareTo(Object obj) => obj is Nix ? CompareTo((Nix)obj) : GetType().FullName.CompareTo(obj.GetType().FullName); + public Int32 CompareTo(Object obj) => obj is Nix nix ? CompareTo(nix) : GetType().FullName.CompareTo(obj.GetType().FullName); /// /// Determines whether or not the current is equal to the specified . diff --git a/src/RapidField.SolidInstruments.Core/ReferenceManager.cs b/src/RapidField.SolidInstruments.Core/ReferenceManager.cs index 6645100d..56ab6ddc 100644 --- a/src/RapidField.SolidInstruments.Core/ReferenceManager.cs +++ b/src/RapidField.SolidInstruments.Core/ReferenceManager.cs @@ -90,7 +90,7 @@ protected override void Dispose(Boolean disposing) disposeTasks.Add(reference?.DisposeAsync().AsTask()); } - var disposeTaskArray = disposeTasks.Where(task => task is null == false).ToArray(); + var disposeTaskArray = disposeTasks.Where(task => (task is null) == false).ToArray(); if (disposeTaskArray.Any()) { @@ -153,7 +153,7 @@ internal ManagedReference(T target) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(ManagedReference a, ManagedReference b) => (a == b) == false; + public static Boolean operator !=(ManagedReference a, ManagedReference b) => a == b == false; /// /// Determines whether or not two specified instances are equal. diff --git a/src/RapidField.SolidInstruments.Core/SemanticVersion.cs b/src/RapidField.SolidInstruments.Core/SemanticVersion.cs index cff3e9c1..46972c50 100644 --- a/src/RapidField.SolidInstruments.Core/SemanticVersion.cs +++ b/src/RapidField.SolidInstruments.Core/SemanticVersion.cs @@ -199,7 +199,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(SemanticVersion a, ISemanticVersion b) => (a == b) == false; + public static Boolean operator !=(SemanticVersion a, ISemanticVersion b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified instance. @@ -213,7 +213,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(SemanticVersion a, ISemanticVersion b) => a.CompareTo(b) == -1; + public static Boolean operator <(SemanticVersion a, ISemanticVersion b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another supplied @@ -229,7 +229,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(SemanticVersion a, ISemanticVersion b) => a.CompareTo(b) < 1; + public static Boolean operator <=(SemanticVersion a, ISemanticVersion b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -245,11 +245,11 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// public static Boolean operator ==(SemanticVersion a, ISemanticVersion b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -270,7 +270,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(SemanticVersion a, ISemanticVersion b) => a.CompareTo(b) == 1; + public static Boolean operator >(SemanticVersion a, ISemanticVersion b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another @@ -286,7 +286,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(SemanticVersion a, ISemanticVersion b) => a.CompareTo(b) > -1; + public static Boolean operator >=(SemanticVersion a, ISemanticVersion b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Converts the specified representation of a semantic version to its @@ -307,15 +307,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) /// /// does not contain a valid representation of a semantic version. /// - public static SemanticVersion Parse(String input) - { - if (Parse(input, out var value, true)) - { - return value; - } - - return default; - } + public static SemanticVersion Parse(String input) => Parse(input, out var value, true) ? value : default; /// /// Converts the specified representation of a semantic version to its @@ -521,7 +513,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextMajorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion((MajorVersion + 1), 0, 0, preReleaseLabel, buildMetadata); + public SemanticVersion NextMajorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion + 1, 0, 0, preReleaseLabel, buildMetadata); /// /// Returns the next minor version after the current . @@ -561,7 +553,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextMinorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, (MinorVersion + 1), 0, preReleaseLabel, buildMetadata); + public SemanticVersion NextMinorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, MinorVersion + 1, 0, preReleaseLabel, buildMetadata); /// /// Returns the next patch version after the current . @@ -601,7 +593,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextPatchVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, MinorVersion, (PatchVersion + 1), preReleaseLabel, buildMetadata); + public SemanticVersion NextPatchVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, MinorVersion, PatchVersion + 1, preReleaseLabel, buildMetadata); /// /// Converts the value of the current to its equivalent string representation. @@ -616,12 +608,12 @@ public override String ToString() if (PreReleaseLabel.IsNullOrEmpty() == false) { - stringBuilder.Append($"{DelimiterPrefixForPreReleaseLabel}{PreReleaseLabel}"); + _ = stringBuilder.Append($"{DelimiterPrefixForPreReleaseLabel}{PreReleaseLabel}"); } if (BuildMetadata.IsNullOrEmpty() == false) { - stringBuilder.Append($"{DelimiterPrefixForBuildMetadata}{BuildMetadata}"); + _ = stringBuilder.Append($"{DelimiterPrefixForBuildMetadata}{BuildMetadata}"); } return stringBuilder.ToString(); @@ -839,21 +831,21 @@ public String BuildMetadata /// x.0.0). /// [IgnoreDataMember] - public Boolean IsMajor => (MinorVersion == 0 && PatchVersion == 0); + public Boolean IsMajor => MinorVersion == 0 && PatchVersion == 0; /// /// Gets a value indicating whether or not the current represents a new minor version (eg. /// x.x.0). /// [IgnoreDataMember] - public Boolean IsMinor => (MinorVersion > 0 && PatchVersion == 0); + public Boolean IsMinor => MinorVersion > 0 && PatchVersion == 0; /// /// Gets a value indicating whether or not the current represents a patch version ( /// is greater than zero). /// [IgnoreDataMember] - public Boolean IsPatch => (PatchVersion > 0); + public Boolean IsPatch => PatchVersion > 0; /// /// Gets a value indicating whether or not the current represents a pre-release version. @@ -865,7 +857,7 @@ public String BuildMetadata /// Gets a value indicating whether or not the current represents a stable version. /// [IgnoreDataMember] - public Boolean IsStable => (IsPreRelease == false); + public Boolean IsStable => IsPreRelease == false; /// /// Gets or sets the major version number, which is incremented for compatibility-breaking feature changes. diff --git a/src/RapidField.SolidInstruments.Core/TimeOfDay.cs b/src/RapidField.SolidInstruments.Core/TimeOfDay.cs index f065268e..4e451b47 100644 --- a/src/RapidField.SolidInstruments.Core/TimeOfDay.cs +++ b/src/RapidField.SolidInstruments.Core/TimeOfDay.cs @@ -135,7 +135,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(TimeOfDay a, TimeOfDay b) => (a == b) == false; + public static Boolean operator !=(TimeOfDay a, TimeOfDay b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified instance. @@ -149,7 +149,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(TimeOfDay a, TimeOfDay b) => a.CompareTo(b) == -1; + public static Boolean operator <(TimeOfDay a, TimeOfDay b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another supplied @@ -165,7 +165,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(TimeOfDay a, TimeOfDay b) => a.CompareTo(b) < 1; + public static Boolean operator <=(TimeOfDay a, TimeOfDay b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -181,11 +181,11 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// public static Boolean operator ==(TimeOfDay a, TimeOfDay b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -205,7 +205,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(TimeOfDay a, TimeOfDay b) => a.CompareTo(b) == 1; + public static Boolean operator >(TimeOfDay a, TimeOfDay b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another supplied @@ -221,7 +221,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(TimeOfDay a, TimeOfDay b) => a.CompareTo(b) > -1; + public static Boolean operator >=(TimeOfDay a, TimeOfDay b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Converts the specified representation of a time of day value to its @@ -245,15 +245,7 @@ public TimeOfDay(TimeZoneInfo zone, Int32 hour, Int32 minute, Int32 second, Int3 /// /// does not contain a valid representation of a time of day value. /// - public static TimeOfDay Parse(String input) - { - if (Parse(input, out var zone, out var hour, out var minute, out var second, out var millisecond, true)) - { - return new TimeOfDay(zone, hour, minute, second, millisecond); - } - - return null; - } + public static TimeOfDay Parse(String input) => Parse(input, out var zone, out var hour, out var minute, out var second, out var millisecond, true) ? new TimeOfDay(zone, hour, minute, second, millisecond) : null; /// /// Converts the specified representation of a time of day value to its @@ -347,19 +339,7 @@ public Int32 CompareTo(TimeOfDay other) { var thisInstanceCountOfMillisecondsPastMidnightUtc = CountOfMillisecondsPastMidnightUtc(); var otherInstanceCountOfMillisecondsPastMidnightUtc = other.CountOfMillisecondsPastMidnightUtc(); - - if (thisInstanceCountOfMillisecondsPastMidnightUtc < otherInstanceCountOfMillisecondsPastMidnightUtc) - { - return -1; - } - else if (thisInstanceCountOfMillisecondsPastMidnightUtc > otherInstanceCountOfMillisecondsPastMidnightUtc) - { - return 1; - } - else - { - return 0; - } + return thisInstanceCountOfMillisecondsPastMidnightUtc < otherInstanceCountOfMillisecondsPastMidnightUtc ? -1 : thisInstanceCountOfMillisecondsPastMidnightUtc > otherInstanceCountOfMillisecondsPastMidnightUtc ? 1 : 0; } /// @@ -851,7 +831,7 @@ private static Boolean Parse(String input, out TimeZoneInfo zone, out Int32 hour hour += 12; } - var zoneStringFragmentCount = (rawValueSubstrings.Length - 2); + var zoneStringFragmentCount = rawValueSubstrings.Length - 2; var zoneStringFragment = zoneStringFragmentCount == 1 ? rawValueSubstrings[2] : String.Join(" ", rawValueSubstrings.Skip(2).Take(zoneStringFragmentCount).ToArray(), 0, zoneStringFragmentCount); if (raiseExceptionOnFail) @@ -893,7 +873,7 @@ private static Boolean Parse(String input, out TimeZoneInfo zone, out Int32 hour /// The number of milliseconds past midnight in the local timezone that the current instance represents. /// [DebuggerHidden] - private Int32 CountOfMillisecondsPastMidnightLocal() => ((Convert.ToInt32(Hour) * 3600000) + (Convert.ToInt32(Minute) * 60000) + (Convert.ToInt32(Second) * 1000) + Convert.ToInt32(Millisecond)); + private Int32 CountOfMillisecondsPastMidnightLocal() => (Convert.ToInt32(Hour) * 3600000) + (Convert.ToInt32(Minute) * 60000) + (Convert.ToInt32(Second) * 1000) + Convert.ToInt32(Millisecond); /// /// Counts how many milliseconds past midnight in Coordinated Universal Time (UTC) the current @@ -903,7 +883,7 @@ private static Boolean Parse(String input, out TimeZoneInfo zone, out Int32 hour /// The number of milliseconds past midnight UTC that the current instance represents. /// [DebuggerHidden] - private Int32 CountOfMillisecondsPastMidnightUtc() => (CountOfMillisecondsPastMidnightLocal() + (Zone.BaseUtcOffset.Hours * 3600000)); + private Int32 CountOfMillisecondsPastMidnightUtc() => CountOfMillisecondsPastMidnightLocal() + (Zone.BaseUtcOffset.Hours * 3600000); /// /// Initializes or reinitializes the instance using the specified serialized representation. @@ -923,7 +903,7 @@ private static Boolean Parse(String input, out TimeZoneInfo zone, out Int32 hour [DebuggerHidden] private void Initialize(String input) { - Parse(input, out var zone, out var hour, out var minute, out var second, out var millisecond, true); + _ = Parse(input, out var zone, out var hour, out var minute, out var second, out var millisecond, true); Zone = zone; Hour = hour; Minute = minute; diff --git a/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs b/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs index 397f8641..2bb5afbd 100644 --- a/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs @@ -69,9 +69,9 @@ protected CryptographicKey(TAlgorithm algorithm, CryptographicKeyDerivationMode LazyPbkdf2Provider = new Lazy(InitializePbkdf2Algorithm, LazyThreadSafetyMode.ExecutionAndPublication); // Gather information about the derived key. - DerivedKeyLength = (derivedKeyLengthInBits.RejectIf().IsLessThanOrEqualTo(0, nameof(derivedKeyLengthInBits)).TargetArgument / 8); - BlockWordCount = (derivedKeyLengthInBits / 32); - BlockCount = (KeySourceWordCount / BlockWordCount); + DerivedKeyLength = derivedKeyLengthInBits.RejectIf().IsLessThanOrEqualTo(0, nameof(derivedKeyLengthInBits)).TargetArgument / 8; + BlockWordCount = derivedKeyLengthInBits / 32; + BlockCount = KeySourceWordCount / BlockWordCount; // Copy in the key source bits. KeySource.Access(memory => Array.Copy(keySource.RejectIf().IsNull(nameof(keySource)).OrIf(argument => argument.Length > KeySourceLengthInBytes, nameof(keySource), "The specified key source contains too many elements.").TargetArgument, memory, keySource.Length)); @@ -144,7 +144,7 @@ public ISecureMemory ToDerivedKeyBytes() for (var j = 0; j < BlockWordCount; j++) { // Perform the XOR layering operation. - transformedWords[j] = (transformedWords[j] ^ sourceWords[(i * BlockWordCount) + j]); + transformedWords[j] = transformedWords[j] ^ sourceWords[(i * BlockWordCount) + j]; } } @@ -157,7 +157,7 @@ public ISecureMemory ToDerivedKeyBytes() for (var j = 0; j < BlockWordCount; j++) { // Perform the XOR layering operation with substitution. - transformedWords[j] = (SubstituteWord(transformedWords[j]) ^ sourceWords[(i * BlockWordCount) + j]); + transformedWords[j] = SubstituteWord(transformedWords[j]) ^ sourceWords[(i * BlockWordCount) + j]; } } @@ -356,7 +356,7 @@ public TAlgorithm Algorithm /// Represents the byte index of the algorithm byte within an unencrypted, serialized bit field. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 AlgorithmSecureMemoryIndex = (KeySourceSecureMemoryIndex + KeySourceLengthInBytes); + internal const Int32 AlgorithmSecureMemoryIndex = KeySourceSecureMemoryIndex + KeySourceLengthInBytes; /// /// Represents the default derivation mode for new keys. @@ -368,13 +368,13 @@ public TAlgorithm Algorithm /// Represents the byte index of the derivation mode byte within an unencrypted, serialized bit field. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 DerivationModeSecureMemoryIndex = (AlgorithmSecureMemoryIndex + AlgorithmLength); + internal const Int32 DerivationModeSecureMemoryIndex = AlgorithmSecureMemoryIndex + AlgorithmLength; /// /// Represents the number of bytes comprising . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 KeySourceLengthInBytes = (KeySourceWordCount * sizeof(UInt32)); + internal const Int32 KeySourceLengthInBytes = KeySourceWordCount * sizeof(UInt32); /// /// Represents the byte index of the key source within an unencrypted, serialized bit field. @@ -387,14 +387,14 @@ public TAlgorithm Algorithm /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 SerializedLength = (SerializedPlaintextLength + (SecureMemoryEncryptionAlgorithmBlockSizeInBytes * 2) - AlgorithmLength - DerivationModeLength); + internal const Int32 SerializedLength = SerializedPlaintextLength + (SecureMemoryEncryptionAlgorithmBlockSizeInBytes * 2) - AlgorithmLength - DerivationModeLength; /// /// Represents the number of bytes comprising a pre-encrypted, serialized representation of a /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 SerializedPlaintextLength = (KeySourceLengthInBytes + AlgorithmLength + DerivationModeLength); + internal const Int32 SerializedPlaintextLength = KeySourceLengthInBytes + AlgorithmLength + DerivationModeLength; /// /// Represents the key for the cryptographic key algorithm that is used to obscure serialized bit fields. @@ -433,19 +433,19 @@ public TAlgorithm Algorithm /// Represents the number of key source bytes constituting the iteration sum for PBKDF2-derived keys. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 Pbkdf2IterationSumLengthInBytes = (KeySourceLengthInBytes / 3); + private const Int32 Pbkdf2IterationSumLengthInBytes = KeySourceLengthInBytes / 3; /// /// Represents the number of key source bytes constituting the password for PBKDF2-derived keys. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 Pbkdf2PasswordLengthInBytes = (KeySourceLengthInBytes / 3); + private const Int32 Pbkdf2PasswordLengthInBytes = KeySourceLengthInBytes / 3; /// /// Represents the number of key source bytes constituting the salt for PBKDF2-derived keys. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 Pbkdf2SaltLengthInBytes = (KeySourceLengthInBytes / 3); + private const Int32 Pbkdf2SaltLengthInBytes = KeySourceLengthInBytes / 3; /// /// Represents a finalizer for static members of the class. diff --git a/src/RapidField.SolidInstruments.Cryptography/CryptographicTransform.cs b/src/RapidField.SolidInstruments.Cryptography/CryptographicTransform.cs index c10edc7c..6e8fa50d 100644 --- a/src/RapidField.SolidInstruments.Cryptography/CryptographicTransform.cs +++ b/src/RapidField.SolidInstruments.Cryptography/CryptographicTransform.cs @@ -41,7 +41,7 @@ internal abstract class CryptographicTransform : Instrument, ICryptoTransform protected CryptographicTransform(Int32 blockSize, CipherMode mode, PaddingMode paddingMode, EncryptionDirection encryptionDirection) : base(ConcurrencyControlMode.SingleThreadLock) { - BlockSizeInBytes = Convert.ToByte((blockSize.RejectIf().IsLessThanOrEqualTo(0, nameof(blockSize)) / 8)); + BlockSizeInBytes = Convert.ToByte(blockSize.RejectIf().IsLessThanOrEqualTo(0, nameof(blockSize)) / 8); EncryptionDirection = encryptionDirection.RejectIf().IsEqualToValue(EncryptionDirection.Unspecified, nameof(encryptionDirection)); Mode = mode; PaddingMode = paddingMode; @@ -162,7 +162,7 @@ private static Byte[] ConditionallyApplyPadding(Byte[] block, Int32 blockSizeInB return block; } - var paddingLengthInBytes = (blockSizeInBytes - block.Length); + var paddingLengthInBytes = blockSizeInBytes - block.Length; if (paddingLengthInBytes <= 0) { @@ -238,7 +238,7 @@ private static Byte[] ConditionallyRemovePadding(Byte[] block, Int32 blockSizeIn var ciphertextByteCount = Convert.ToByte(blockSizeInBytes - paddingLengthInBytes); var blockWithPaddingRemoved = new Byte[ciphertextByteCount]; - var startPosition = (blockSizeInBytes - 2); + var startPosition = blockSizeInBytes - 2; switch (paddingMode) { @@ -304,12 +304,12 @@ private static void TransformRange(List range, CryptographicTransform tran var encryptionDirection = transform.EncryptionDirection; var paddingMode = transform.PaddingMode; var currentLeadingRangeIndex = 0; - var nextLeadingRangeIndex = (currentLeadingRangeIndex + blockSizeInBytes); + var nextLeadingRangeIndex = currentLeadingRangeIndex + blockSizeInBytes; var currentBlock = (Byte[])null; while (currentLeadingRangeIndex < range.Count) { - var currentBlockIsFinalBlock = (nextLeadingRangeIndex >= range.Count); + var currentBlockIsFinalBlock = nextLeadingRangeIndex >= range.Count; switch (encryptionDirection) { @@ -341,12 +341,12 @@ private static void TransformRange(List range, CryptographicTransform tran if (currentBlockIsFinalBlock) { currentBlock = ConditionallyRemovePadding(currentBlock, blockSizeInBytes, paddingMode); - var countOfPaddingBytesRemoved = (blockSizeInBytes - currentBlock.Length); + var countOfPaddingBytesRemoved = blockSizeInBytes - currentBlock.Length; if (countOfPaddingBytesRemoved > 0) { // Contract the range to account for cleared padding bytes. - range.RemoveRange((currentLeadingRangeIndex + currentBlock.Length), countOfPaddingBytesRemoved); + range.RemoveRange(currentLeadingRangeIndex + currentBlock.Length, countOfPaddingBytesRemoved); } } @@ -392,7 +392,7 @@ private static void TransformRange(List range, CryptographicTransform tran /// /// Gets the block size, in bits. /// - protected Int32 BlockSizeInBits => (BlockSizeInBytes * 8); + protected Int32 BlockSizeInBits => BlockSizeInBytes * 8; /// /// Gets the block size, in bytes. diff --git a/src/RapidField.SolidInstruments.Cryptography/Extensions/IEnumerableExtensions.cs b/src/RapidField.SolidInstruments.Cryptography/Extensions/IEnumerableExtensions.cs index dec87919..99074af5 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Extensions/IEnumerableExtensions.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Extensions/IEnumerableExtensions.cs @@ -46,7 +46,7 @@ public static T SelectRandom(this IEnumerable target, RandomNumberGenerato throw new InvalidOperationException($"{nameof(SelectRandom)} cannot be invoked on an empty collection."); } - return target.ElementAt(randomnessProvider.GetInt32(0, (collectionLength - 1))); + return target.ElementAt(randomnessProvider.GetInt32(0, collectionLength - 1)); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs b/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs index 60b7edd4..10a509a2 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs @@ -1668,7 +1668,7 @@ private static void GenerateChar(RandomNumberGenerator target, Boolean permitNon var characterEncoding = permitNonLatin ? Encoding.Unicode : Encoding.ASCII; var characterByteLength = permitNonLatin ? UnicodeCharByteLength : AsciiCharByteLength; var characterBytes = new Byte[characterByteLength * CharacterBytesLengthMultiplier]; - var singlePassIterationCount = (characterBytes.Length - characterByteLength); + var singlePassIterationCount = characterBytes.Length - characterByteLength; target.GetBytes(characterBytes); while (PermuteCharacterGeneration(characterBytes, singlePassIterationCount, characterByteLength, characterEncoding, permitNonLatin, permitLowercaseAlphabetic, permitUppercaseAlphabetic, permitNumeric, permitSymbolic, permitWhiteSpace, permitControl, out randomValue) == false) @@ -1760,8 +1760,8 @@ private static void GenerateDecimal(RandomNumberGenerator target, out Decimal ra [DebuggerHidden] private static void GenerateDecimal(RandomNumberGenerator target, Decimal floor, Decimal ceiling, out Decimal randomValue) { - GenerateRangePosition(target, (ceiling - floor), out var rangePosition); - randomValue = (floor + rangePosition); + GenerateRangePosition(target, ceiling - floor, out var rangePosition); + randomValue = floor + rangePosition; } /// @@ -1801,7 +1801,7 @@ private static void GenerateDouble(RandomNumberGenerator target, Double floor, D { var range = Convert.ToDecimal(ceiling - floor); GenerateRangePosition(target, range, out var rangePosition); - randomValue = (floor + Convert.ToDouble(rangePosition)); + randomValue = floor + Convert.ToDouble(rangePosition); } /// @@ -1950,7 +1950,7 @@ private static void GenerateRangePosition(RandomNumberGenerator target, Decimal } var rationalMultiplier = new Decimal(lowBits, middleBits, Convert.ToInt32(highBits), false, 28); - rangePosition = (range * rationalMultiplier); + rangePosition = range * rationalMultiplier; } /// @@ -1990,7 +1990,7 @@ private static void GenerateSingle(RandomNumberGenerator target, Single floor, S { var range = Convert.ToDecimal(ceiling - floor); GenerateRangePosition(target, range, out var rangePosition); - randomValue = (floor + Convert.ToSingle(rangePosition)); + randomValue = floor + Convert.ToSingle(rangePosition); } /// @@ -2127,7 +2127,7 @@ private static void GenerateUInt16(RandomNumberGenerator target, out UInt16 rand [DebuggerHidden] private static void GenerateUInt16(RandomNumberGenerator target, UInt16 floor, UInt16 ceiling, out UInt16 randomValue) { - var range = (ceiling - floor); + var range = ceiling - floor; GenerateRangePosition(target, range, out var rangePosition); randomValue = Convert.ToUInt16(floor + rangePosition.RoundedTo(0)); } @@ -2167,7 +2167,7 @@ private static void GenerateUInt32(RandomNumberGenerator target, out UInt32 rand [DebuggerHidden] private static void GenerateUInt32(RandomNumberGenerator target, UInt32 floor, UInt32 ceiling, out UInt32 randomValue) { - var range = (ceiling - floor); + var range = ceiling - floor; GenerateRangePosition(target, range, out var rangePosition); randomValue = Convert.ToUInt32(floor + rangePosition.RoundedTo(0)); } diff --git a/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs b/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs index 956419ea..975af4c4 100644 --- a/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs +++ b/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs @@ -187,7 +187,7 @@ private void PermuteBuffer() /// Represents the number of source bytes generated for a single round of . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 BufferPermutationSourceLengthInBytes = (CipherBlockLengthInBytes * 32); + private const Int32 BufferPermutationSourceLengthInBytes = CipherBlockLengthInBytes * 32; /// /// Represents the bit-length of a single block for . @@ -199,7 +199,7 @@ private void PermuteBuffer() /// Represents the length of a single block for , in bytes. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 CipherBlockLengthInBytes = (CipherBlockLengthInBits / 8); + private const Int32 CipherBlockLengthInBytes = CipherBlockLengthInBits / 8; /// /// Represents the bit-length of the private key for . @@ -211,7 +211,7 @@ private void PermuteBuffer() /// Represents the length of the private key for , in bytes. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Int32 CipherKeyLengthInBytes = (CipherKeyLengthInBits / 8); + private const Int32 CipherKeyLengthInBytes = CipherKeyLengthInBits / 8; /// /// Represents a finalizer for static members of the class. diff --git a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashTree.cs b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashTree.cs index ac1f5aa8..b64864f1 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashTree.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashTree.cs @@ -242,9 +242,9 @@ private void PermuteRow(IEnumerable row) return; } - var pairCount = (rowCount / 2); - var pairCountModulus = (rowCount % 2); - var parentRowLength = (pairCount + pairCountModulus); + var pairCount = rowCount / 2; + var pairCountModulus = rowCount % 2; + var parentRowLength = pairCount + pairCountModulus; var parentRow = new HashTreeNode[parentRowLength]; for (var i = 0; i < pairCount; i++) diff --git a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashingProcessor.cs b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashingProcessor.cs index 39330999..9f0e8df1 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashingProcessor.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashingProcessor.cs @@ -192,12 +192,12 @@ internal HashingProcessor() /// public Byte[] CalculateHash(Byte[] plaintext, HashingAlgorithmSpecification algorithm, Byte[] salt) { - var applySalt = (salt is null == false); - var saltLengthInBytes = (applySalt ? salt.Length : 0); + var applySalt = (salt is null) == false; + var saltLengthInBytes = applySalt ? salt.Length : 0; var plaintextLengthInBytes = plaintext.RejectIf().IsNullOrEmpty(nameof(plaintext)).TargetArgument.Length; - var saltedPlaintextLengthInBytes = (plaintextLengthInBytes + saltLengthInBytes); - var digestLengthInBytes = (algorithm.RejectIf().IsEqualToValue(HashingAlgorithmSpecification.Unspecified, nameof(algorithm)).TargetArgument.ToDigestBitLength() / 8); - var hashLengthInBytes = (digestLengthInBytes + saltLengthInBytes); + var saltedPlaintextLengthInBytes = plaintextLengthInBytes + saltLengthInBytes; + var digestLengthInBytes = algorithm.RejectIf().IsEqualToValue(HashingAlgorithmSpecification.Unspecified, nameof(algorithm)).TargetArgument.ToDigestBitLength() / 8; + var hashLengthInBytes = digestLengthInBytes + saltLengthInBytes; var hashValue = new Byte[hashLengthInBytes]; try @@ -323,7 +323,7 @@ public Boolean EvaluateHash(Byte[] hash, T plaintextObject, HashingAlgorithmSpec { try { - var digestLength = (algorithm.RejectIf().IsEqualToValue(HashingAlgorithmSpecification.Unspecified, nameof(algorithm)).TargetArgument.ToDigestBitLength() / 8); + var digestLength = algorithm.RejectIf().IsEqualToValue(HashingAlgorithmSpecification.Unspecified, nameof(algorithm)).TargetArgument.ToDigestBitLength() / 8; Byte[] processedHash; Byte[] calculatedHash; diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/ExportedSecret.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/ExportedSecret.cs index a2ab1bf3..723953f6 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/ExportedSecret.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/ExportedSecret.cs @@ -135,7 +135,7 @@ private IReadOnlySecret HydrateSecret(Secret secret) [DataMember] public Boolean HasValue { - get => Value is null == false; + get => (Value is null) == false; set { if (value && Value is null) diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs index 983fbf4a..ce8031f5 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs @@ -225,7 +225,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) { // Interrogate the final 16 bits to determine the depth. var keyLength = SymmetricKey.SerializedLength; - var depth = BitConverter.ToUInt16(memory, (SerializedLength - sizeof(UInt16))); + var depth = BitConverter.ToUInt16(memory, SerializedLength - sizeof(UInt16)); keys = new ISymmetricKey[depth]; for (var i = 0; i < depth; i++) @@ -235,7 +235,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) secureMemory.Access(key => { // Copy out the key buffers. - Array.Copy(memory, (keyLength * i), key, 0, keyLength); + Array.Copy(memory, keyLength * i, key, 0, keyLength); }); keys[i] = SymmetricKey.FromSecureMemory(secureMemory); @@ -394,7 +394,7 @@ protected sealed override ISecureMemory ToSecureMemory(IConcurrencyControlToken keyMemory.Access(key => { // Copy the key buffers out to the result buffer. - Array.Copy(key, 0, pinnedMemory, (keyLength * i), keyLength); + Array.Copy(key, 0, pinnedMemory, keyLength * i, keyLength); }); } @@ -404,11 +404,11 @@ protected sealed override ISecureMemory ToSecureMemory(IConcurrencyControlToken // Fill the unused segments with random bytes. var randomBytes = new Byte[keyLength]; HardenedRandomNumberGenerator.Instance.GetBytes(randomBytes); - Array.Copy(randomBytes, 0, pinnedMemory, (keyLength * i), keyLength); + Array.Copy(randomBytes, 0, pinnedMemory, keyLength * i, keyLength); } // Append the depth as a 16-bit integer. - Buffer.BlockCopy(BitConverter.GetBytes(Convert.ToUInt16(Depth)), 0, pinnedMemory, (SerializedLength - sizeof(UInt16)), sizeof(UInt16)); + Buffer.BlockCopy(BitConverter.GetBytes(Convert.ToUInt16(Depth)), 0, pinnedMemory, SerializedLength - sizeof(UInt16), sizeof(UInt16)); }); return secureMemory; @@ -494,7 +494,7 @@ public IEnumerable Keys /// Represents the number of bytes comprising a serialized representation of a . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal const Int32 SerializedLength = ((SymmetricKey.SerializedLength * MaximumDepth) + sizeof(UInt16)); + internal const Int32 SerializedLength = (SymmetricKey.SerializedLength * MaximumDepth) + sizeof(UInt16); /// /// Represents the default derivation mode for new keys. diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs index cceedb27..25a80f54 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs @@ -159,7 +159,7 @@ private PinnedMemory DecryptInCbcMode(PinnedMemory ciphertext, PinnedMemory priv { Array.Copy(ciphertext, 0, initializationVector, 0, BlockSizeInBytes); - using (var cipherTextSansInitializationVector = new PinnedMemory((ciphertext.Length - BlockSizeInBytes), true)) + using (var cipherTextSansInitializationVector = new PinnedMemory(ciphertext.Length - BlockSizeInBytes, true)) { Array.Copy(ciphertext, BlockSizeInBytes, cipherTextSansInitializationVector, 0, cipherTextSansInitializationVector.Length); @@ -319,7 +319,7 @@ private PinnedMemory EncryptInEcbMode(PinnedMemory plaintext, PinnedMemory priva /// Gets the number of bytes per block for the cipher represented by this . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal Int32 BlockSizeInBytes => (BlockSizeInBits / 8); + internal Int32 BlockSizeInBytes => BlockSizeInBits / 8; /// /// Gets the number of key bytes for the cipher represented by this . diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricProcessor.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricProcessor.cs index 07a46fe8..8acea394 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricProcessor.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricProcessor.cs @@ -165,7 +165,7 @@ public T Decrypt(Byte[] ciphertext, ICascadingSymmetricKey key) var decryptor = new SymmetricProcessor(RandomnessProvider); var buffer = ciphertext; - for (var i = (key.Depth - 1); i > 0; i--) + for (var i = key.Depth - 1; i > 0; i--) { buffer = decryptor.Decrypt(buffer, keys.ElementAt(i)); } diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/ConfiguredContext.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/ConfiguredContext.cs index b37ed522..51dcc3d4 100644 --- a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/ConfiguredContext.cs +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/ConfiguredContext.cs @@ -355,7 +355,7 @@ private static String GetConventionalDatabaseName(Type contextType) } else if (contextTypeName.EndsWith(ContextPostfixStringElement)) { - return contextTypeName.Substring(0, (contextTypeName.Length - ContextPostfixStringElement.Length)); + return contextTypeName.Substring(0, contextTypeName.Length - ContextPostfixStringElement.Length); } return contextTypeName; diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkDataAccessModel.cs new file mode 100644 index 00000000..c033b760 --- /dev/null +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkDataAccessModel.cs @@ -0,0 +1,438 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using RapidField.SolidInstruments.Core.ArgumentValidation; +using RapidField.SolidInstruments.Core.Domain; +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Runtime.Serialization; + +namespace RapidField.SolidInstruments.DataAccess.EntityFramework +{ + /// + /// Represents an object that models an Entity Framework entity. + /// + /// + /// The type of the value that uniquely identifies the model. + /// + /// + /// The type of the domain model to which the data access model is mapped. + /// + [DataContract] + public abstract class EntityFrameworkDataAccessModel : EntityFrameworkDataAccessModel, IDataAccessModel + where TIdentifier : IComparable, IComparable, IEquatable + where TDomainModel : class, IDomainModel, new() + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of + /// . + /// + protected EntityFrameworkDataAccessModel(TIdentifier identifier) + : base(identifier) + { + return; + } + + /// + /// Copies the state of the specified domain model to the current + /// . + /// + /// + /// A domain model from which to hydrate the state of the data access model. + /// + /// + /// The state of is invalid. + /// + /// + /// is . + /// + public void HydrateFromDomainModel(TDomainModel domainModel) + { + _ = domainModel.RejectIf().IsNull(nameof(domainModel)); + + try + { + HydrateModel(domainModel, this); + } + catch (Exception exception) + { + throw new ArgumentException($"Failed to hydrate a data access model (type: {GetType().FullName}) from the specified domain model (type: {typeof(TDomainModel).FullName}). See inner exception.", nameof(domainModel), exception); + } + } + + /// + /// Converts the current to its equivalent domain + /// model representation. + /// + /// + /// An that is equivalent to the current data access model. + /// + /// + /// An exception was raised while converting the data access model to its equivalent domain model. + /// + public TDomainModel ToDomainModel() + { + try + { + var domainModel = new TDomainModel(); + HydrateModel(this, domainModel); + return domainModel; + } + catch (Exception exception) + { + throw new TypeInitializationException(typeof(TDomainModel).FullName, exception); + } + } + + /// + /// Copies the state of the specified source model to the specified target model. + /// + /// + /// The model from which state is derived. + /// + /// + /// The model to which state is copied. + /// + /// + /// is -or- is + /// . + /// + [DebuggerHidden] + private static void HydrateModel(IModel sourceModel, IModel targetModel) + { + var sourceModelType = sourceModel.RejectIf().IsNull(nameof(sourceModel)).TargetArgument.GetType(); + var targetModelType = targetModel.RejectIf().IsNull(nameof(targetModel)).TargetArgument.GetType(); + var sourceModelProperties = sourceModelType.GetProperties(PropertyBindingFlags).ToDictionary(property => property.Name, property => property); + var targetModelProperties = targetModelType.GetProperties(PropertyBindingFlags).ToDictionary(property => property.Name, property => property); + + foreach (var sourcePropertyElement in sourceModelProperties) + { + var propertyName = sourcePropertyElement.Key; + var sourcePropertyValue = sourcePropertyElement.Value.CanRead ? sourcePropertyElement.Value.GetValue(sourceModel) : null; + + if (targetModelProperties.ContainsKey(propertyName) && (sourcePropertyValue is null) == false) + { + var targetProperty = targetModelProperties[propertyName]; + var sourcePropertyValueType = sourcePropertyValue.GetType(); + + if (targetProperty.CanWrite && targetProperty.PropertyType == sourcePropertyValueType) + { + targetProperty.SetValue(targetModel, sourcePropertyValue); + } + } + } + } + + /// + /// Represents binding flags that are used to find public instance properties of a model. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private const BindingFlags PropertyBindingFlags = BindingFlags.Instance | BindingFlags.Public; + } + + /// + /// Represents an object that models an Entity Framework entity. + /// + /// + /// The type of the value that uniquely identifies the model. + /// + [DataContract] + public abstract class EntityFrameworkDataAccessModel : EntityFrameworkDataAccessModel, IDataAccessModel + where TIdentifier : IComparable, IComparable, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkDataAccessModel() + : this(default) + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of + /// . + /// + protected EntityFrameworkDataAccessModel(TIdentifier identifier) + : base() + { + Identifier = identifier; + } + + /// + /// Determines whether or not two specified instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified instance is less than another + /// specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified instance is less than or equal to + /// another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkDataAccessModel a, IDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater than another + /// specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater than or equal to + /// another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object and returns an + /// indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IDataAccessModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is equal to the + /// specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + + /// + /// Converts the value of the current to its equivalent string + /// representation. + /// + /// + /// A string representation of the current . + /// + public override String ToString() => $"{{ \"{nameof(Identifier)}\": \"{Identifier}\" }}"; + + /// + /// Gets or sets a value that uniquely identifies the current . + /// + [Column(Order = 0)] + [DataMember] + [Key] + public TIdentifier Identifier + { + get; + set; + } + } + + /// + /// Represents an object that models an Entity Framework entity. + /// + [DataContract] + public abstract class EntityFrameworkDataAccessModel : Model, IDataAccessModel + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkDataAccessModel() + : base() + { + return; + } + + /// + /// Determines whether or not two specified instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkDataAccessModel a, IDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkDataAccessModel a, IDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not the current is equal to the specified + /// . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public Boolean Equals(IDataAccessModel other) + { + if ((Object)other is null) + { + return false; + } + else if (GetHashCode() != other.GetHashCode()) + { + return false; + } + + return true; + } + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } +} \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkGlobalIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkGlobalIdentityDataAccessModel.cs new file mode 100644 index 00000000..2538b55c --- /dev/null +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkGlobalIdentityDataAccessModel.cs @@ -0,0 +1,366 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using RapidField.SolidInstruments.Core.Domain; +using System; +using System.Runtime.Serialization; + +namespace RapidField.SolidInstruments.DataAccess.EntityFramework +{ + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a value. + /// + /// + /// The type of the domain model to which the data access model is mapped. + /// + [DataContract] + public abstract class EntityFrameworkGlobalIdentityDataAccessModel : EntityFrameworkDataAccessModel, IGlobalIdentityDataAccessModel + where TDomainModel : class, IGlobalIdentityDomainModel, new() + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkGlobalIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkGlobalIdentityDataAccessModel(Guid identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified + /// instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified instance + /// is less than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified instance + /// is less than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified + /// instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object + /// and returns an indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is equal + /// to the specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } + + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a value. + /// + [DataContract] + public abstract class EntityFrameworkGlobalIdentityDataAccessModel : EntityFrameworkDataAccessModel, IGlobalIdentityDataAccessModel + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkGlobalIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkGlobalIdentityDataAccessModel(Guid identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkGlobalIdentityDataAccessModel a, IDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified instance is less than + /// another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified instance is less than + /// or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkGlobalIdentityDataAccessModel a, IDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkGlobalIdentityDataAccessModel a, EntityFrameworkGlobalIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object and returns an + /// indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is equal to the + /// specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public Boolean Equals(IGlobalIdentityDataAccessModel other) + { + if ((Object)other is null) + { + return false; + } + else if (GetHashCode() != other.GetHashCode()) + { + return false; + } + + return true; + } + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } +} \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkNumericIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkNumericIdentityDataAccessModel.cs new file mode 100644 index 00000000..706e19c7 --- /dev/null +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkNumericIdentityDataAccessModel.cs @@ -0,0 +1,368 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using RapidField.SolidInstruments.Core.Domain; +using System; +using System.Runtime.Serialization; + +namespace RapidField.SolidInstruments.DataAccess.EntityFramework +{ + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a + /// value. + /// + /// + /// The type of the domain model to which the data access model is mapped. + /// + [DataContract] + public abstract class EntityFrameworkNumericIdentityDataAccessModel : EntityFrameworkDataAccessModel, INumericIdentityDataAccessModel + where TDomainModel : class, INumericIdentityDomainModel, new() + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkNumericIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkNumericIdentityDataAccessModel(Int64 identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified + /// instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified + /// instance is less than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified + /// instance is less than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified + /// instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object + /// and returns an indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is + /// equal to the specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } + + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a + /// value. + /// + [DataContract] + public abstract class EntityFrameworkNumericIdentityDataAccessModel : EntityFrameworkDataAccessModel, INumericIdentityDataAccessModel + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkNumericIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkNumericIdentityDataAccessModel(Int64 identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkNumericIdentityDataAccessModel a, IDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified instance is less than + /// another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified instance is less than + /// or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkNumericIdentityDataAccessModel a, IDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkNumericIdentityDataAccessModel a, EntityFrameworkNumericIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object and returns an + /// indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is equal to the + /// specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public Boolean Equals(INumericIdentityDataAccessModel other) + { + if ((Object)other is null) + { + return false; + } + else if (GetHashCode() != other.GetHashCode()) + { + return false; + } + + return true; + } + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } +} \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkRepository.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkRepository.cs index 6c0f8f38..7d3a4aba 100644 --- a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkRepository.cs +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkRepository.cs @@ -35,7 +35,7 @@ namespace RapidField.SolidInstruments.DataAccess.EntityFramework /// public class EntityFrameworkRepository : EntityFrameworkRepository, IEntityFrameworkRepository where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() where TContext : DbContext { diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkSemanticIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkSemanticIdentityDataAccessModel.cs new file mode 100644 index 00000000..3ce13d45 --- /dev/null +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/EntityFrameworkSemanticIdentityDataAccessModel.cs @@ -0,0 +1,368 @@ +// ================================================================================================================================= +// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. +// ================================================================================================================================= + +using RapidField.SolidInstruments.Core; +using RapidField.SolidInstruments.Core.Domain; +using System; +using System.Runtime.Serialization; + +namespace RapidField.SolidInstruments.DataAccess.EntityFramework +{ + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a + /// value. + /// + /// + /// The type of the domain model to which the data access model is mapped. + /// + [DataContract] + public abstract class EntityFrameworkSemanticIdentityDataAccessModel : EntityFrameworkDataAccessModel, ISemanticIdentityDataAccessModel + where TDomainModel : class, ISemanticIdentityDomainModel, new() + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkSemanticIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkSemanticIdentityDataAccessModel(String identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified + /// instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified + /// instance is less than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified + /// instance is less than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified + /// instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object + /// and returns an indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is + /// equal to the specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } + + /// + /// Represents an object that models an Entity Framework entity and that is identified primarily by a + /// value. + /// + [DataContract] + public abstract class EntityFrameworkSemanticIdentityDataAccessModel : EntityFrameworkDataAccessModel, ISemanticIdentityDataAccessModel + { + /// + /// Initializes a new instance of the class. + /// + protected EntityFrameworkSemanticIdentityDataAccessModel() + : base() + { + return; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// A value that uniquely identifies the model. The default value is equal to the default instance of . + /// + protected EntityFrameworkSemanticIdentityDataAccessModel(String identifier) + : base(identifier) + { + return; + } + + /// + /// Determines whether or not two specified instances are not equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are not equal. + /// + public static Boolean operator !=(EntityFrameworkSemanticIdentityDataAccessModel a, IDataAccessModel b) => a == b == false; + + /// + /// Determines whether or not a specified instance is less + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than the first object, otherwise . + /// + public static Boolean operator <(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null ? b is Object : a.CompareTo(b) < 0; + + /// + /// Determines whether or not a specified instance is less + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is earlier than or equal to the first object, otherwise + /// . + /// + public static Boolean operator <=(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null || a.CompareTo(b) <= 0; + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public static Boolean operator ==(EntityFrameworkSemanticIdentityDataAccessModel a, IDataAccessModel b) + { + if (a is null && b is null) + { + return true; + } + else if (a is null || b is null) + { + return false; + } + + return a.Equals(b); + } + + /// + /// Determines whether or not a specified instance is greater + /// than another specified instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than the first object, otherwise . + /// + public static Boolean operator >(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is Object && a.CompareTo(b) > 0; + + /// + /// Determines whether or not a specified instance is greater + /// than or equal to another supplied instance. + /// + /// + /// The first instance to compare. + /// + /// + /// The second instance to compare. + /// + /// + /// if the second object is later than or equal to the first object, otherwise + /// . + /// + public static Boolean operator >=(EntityFrameworkSemanticIdentityDataAccessModel a, EntityFrameworkSemanticIdentityDataAccessModel b) => a is null ? b is null : a.CompareTo(b) >= 0; + + /// + /// Compares the current to the specified object and returns + /// an indication of their relative values. + /// + /// + /// The to compare to this instance. + /// + /// + /// Negative one if this instance is earlier than the specified instance; one if this instance is later than the supplied + /// instance; zero if they are equal. + /// + public Int32 CompareTo(IModel other) => Identifier.CompareTo(other.Identifier); + + /// + /// Determines whether or not the current is equal to the + /// specified . + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public override Boolean Equals(Object obj) => base.Equals(obj); + + /// + /// Determines whether or not two specified instances are equal. + /// + /// + /// The to compare to this instance. + /// + /// + /// A value indicating whether or not the specified instances are equal. + /// + public Boolean Equals(ISemanticIdentityDataAccessModel other) + { + if ((Object)other is null) + { + return false; + } + else if (GetHashCode() != other.GetHashCode()) + { + return false; + } + + return true; + } + + /// + /// Returns the hash code for this instance. + /// + /// + /// A 32-bit signed integer hash code. + /// + public override Int32 GetHashCode() => base.GetHashCode(); + } +} \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/IEntityFrameworkRepository.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/IEntityFrameworkRepository.cs index 7a20fb02..b7e4760e 100644 --- a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/IEntityFrameworkRepository.cs +++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/IEntityFrameworkRepository.cs @@ -25,7 +25,7 @@ namespace RapidField.SolidInstruments.DataAccess.EntityFramework /// public interface IEntityFrameworkRepository : IEntityFrameworkRepository, IDomainModelRepository where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() where TContext : DbContext { diff --git a/src/RapidField.SolidInstruments.DataAccess/CreateDomainModelCommandHandler.cs b/src/RapidField.SolidInstruments.DataAccess/CreateDomainModelCommandHandler.cs index 818128fd..af459f5f 100644 --- a/src/RapidField.SolidInstruments.DataAccess/CreateDomainModelCommandHandler.cs +++ b/src/RapidField.SolidInstruments.DataAccess/CreateDomainModelCommandHandler.cs @@ -27,7 +27,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public class CreateDomainModelCommandHandler : CreateDomainModelCommandHandler where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() where TCommand : class, ICreateDomainModelCommand { @@ -70,7 +70,7 @@ protected override void CreateDomainModel(TDomainModel model, IEnumerable(dataAccessModel); - mediator.Process(dataAccessModelCommand); + _ = mediator.Process(dataAccessModelCommand); } /// diff --git a/src/RapidField.SolidInstruments.DataAccess/DeleteDomainModelCommandHandler.cs b/src/RapidField.SolidInstruments.DataAccess/DeleteDomainModelCommandHandler.cs index fcb957f9..33cc5f60 100644 --- a/src/RapidField.SolidInstruments.DataAccess/DeleteDomainModelCommandHandler.cs +++ b/src/RapidField.SolidInstruments.DataAccess/DeleteDomainModelCommandHandler.cs @@ -27,7 +27,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public class DeleteDomainModelCommandHandler : DeleteDomainModelCommandHandler where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() where TCommand : class, IDeleteDomainModelCommand { @@ -68,7 +68,7 @@ public DeleteDomainModelCommandHandler(ICommandMediator mediator) protected override void DeleteDomainModel(TDomainModel model, IEnumerable labels, Guid correlationIdentifier, ICommandMediator mediator, IConcurrencyControlToken controlToken) { var dataAccessModelCommand = new DeleteDataAccessModelCommand(model.Identifier); - mediator.Process(dataAccessModelCommand); + _ = mediator.Process(dataAccessModelCommand); } /// diff --git a/src/RapidField.SolidInstruments.DataAccess/IAggregateDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IAggregateDataAccessModel.cs index 2711499a..fcf63e03 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IAggregateDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IAggregateDataAccessModel.cs @@ -18,7 +18,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public interface IAggregateDataAccessModel : IAggregateDataAccessModel, IValueDataAccessModel where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/IDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IDataAccessModel.cs index 87e3d6a0..c33492db 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IDataAccessModel.cs @@ -18,7 +18,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public interface IDataAccessModel : IDataAccessModel where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() { /// /// Copies the state of the specified domain model to the current diff --git a/src/RapidField.SolidInstruments.DataAccess/IDomainModelRepository.cs b/src/RapidField.SolidInstruments.DataAccess/IDomainModelRepository.cs index c409192f..c97e651c 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IDomainModelRepository.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IDomainModelRepository.cs @@ -25,7 +25,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public interface IDomainModelRepository : IDataAccessModelRepository, IReadOnlyDomainModelRepository where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() { /// @@ -223,7 +223,7 @@ public interface IDomainModelRepository : IDataAccessModelRepository [DebuggerHidden] internal static TDataAccessModel ConvertToDataAccessModel(TDomainModel domainModel) where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() { _ = domainModel.RejectIf().IsNull(nameof(domainModel)); @@ -269,7 +269,7 @@ internal static TDataAccessModel ConvertToDataAccessModel(TDataAccessModel dataAccessModel) where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() { try diff --git a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityAggregateDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityAggregateDataAccessModel.cs index e77f3cbf..9b8c8205 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityAggregateDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityAggregateDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface IGlobalIdentityAggregateDataAccessModel : IGlobalIdentityAggregateDataAccessModel, IAggregateDataAccessModel - where TDomainModel : class, IGlobalIdentityAggregateDomainModel + where TDomainModel : class, IGlobalIdentityAggregateDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityDataAccessModel.cs index 26700fe8..64c448f5 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface IGlobalIdentityDataAccessModel : IGlobalIdentityDataAccessModel, IDataAccessModel - where TDomainModel : class, IGlobalIdentityDomainModel + where TDomainModel : class, IGlobalIdentityDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityValueDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityValueDataAccessModel.cs index 1ccbddae..2a7fd4cd 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityValueDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IGlobalIdentityValueDataAccessModel.cs @@ -14,7 +14,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface IGlobalIdentityValueDataAccessModel : IGlobalIdentityValueDataAccessModel, IValueDataAccessModel - where TDomainModel : class, IGlobalIdentityValueDomainModel + where TDomainModel : class, IGlobalIdentityValueDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityAggregateDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityAggregateDataAccessModel.cs index cdfddddb..34f09e79 100644 --- a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityAggregateDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityAggregateDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface INumericIdentityAggregateDataAccessModel : INumericIdentityAggregateDataAccessModel, IAggregateDataAccessModel - where TDomainModel : class, INumericIdentityAggregateDomainModel + where TDomainModel : class, INumericIdentityAggregateDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityDataAccessModel.cs index a094037d..744410c3 100644 --- a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface INumericIdentityDataAccessModel : INumericIdentityDataAccessModel, IDataAccessModel - where TDomainModel : class, INumericIdentityDomainModel + where TDomainModel : class, INumericIdentityDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityValueDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityValueDataAccessModel.cs index ab394f73..3d202229 100644 --- a/src/RapidField.SolidInstruments.DataAccess/INumericIdentityValueDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/INumericIdentityValueDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface INumericIdentityValueDataAccessModel : IGlobalIdentityValueDataAccessModel, IValueDataAccessModel - where TDomainModel : class, INumericIdentityValueDomainModel + where TDomainModel : class, INumericIdentityValueDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/IReadOnlyDomainModelRepository.cs b/src/RapidField.SolidInstruments.DataAccess/IReadOnlyDomainModelRepository.cs index b30c4d3f..2247fe2e 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IReadOnlyDomainModelRepository.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IReadOnlyDomainModelRepository.cs @@ -25,7 +25,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public interface IReadOnlyDomainModelRepository : IDomainModelRepository, IReadOnlyDataAccessModelRepository where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() { /// diff --git a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityAggregateDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityAggregateDataAccessModel.cs index 80142a5b..fd09779e 100644 --- a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityAggregateDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityAggregateDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface ISemanticIdentityAggregateDataAccessModel : ISemanticIdentityAggregateDataAccessModel, IAggregateDataAccessModel - where TDomainModel : class, ISemanticIdentityAggregateDomainModel + where TDomainModel : class, ISemanticIdentityAggregateDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityDataAccessModel.cs index 57e1b233..df972b54 100644 --- a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface ISemanticIdentityDataAccessModel : ISemanticIdentityDataAccessModel, IDataAccessModel - where TDomainModel : class, ISemanticIdentityDomainModel + where TDomainModel : class, ISemanticIdentityDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityValueDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityValueDataAccessModel.cs index 5e4090d3..05a53a97 100644 --- a/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityValueDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/ISemanticIdentityValueDataAccessModel.cs @@ -15,7 +15,7 @@ namespace RapidField.SolidInstruments.DataAccess /// The type of the domain model to which the data access model is mapped. /// public interface ISemanticIdentityValueDataAccessModel : IGlobalIdentityValueDataAccessModel, IValueDataAccessModel - where TDomainModel : class, ISemanticIdentityValueDomainModel + where TDomainModel : class, ISemanticIdentityValueDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/IValueDataAccessModel.cs b/src/RapidField.SolidInstruments.DataAccess/IValueDataAccessModel.cs index 2c460a27..22ee8702 100644 --- a/src/RapidField.SolidInstruments.DataAccess/IValueDataAccessModel.cs +++ b/src/RapidField.SolidInstruments.DataAccess/IValueDataAccessModel.cs @@ -18,7 +18,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public interface IValueDataAccessModel : IValueDataAccessModel, IDataAccessModel where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() { } diff --git a/src/RapidField.SolidInstruments.DataAccess/ReadOnlyDataAccessRepository.cs b/src/RapidField.SolidInstruments.DataAccess/ReadOnlyDataAccessRepository.cs index 90c013c6..6dbf26f5 100644 --- a/src/RapidField.SolidInstruments.DataAccess/ReadOnlyDataAccessRepository.cs +++ b/src/RapidField.SolidInstruments.DataAccess/ReadOnlyDataAccessRepository.cs @@ -61,7 +61,7 @@ public IQueryable All() /// /// The object is disposed. /// - public Boolean Any() => (Count() > 0); + public Boolean Any() => Count() > 0; /// /// Determines whether or not the specified entity exists in the current diff --git a/src/RapidField.SolidInstruments.DataAccess/UpdateDomainModelCommandHandler.cs b/src/RapidField.SolidInstruments.DataAccess/UpdateDomainModelCommandHandler.cs index fbe9ea5c..fe1eb66d 100644 --- a/src/RapidField.SolidInstruments.DataAccess/UpdateDomainModelCommandHandler.cs +++ b/src/RapidField.SolidInstruments.DataAccess/UpdateDomainModelCommandHandler.cs @@ -27,7 +27,7 @@ namespace RapidField.SolidInstruments.DataAccess /// public class UpdateDomainModelCommandHandler : UpdateDomainModelCommandHandler where TIdentifier : IComparable, IComparable, IEquatable - where TDomainModel : class, IDomainModel + where TDomainModel : class, IDomainModel, new() where TDataAccessModel : class, IDataAccessModel, new() where TCommand : class, IUpdateDomainModelCommand { @@ -79,7 +79,7 @@ protected override void UpdateDomainModel(TDomainModel model, IEnumerable(dataAccessModel); - mediator.Process(dataAccessModelCommand); + _ = mediator.Process(dataAccessModelCommand); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.EventAuthoring/DomainEvent.cs b/src/RapidField.SolidInstruments.EventAuthoring/DomainEvent.cs index 5598bf3f..f7cf31d6 100644 --- a/src/RapidField.SolidInstruments.EventAuthoring/DomainEvent.cs +++ b/src/RapidField.SolidInstruments.EventAuthoring/DomainEvent.cs @@ -202,7 +202,7 @@ public DomainEvent(IEnumerable labels, EventVerbosity verbosity, String public DomainEvent(IEnumerable labels, EventVerbosity verbosity, String description, DateTime timeStamp) : base(StaticCategory, verbosity, description, timeStamp) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// @@ -233,7 +233,7 @@ public DomainEvent(IEnumerable labels, EventVerbosity verbosity, String public DomainEvent(IEnumerable labels, EventVerbosity verbosity, String description, DateTime timeStamp, Guid correlationIdentifier) : base(StaticCategory, verbosity, description, timeStamp, correlationIdentifier) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); } /// diff --git a/src/RapidField.SolidInstruments.EventAuthoring/Event.cs b/src/RapidField.SolidInstruments.EventAuthoring/Event.cs index c80c09bc..b435f62c 100644 --- a/src/RapidField.SolidInstruments.EventAuthoring/Event.cs +++ b/src/RapidField.SolidInstruments.EventAuthoring/Event.cs @@ -242,7 +242,7 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Event a, IEvent b) => (a == b) == false; + public static Boolean operator !=(Event a, IEvent b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified instance. @@ -256,7 +256,7 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(Event a, IEvent b) => a.CompareTo(b) == -1; + public static Boolean operator <(Event a, IEvent b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another supplied instance. @@ -271,7 +271,7 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Event a, IEvent b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Event a, IEvent b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -287,11 +287,11 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// public static Boolean operator ==(Event a, IEvent b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -311,7 +311,7 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(Event a, IEvent b) => a.CompareTo(b) == 1; + public static Boolean operator >(Event a, IEvent b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another supplied @@ -327,7 +327,7 @@ public Event(EventCategory category, EventVerbosity verbosity, String descriptio /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Event a, IEvent b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Event a, IEvent b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Compares the current to the specified object and returns an indication of their relative values. diff --git a/src/RapidField.SolidInstruments.EventAuthoring/GeneralInformationEvent.cs b/src/RapidField.SolidInstruments.EventAuthoring/GeneralInformationEvent.cs index 79f66c32..056b839d 100644 --- a/src/RapidField.SolidInstruments.EventAuthoring/GeneralInformationEvent.cs +++ b/src/RapidField.SolidInstruments.EventAuthoring/GeneralInformationEvent.cs @@ -202,7 +202,7 @@ public GeneralInformationEvent(IEnumerable labels, EventVerbosity verbos public GeneralInformationEvent(IEnumerable labels, EventVerbosity verbosity, String description, DateTime timeStamp) : base(StaticCategory, verbosity, description, timeStamp) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); Metadata = new Dictionary(); } @@ -234,7 +234,7 @@ public GeneralInformationEvent(IEnumerable labels, EventVerbosity verbos public GeneralInformationEvent(IEnumerable labels, EventVerbosity verbosity, String description, DateTime timeStamp, Guid correlationIdentifier) : base(StaticCategory, verbosity, description, timeStamp, correlationIdentifier) { - Labels = new List((labels.RejectIf().IsNull(nameof(labels)).TargetArgument)); + Labels = new List(labels.RejectIf().IsNull(nameof(labels)).TargetArgument); Metadata = new Dictionary(); } diff --git a/src/RapidField.SolidInstruments.InversionOfControl.Autofac/AutofacServiceInjector.cs b/src/RapidField.SolidInstruments.InversionOfControl.Autofac/AutofacServiceInjector.cs index 5c601917..f4ac67f5 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl.Autofac/AutofacServiceInjector.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl.Autofac/AutofacServiceInjector.cs @@ -49,7 +49,7 @@ protected sealed override void Inject(ContainerBuilder configurator, IServiceCol foreach (var serviceDescriptor in serviceDescriptors) { - if (serviceDescriptor.ImplementationType is null == false) + if ((serviceDescriptor.ImplementationType is null) == false) { if (serviceDescriptor.ServiceType.GetTypeInfo().IsGenericTypeDefinition) { @@ -59,7 +59,7 @@ protected sealed override void Inject(ContainerBuilder configurator, IServiceCol configurator.RegisterType(serviceDescriptor.ImplementationType).As(serviceDescriptor.ServiceType).WithLifetime(serviceDescriptor.Lifetime); } - else if (serviceDescriptor.ImplementationFactory is null == false) + else if ((serviceDescriptor.ImplementationFactory is null) == false) { configurator.RegisterComponent(RegistrationBuilder.ForDelegate(serviceDescriptor.ServiceType, (context, parameters) => serviceDescriptor.ImplementationFactory(context.Resolve())).WithLifetime(serviceDescriptor.Lifetime).CreateRegistration()); } diff --git a/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs b/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs index 8277547a..dec6edcc 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs @@ -414,7 +414,7 @@ internal static TEngine New(IConfiguration app var engine = package.CreateEngine(applicationConfiguration.RejectIf().IsNull(nameof(applicationConfiguration)).TargetArgument, serviceDescriptors); var abstractEngine = engine as DependencyEngine; - if (abstractEngine is null == false) + if ((abstractEngine is null) == false) { abstractEngine.Start(); } diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DecimalOverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DecimalOverDateTimeLineSeries.cs index 89cea02e..74c47069 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DecimalOverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DecimalOverDateTimeLineSeries.cs @@ -58,10 +58,10 @@ public DecimalOverDateTimeLineSeries(IDictionary data) /// protected sealed override Decimal InterpolateLinear(DateTime xAxisValue, DateTime downwardXAxisValue, Decimal downwardYAxisValue, DateTime upwardXAxisValue, Decimal upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToDecimal(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Decimal InterpolateLinear(DateTime xAxisValue, DateTim protected sealed override Decimal InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Decimal downwardYAxisValue, DateTime upwardXAxisValue, Decimal upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DoubleOverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DoubleOverDateTimeLineSeries.cs index 86ffe06d..4912c200 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DoubleOverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/DoubleOverDateTimeLineSeries.cs @@ -58,10 +58,10 @@ public DoubleOverDateTimeLineSeries(IDictionary data) /// protected sealed override Double InterpolateLinear(DateTime xAxisValue, DateTime downwardXAxisValue, Double downwardYAxisValue, DateTime upwardXAxisValue, Double upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Double InterpolateLinear(DateTime xAxisValue, DateTime protected sealed override Double InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Double downwardYAxisValue, DateTime upwardXAxisValue, Double upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int16OverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int16OverDateTimeLineSeries.cs index cb5214c7..4f9febcc 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int16OverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int16OverDateTimeLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int16 InterpolateLinear(DateTime xAxisValue, DateTime { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt16((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int16 InterpolateLinear(DateTime xAxisValue, DateTime protected sealed override Int16 InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Int16 downwardYAxisValue, DateTime upwardXAxisValue, Int16 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int32OverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int32OverDateTimeLineSeries.cs index 83ace9f6..ea9857aa 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int32OverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int32OverDateTimeLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int32 InterpolateLinear(DateTime xAxisValue, DateTime { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt32((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int32 InterpolateLinear(DateTime xAxisValue, DateTime protected sealed override Int32 InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Int32 downwardYAxisValue, DateTime upwardXAxisValue, Int32 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int64OverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int64OverDateTimeLineSeries.cs index b32395ae..46ae7585 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int64OverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/Int64OverDateTimeLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int64 InterpolateLinear(DateTime xAxisValue, DateTime { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt64((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int64 InterpolateLinear(DateTime xAxisValue, DateTime protected sealed override Int64 InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Int64 downwardYAxisValue, DateTime upwardXAxisValue, Int64 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/SingleOverDateTimeLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/SingleOverDateTimeLineSeries.cs index 2f8df8e2..7e86b45b 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/SingleOverDateTimeLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/DateTimeScale/SingleOverDateTimeLineSeries.cs @@ -58,10 +58,10 @@ public SingleOverDateTimeLineSeries(IDictionary data) /// protected sealed override Single InterpolateLinear(DateTime xAxisValue, DateTime downwardXAxisValue, Single downwardYAxisValue, DateTime upwardXAxisValue, Single upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToSingle(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Single InterpolateLinear(DateTime xAxisValue, DateTime protected sealed override Single InterpolateNearest(DateTime xAxisValue, DateTime downwardXAxisValue, Single downwardYAxisValue, DateTime upwardXAxisValue, Single upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DecimalOverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DecimalOverInt32LineSeries.cs index 5a0a2049..50d7a0ea 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DecimalOverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DecimalOverInt32LineSeries.cs @@ -58,10 +58,10 @@ public DecimalOverInt32LineSeries(IDictionary data) /// protected sealed override Decimal InterpolateLinear(Int32 xAxisValue, Int32 downwardXAxisValue, Decimal downwardYAxisValue, Int32 upwardXAxisValue, Decimal upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToDecimal(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Decimal InterpolateLinear(Int32 xAxisValue, Int32 down protected sealed override Decimal InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Decimal downwardYAxisValue, Int32 upwardXAxisValue, Decimal upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DoubleOverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DoubleOverInt32LineSeries.cs index 9e14322b..30bf7f33 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DoubleOverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/DoubleOverInt32LineSeries.cs @@ -59,10 +59,10 @@ public DoubleOverInt32LineSeries(IDictionary data) /// protected sealed override Double InterpolateLinear(Int32 xAxisValue, Int32 downwardXAxisValue, Double downwardYAxisValue, Int32 upwardXAxisValue, Double upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -89,7 +89,7 @@ protected sealed override Double InterpolateLinear(Int32 xAxisValue, Int32 downw protected sealed override Double InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Double downwardYAxisValue, Int32 upwardXAxisValue, Double upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int16OverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int16OverInt32LineSeries.cs index 79ef66c0..25740e68 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int16OverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int16OverInt32LineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int16 InterpolateLinear(Int32 xAxisValue, Int32 downwa { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt16((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int16 InterpolateLinear(Int32 xAxisValue, Int32 downwa protected sealed override Int16 InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Int16 downwardYAxisValue, Int32 upwardXAxisValue, Int16 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int32OverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int32OverInt32LineSeries.cs index b66fba62..d9f3bb1d 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int32OverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int32OverInt32LineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int32 InterpolateLinear(Int32 xAxisValue, Int32 downwa { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt32((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int32 InterpolateLinear(Int32 xAxisValue, Int32 downwa protected sealed override Int32 InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Int32 downwardYAxisValue, Int32 upwardXAxisValue, Int32 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int64OverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int64OverInt32LineSeries.cs index 3186a8a5..bd4dee69 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int64OverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/Int64OverInt32LineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int64 InterpolateLinear(Int32 xAxisValue, Int32 downwa { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt64((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int64 InterpolateLinear(Int32 xAxisValue, Int32 downwa protected sealed override Int64 InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Int64 downwardYAxisValue, Int32 upwardXAxisValue, Int64 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/SingleOverInt32LineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/SingleOverInt32LineSeries.cs index b33053ac..d4fbd9d0 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/SingleOverInt32LineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/IntegerScale/SingleOverInt32LineSeries.cs @@ -59,10 +59,10 @@ public SingleOverInt32LineSeries(IDictionary data) /// protected sealed override Single InterpolateLinear(Int32 xAxisValue, Int32 downwardXAxisValue, Single downwardYAxisValue, Int32 upwardXAxisValue, Single upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToSingle(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -89,7 +89,7 @@ protected sealed override Single InterpolateLinear(Int32 xAxisValue, Int32 downw protected sealed override Single InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Single downwardYAxisValue, Int32 upwardXAxisValue, Single upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DecimalOverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DecimalOverDoubleLineSeries.cs index d4e4164f..f71f6144 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DecimalOverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DecimalOverDoubleLineSeries.cs @@ -58,10 +58,10 @@ public DecimalOverDoubleLineSeries(IDictionary data) /// protected sealed override Decimal InterpolateLinear(Double xAxisValue, Double downwardXAxisValue, Decimal downwardYAxisValue, Double upwardXAxisValue, Decimal upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToDecimal(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Decimal InterpolateLinear(Double xAxisValue, Double do protected sealed override Decimal InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Decimal downwardYAxisValue, Double upwardXAxisValue, Decimal upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DoubleOverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DoubleOverDoubleLineSeries.cs index 2605da42..47c7af67 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DoubleOverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/DoubleOverDoubleLineSeries.cs @@ -59,10 +59,10 @@ public DoubleOverDoubleLineSeries(IDictionary data) /// protected sealed override Double InterpolateLinear(Double xAxisValue, Double downwardXAxisValue, Double downwardYAxisValue, Double upwardXAxisValue, Double upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -89,7 +89,7 @@ protected sealed override Double InterpolateLinear(Double xAxisValue, Double dow protected sealed override Double InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Double downwardYAxisValue, Double upwardXAxisValue, Double upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int16OverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int16OverDoubleLineSeries.cs index aa904311..76408ae7 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int16OverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int16OverDoubleLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int16 InterpolateLinear(Double xAxisValue, Double down { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt16((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int16 InterpolateLinear(Double xAxisValue, Double down protected sealed override Int16 InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Int16 downwardYAxisValue, Double upwardXAxisValue, Int16 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int32OverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int32OverDoubleLineSeries.cs index ee275333..e5d4660d 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int32OverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int32OverDoubleLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int32 InterpolateLinear(Double xAxisValue, Double down { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt32((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int32 InterpolateLinear(Double xAxisValue, Double down protected sealed override Int32 InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Int32 downwardYAxisValue, Double upwardXAxisValue, Int32 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int64OverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int64OverDoubleLineSeries.cs index 944d89b8..4e6fe9ef 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int64OverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/Int64OverDoubleLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int64 InterpolateLinear(Double xAxisValue, Double down { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt64((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int64 InterpolateLinear(Double xAxisValue, Double down protected sealed override Int64 InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Int64 downwardYAxisValue, Double upwardXAxisValue, Int64 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/SingleOverDoubleLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/SingleOverDoubleLineSeries.cs index 106e3317..0b082679 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/SingleOverDoubleLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/RationalScale/SingleOverDoubleLineSeries.cs @@ -59,10 +59,10 @@ public SingleOverDoubleLineSeries(IDictionary data) /// protected sealed override Single InterpolateLinear(Double xAxisValue, Double downwardXAxisValue, Single downwardYAxisValue, Double upwardXAxisValue, Single upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToSingle(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -89,7 +89,7 @@ protected sealed override Single InterpolateLinear(Double xAxisValue, Double dow protected sealed override Single InterpolateNearest(Double xAxisValue, Double downwardXAxisValue, Single downwardYAxisValue, Double upwardXAxisValue, Single upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DecimalOverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DecimalOverTimeSpanLineSeries.cs index 7aa28f4b..5b250eb1 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DecimalOverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DecimalOverTimeSpanLineSeries.cs @@ -58,10 +58,10 @@ public DecimalOverTimeSpanLineSeries(IDictionary data) /// protected sealed override Decimal InterpolateLinear(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Decimal downwardYAxisValue, TimeSpan upwardXAxisValue, Decimal upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToDecimal(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Decimal InterpolateLinear(TimeSpan xAxisValue, TimeSpa protected sealed override Decimal InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Decimal downwardYAxisValue, TimeSpan upwardXAxisValue, Decimal upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DoubleOverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DoubleOverTimeSpanLineSeries.cs index 35b4c33b..948b9ea9 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DoubleOverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/DoubleOverTimeSpanLineSeries.cs @@ -58,10 +58,10 @@ public DoubleOverTimeSpanLineSeries(IDictionary data) /// protected sealed override Double InterpolateLinear(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Double downwardYAxisValue, TimeSpan upwardXAxisValue, Double upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Double InterpolateLinear(TimeSpan xAxisValue, TimeSpan protected sealed override Double InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Double downwardYAxisValue, TimeSpan upwardXAxisValue, Double upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int16OverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int16OverTimeSpanLineSeries.cs index eb1e3af0..2407f352 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int16OverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int16OverTimeSpanLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int16 InterpolateLinear(TimeSpan xAxisValue, TimeSpan { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt16((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int16 InterpolateLinear(TimeSpan xAxisValue, TimeSpan protected sealed override Int16 InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Int16 downwardYAxisValue, TimeSpan upwardXAxisValue, Int16 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int32OverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int32OverTimeSpanLineSeries.cs index 5d0e3947..b6abec41 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int32OverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int32OverTimeSpanLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int32 InterpolateLinear(TimeSpan xAxisValue, TimeSpan { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt32((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int32 InterpolateLinear(TimeSpan xAxisValue, TimeSpan protected sealed override Int32 InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Int32 downwardYAxisValue, TimeSpan upwardXAxisValue, Int32 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int64OverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int64OverTimeSpanLineSeries.cs index 151038e3..fe1221d6 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int64OverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/Int64OverTimeSpanLineSeries.cs @@ -61,7 +61,7 @@ protected sealed override Int64 InterpolateLinear(TimeSpan xAxisValue, TimeSpan { var yAxisRange = Convert.ToDouble(upwardYAxisValue - downwardYAxisValue); var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - var adjustment = (yAxisRange * positionInXAxisRange); + var adjustment = yAxisRange * positionInXAxisRange; return Convert.ToInt64((Convert.ToDouble(downwardYAxisValue) + adjustment).RoundedTo(0, MidpointRounding.AwayFromZero)); } @@ -89,7 +89,7 @@ protected sealed override Int64 InterpolateLinear(TimeSpan xAxisValue, TimeSpan protected sealed override Int64 InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Int64 downwardYAxisValue, TimeSpan upwardXAxisValue, Int64 upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/SingleOverTimeSpanLineSeries.cs b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/SingleOverTimeSpanLineSeries.cs index 846e8cca..fbf2f480 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/SingleOverTimeSpanLineSeries.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Data/TimeScale/SingleOverTimeSpanLineSeries.cs @@ -58,10 +58,10 @@ public SingleOverTimeSpanLineSeries(IDictionary data) /// protected sealed override Single InterpolateLinear(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Single downwardYAxisValue, TimeSpan upwardXAxisValue, Single upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToSingle(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Single InterpolateLinear(TimeSpan xAxisValue, TimeSpan protected sealed override Single InterpolateNearest(TimeSpan xAxisValue, TimeSpan downwardXAxisValue, Single downwardYAxisValue, TimeSpan upwardXAxisValue, Single upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/DateTimeExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/DateTimeExtensions.cs index a3719a8e..54752a68 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/DateTimeExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/DateTimeExtensions.cs @@ -38,7 +38,7 @@ public static Double PositionInRange(this DateTime target, DateTime lowerBoundar target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble((target - lowerBoundary).Ticks) / Convert.ToDouble((upperBoundary - lowerBoundary).Ticks)); + return Convert.ToDouble((target - lowerBoundary).Ticks) / Convert.ToDouble((upperBoundary - lowerBoundary).Ticks); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/DecimalExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/DecimalExtensions.cs index 40c1b7b8..cd2d27bd 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/DecimalExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/DecimalExtensions.cs @@ -49,7 +49,7 @@ public static Double PositionInRange(this Decimal target, Decimal lowerBoundary, target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/DoubleExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/DoubleExtensions.cs index e199cf0a..753bd4cf 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/DoubleExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/DoubleExtensions.cs @@ -49,7 +49,7 @@ public static Double PositionInRange(this Double target, Double lowerBoundary, D target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return ((target - lowerBoundary) / (upperBoundary - lowerBoundary)); + return (target - lowerBoundary) / (upperBoundary - lowerBoundary); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/IntegerExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/IntegerExtensions.cs index 48992d7e..1640809b 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/IntegerExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/IntegerExtensions.cs @@ -395,7 +395,7 @@ public static Double PositionInRange(this Int16 target, Int16 lowerBoundary, Int target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -424,7 +424,7 @@ public static Double PositionInRange(this Int32 target, Int32 lowerBoundary, Int target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -453,7 +453,7 @@ public static Double PositionInRange(this Int64 target, Int64 lowerBoundary, Int target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -482,7 +482,7 @@ public static Double PositionInRange(this UInt16 target, UInt16 lowerBoundary, U target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -511,7 +511,7 @@ public static Double PositionInRange(this UInt32 target, UInt32 lowerBoundary, U target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -540,7 +540,7 @@ public static Double PositionInRange(this UInt64 target, UInt64 lowerBoundary, U target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } /// @@ -565,9 +565,9 @@ public static Int16 RoundedToFactor(this Int16 target, Int16 factor, FactorRound return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToInt16(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOrOutward => Convert.ToInt16(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), FactorRoundingMode.InwardOnly => Convert.ToInt16(target - (target % factor)), - FactorRoundingMode.OutwardOnly => Convert.ToInt16((target % factor == 0) ? target : ((factor - (target % factor)) + target)), + FactorRoundingMode.OutwardOnly => Convert.ToInt16((target % factor == 0) ? target : (factor - (target % factor) + target)), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -594,9 +594,9 @@ public static UInt16 RoundedToFactor(this UInt16 target, UInt16 factor, FactorRo return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToUInt16(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOrOutward => Convert.ToUInt16(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), FactorRoundingMode.InwardOnly => Convert.ToUInt16(target - (target % factor)), - FactorRoundingMode.OutwardOnly => Convert.ToUInt16((target % factor == 0) ? target : ((factor - (target % factor)) + target)), + FactorRoundingMode.OutwardOnly => Convert.ToUInt16((target % factor == 0) ? target : (factor - (target % factor) + target)), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -623,9 +623,9 @@ public static Int32 RoundedToFactor(this Int32 target, Int32 factor, FactorRound return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToInt32(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), - FactorRoundingMode.InwardOnly => (target - (target % factor)), - FactorRoundingMode.OutwardOnly => ((target % factor == 0) ? target : ((factor - (target % factor)) + target)), + FactorRoundingMode.InwardOrOutward => Convert.ToInt32(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOnly => target - (target % factor), + FactorRoundingMode.OutwardOnly => (target % factor == 0) ? target : (factor - (target % factor) + target), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -652,9 +652,9 @@ public static UInt32 RoundedToFactor(this UInt32 target, UInt32 factor, FactorRo return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToUInt32(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), - FactorRoundingMode.InwardOnly => (target - (target % factor)), - FactorRoundingMode.OutwardOnly => (target % factor == 0) ? target : ((factor - (target % factor)) + target), + FactorRoundingMode.InwardOrOutward => Convert.ToUInt32(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOnly => target - (target % factor), + FactorRoundingMode.OutwardOnly => (target % factor == 0) ? target : (factor - (target % factor) + target), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -681,9 +681,9 @@ public static Int64 RoundedToFactor(this Int64 target, Int64 factor, FactorRound return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToInt64(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOrOutward => Convert.ToInt64(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), FactorRoundingMode.InwardOnly => Convert.ToInt64(target - (target % factor)), - FactorRoundingMode.OutwardOnly => Convert.ToInt64((target % factor == 0) ? target : ((factor - (target % factor)) + target)), + FactorRoundingMode.OutwardOnly => Convert.ToInt64((target % factor == 0) ? target : (factor - (target % factor) + target)), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -710,9 +710,9 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo return mode switch { - FactorRoundingMode.InwardOrOutward => Convert.ToUInt64(Math.Round((target / Convert.ToDouble(factor)), MidpointRounding.AwayFromZero) * factor), + FactorRoundingMode.InwardOrOutward => Convert.ToUInt64(Math.Round(target / Convert.ToDouble(factor), MidpointRounding.AwayFromZero) * factor), FactorRoundingMode.InwardOnly => Convert.ToUInt64(target - (target % factor)), - FactorRoundingMode.OutwardOnly => Convert.ToUInt64((target % factor == 0) ? target : ((factor - (target % factor)) + target)), + FactorRoundingMode.OutwardOnly => Convert.ToUInt64((target % factor == 0) ? target : (factor - (target % factor) + target)), _ => throw new UnsupportedSpecificationException($"The specified factor rounding mode, {mode}, is not supported.") }; } @@ -749,7 +749,7 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean SignedIntegerIsDivisibleBy(Int64 target, Int64 divisor) => ((divisor != 0) && (target % divisor == 0)); + private static Boolean SignedIntegerIsDivisibleBy(Int64 target, Int64 divisor) => (divisor != 0) && (target % divisor == 0); /// /// Indicates whether or not the provided is an even number. @@ -762,7 +762,7 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean SignedIntegerIsEven(Int64 target) => ((target & 0x01) == 0x00); + private static Boolean SignedIntegerIsEven(Int64 target) => (target & 0x01) == 0x00; /// /// Indicates whether or not the provided is an odd number. @@ -775,7 +775,7 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean SignedIntegerIsOdd(Int64 target) => ((target & 0x01) == 0x01); + private static Boolean SignedIntegerIsOdd(Int64 target) => (target & 0x01) == 0x01; /// /// Indicates whether or not the provided is a factor of the specified multiple. @@ -809,7 +809,7 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean UnsignedIntegerIsDivisibleBy(UInt64 target, UInt64 divisor) => ((divisor != 0) && (target % divisor == 0)); + private static Boolean UnsignedIntegerIsDivisibleBy(UInt64 target, UInt64 divisor) => (divisor != 0) && (target % divisor == 0); /// /// Indicates whether or not the provided is an even number. @@ -822,7 +822,7 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean UnsignedIntegerIsEven(UInt64 target) => ((target & 0x01) == 0x00); + private static Boolean UnsignedIntegerIsEven(UInt64 target) => (target & 0x01) == 0x00; /// /// Indicates whether or not the provided is an odd number. @@ -835,6 +835,6 @@ public static UInt64 RoundedToFactor(this UInt64 target, UInt64 factor, FactorRo /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Boolean UnsignedIntegerIsOdd(UInt64 target) => ((target & 0x01) == 0x01); + private static Boolean UnsignedIntegerIsOdd(UInt64 target) => (target & 0x01) == 0x01; } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/SingleExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/SingleExtensions.cs index e3bd4ac0..57fb4747 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/SingleExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/SingleExtensions.cs @@ -49,7 +49,7 @@ public static Double PositionInRange(this Single target, Single lowerBoundary, S target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary)); + return Convert.ToDouble(target - lowerBoundary) / Convert.ToDouble(upperBoundary - lowerBoundary); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Extensions/TimeSpanExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Extensions/TimeSpanExtensions.cs index 8b5a14ff..6f7bb306 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Extensions/TimeSpanExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Extensions/TimeSpanExtensions.cs @@ -38,7 +38,7 @@ public static Double PositionInRange(this TimeSpan target, TimeSpan lowerBoundar target = target.RejectIf().IsLessThan(lowerBoundary, nameof(lowerBoundary)).OrIf().IsGreaterThan(upperBoundary, nameof(upperBoundary)); lowerBoundary = lowerBoundary.RejectIf().IsGreaterThan(upperBoundary, nameof(lowerBoundary)); upperBoundary = upperBoundary.RejectIf().IsEqualToValue(lowerBoundary, nameof(upperBoundary)); - return (Convert.ToDouble((target - lowerBoundary).Ticks) / Convert.ToDouble((upperBoundary - lowerBoundary).Ticks)); + return Convert.ToDouble((target - lowerBoundary).Ticks) / Convert.ToDouble((upperBoundary - lowerBoundary).Ticks); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs index 92fe60b9..433d38e4 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs @@ -177,7 +177,7 @@ public Area(Decimal squareMeters) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Area a, Area b) => (a == b) == false; + public static Boolean operator !=(Area a, Area b) => a == b == false; /// /// Determines the product of an value and a multiplier. @@ -191,7 +191,7 @@ public Area(Decimal squareMeters) /// /// The product of the specified and the specified multiplier. /// - public static Area operator *(Area multiplicand, Double multiplier) => (multiplicand * Convert.ToDecimal(multiplier)); + public static Area operator *(Area multiplicand, Double multiplier) => multiplicand * Convert.ToDecimal(multiplier); /// /// Determines the product of an value and a multiplier. @@ -219,7 +219,7 @@ public Area(Decimal squareMeters) /// /// The quotient of the specified and the specified divisor. /// - public static Area operator /(Area dividend, Double divisor) => (dividend / Convert.ToDecimal(divisor)); + public static Area operator /(Area dividend, Double divisor) => dividend / Convert.ToDecimal(divisor); /// /// Determines the quotient of an value and a divisor. @@ -261,7 +261,7 @@ public Area(Decimal squareMeters) /// /// if the second object is less than the first object, otherwise . /// - public static Boolean operator <(Area a, Area b) => a.CompareTo(b) == -1; + public static Boolean operator <(Area a, Area b) => a.CompareTo(b) < 0; /// /// Determines whether or not a supplied instance is less than or equal to another supplied instance. @@ -276,7 +276,7 @@ public Area(Decimal squareMeters) /// if the second object is less than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Area a, Area b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Area a, Area b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -304,7 +304,7 @@ public Area(Decimal squareMeters) /// /// if the second object is greater than the first object, otherwise . /// - public static Boolean operator >(Area a, Area b) => a.CompareTo(b) == 1; + public static Boolean operator >(Area a, Area b) => a.CompareTo(b) > 0; /// /// Determines whether or not a supplied instance is greater than or equal to another supplied instance. @@ -319,7 +319,7 @@ public Area(Decimal squareMeters) /// if the second object is greater than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Area a, Area b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Area a, Area b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a area value to its equivalent. @@ -418,7 +418,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(Area other) => (SquareMeters == other.SquareMeters); + public Boolean Equals(Area other) => SquareMeters == other.SquareMeters; /// /// Returns the hash code for this instance. @@ -635,32 +635,32 @@ private static Boolean Parse(String input, out Area result, Boolean raiseExcepti /// /// Gets the value of the current expressed in acres. /// - public Decimal TotalAcres => (SquareMeters * AcresPerSquareMeter); + public Decimal TotalAcres => SquareMeters * AcresPerSquareMeter; /// /// Gets the value of the current expressed in hectares. /// - public Decimal TotalHectares => (SquareMeters * HectaresPerSquareMeter); + public Decimal TotalHectares => SquareMeters * HectaresPerSquareMeter; /// /// Gets the value of the current expressed in square centimeters. /// - public Decimal TotalSquareCentimeters => (SquareMeters * SquareCentimetersPerSquareMeter); + public Decimal TotalSquareCentimeters => SquareMeters * SquareCentimetersPerSquareMeter; /// /// Gets the value of the current expressed in square feet. /// - public Decimal TotalSquareFeet => (SquareMeters * SquareFeetPerSquareMeter); + public Decimal TotalSquareFeet => SquareMeters * SquareFeetPerSquareMeter; /// /// Gets the value of the current expressed in square inches. /// - public Decimal TotalSquareInches => (SquareMeters * SquareInchesPerSquareMeter); + public Decimal TotalSquareInches => SquareMeters * SquareInchesPerSquareMeter; /// /// Gets the value of the current expressed in square kilometers. /// - public Decimal TotalSquareKilometers => (SquareMeters * SquareKilometersPerSquareMeter); + public Decimal TotalSquareKilometers => SquareMeters * SquareKilometersPerSquareMeter; /// /// Gets the value of the current expressed in square meters. @@ -670,17 +670,17 @@ private static Boolean Parse(String input, out Area result, Boolean raiseExcepti /// /// Gets the value of the current expressed in square miles. /// - public Decimal TotalSquareMiles => (SquareMeters * SquareMilesPerSquareMeter); + public Decimal TotalSquareMiles => SquareMeters * SquareMilesPerSquareMeter; /// /// Gets the value of the current expressed in square millimeters. /// - public Decimal TotalSquareMillimeters => (SquareMeters * SquareMillimetersPerSquareMeter); + public Decimal TotalSquareMillimeters => SquareMeters * SquareMillimetersPerSquareMeter; /// /// Gets the value of the current expressed in square yards. /// - public Decimal TotalSquareYards => (SquareMeters * SquareYardsPerSquareMeter); + public Decimal TotalSquareYards => SquareMeters * SquareYardsPerSquareMeter; /// /// Represents the zero value. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs index abc65ce7..1fecfddc 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs @@ -49,7 +49,7 @@ public GeographicCoordinates(Double latitude, Double longitude) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(GeographicCoordinates a, GeographicCoordinates b) => (a == b) == false; + public static Boolean operator !=(GeographicCoordinates a, GeographicCoordinates b) => a == b == false; /// /// Determine whether or not two specified instances are equal. @@ -63,19 +63,7 @@ public GeographicCoordinates(Double latitude, Double longitude) /// /// A value indicating whether or not the specified instances are equal. /// - public static Boolean operator ==(GeographicCoordinates a, GeographicCoordinates b) - { - if ((Object)a is null && (Object)b is null) - { - return true; - } - else if ((Object)a is null || (Object)b is null) - { - return false; - } - - return a.Equals(b); - } + public static Boolean operator ==(GeographicCoordinates a, GeographicCoordinates b) => a.Equals(b); /// /// Convert the string representation of latitude and longitude coordinates to its diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs index 44846618..24cc7ccc 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs @@ -177,7 +177,7 @@ public Length(Decimal meters) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Length a, Length b) => (a == b) == false; + public static Boolean operator !=(Length a, Length b) => a == b == false; /// /// Determines the product of a value and a multiplier. @@ -191,7 +191,7 @@ public Length(Decimal meters) /// /// The product of the specified and the specified multiplier. /// - public static Length operator *(Length multiplicand, Double multiplier) => (multiplicand * Convert.ToDecimal(multiplier)); + public static Length operator *(Length multiplicand, Double multiplier) => multiplicand * Convert.ToDecimal(multiplier); /// /// Determines the product of a value and a multiplier. @@ -219,7 +219,7 @@ public Length(Decimal meters) /// /// The quotient of the specified and the specified divisor. /// - public static Length operator /(Length dividend, Double divisor) => (dividend / Convert.ToDecimal(divisor)); + public static Length operator /(Length dividend, Double divisor) => dividend / Convert.ToDecimal(divisor); /// /// Determines the quotient of a value and a divisor. @@ -261,7 +261,7 @@ public Length(Decimal meters) /// /// if the second object is less than the first object, otherwise . /// - public static Boolean operator <(Length a, Length b) => a.CompareTo(b) == -1; + public static Boolean operator <(Length a, Length b) => a.CompareTo(b) < 0; /// /// Determines whether or not a supplied instance is less than or equal to another supplied instance. @@ -276,7 +276,7 @@ public Length(Decimal meters) /// if the second object is less than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Length a, Length b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Length a, Length b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -304,7 +304,7 @@ public Length(Decimal meters) /// /// if the second object is greater than the first object, otherwise . /// - public static Boolean operator >(Length a, Length b) => a.CompareTo(b) == 1; + public static Boolean operator >(Length a, Length b) => a.CompareTo(b) > 0; /// /// Determines whether or not a supplied instance is greater than or equal to another supplied @@ -320,7 +320,7 @@ public Length(Decimal meters) /// if the second object is greater than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Length a, Length b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Length a, Length b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a distance value to its equivalent. @@ -385,7 +385,7 @@ public static Boolean TryParse(String input, out Length result) /// Negative one if this instance is less than the supplied instance; one if this instance is greater than the supplied /// instance; zero if they are equal. /// - public Int32 CompareTo(Length other) => (Meters.CompareTo(other.Meters)); + public Int32 CompareTo(Length other) => Meters.CompareTo(other.Meters); /// /// Determines whether or not the current is equal to the specified . @@ -636,27 +636,27 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// /// Gets the value of the current expressed in centimeters. /// - public Decimal TotalCentimeters => (Meters * CentimetersPerMeter); + public Decimal TotalCentimeters => Meters * CentimetersPerMeter; /// /// Gets the value of the current expressed in feet. /// - public Decimal TotalFeet => (Meters * FeetPerMeter); + public Decimal TotalFeet => Meters * FeetPerMeter; /// /// Gets the value of the current expressed in inches. /// - public Decimal TotalInches => (Meters * InchesPerMeter); + public Decimal TotalInches => Meters * InchesPerMeter; /// /// Gets the value of the current expressed in kilometers. /// - public Decimal TotalKilometers => (Meters * KilometersPerMeter); + public Decimal TotalKilometers => Meters * KilometersPerMeter; /// /// Gets the value of the current expressed in light-years. /// - public Decimal TotalLightYears => (Meters * LightYearsPerMeter); + public Decimal TotalLightYears => Meters * LightYearsPerMeter; /// /// Gets the value of the current expressed in meters. @@ -666,22 +666,22 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// /// Gets the value of the current expressed in miles. /// - public Decimal TotalMiles => (Meters * MilesPerMeter); + public Decimal TotalMiles => Meters * MilesPerMeter; /// /// Gets the value of the current expressed in millimeters. /// - public Decimal TotalMillimeters => (Meters * MillimetersPerMeter); + public Decimal TotalMillimeters => Meters * MillimetersPerMeter; /// /// Gets the value of the current expressed in nanometers. /// - public Decimal TotalNanometers => (Meters * NanometersPerMeter); + public Decimal TotalNanometers => Meters * NanometersPerMeter; /// /// Gets the value of the current expressed in yards. /// - public Decimal TotalYards => ((Meters * FeetPerMeter) / FeetPerYard); + public Decimal TotalYards => Meters * FeetPerMeter / FeetPerYard; /// /// Represents the zero value. @@ -692,7 +692,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of centimeters in an foot. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal CentimetersPerFoot = (CentimetersPerInch * InchesPerFoot); + private const Decimal CentimetersPerFoot = CentimetersPerInch * InchesPerFoot; /// /// Represents the number of centimeters in an inch. @@ -716,7 +716,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of feet in a meter. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal FeetPerMeter = (CentimetersPerMeter / CentimetersPerFoot); + private const Decimal FeetPerMeter = CentimetersPerMeter / CentimetersPerFoot; /// /// Represents the number of feet in a mile. @@ -746,7 +746,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of inches in a meter. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal InchesPerMeter = (CentimetersPerMeter / CentimetersPerInch); + private const Decimal InchesPerMeter = CentimetersPerMeter / CentimetersPerInch; /// /// Represents the textual symbol for an inch. @@ -770,7 +770,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of light-years in a meter. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal LightYearsPerMeter = (1m / MetersPerLightYear); + private const Decimal LightYearsPerMeter = 1m / MetersPerLightYear; /// /// Represents the textual symbol for a light-year. @@ -794,7 +794,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of miles in a meter. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal MilesPerMeter = (FeetPerMeter / FeetPerMile); + private const Decimal MilesPerMeter = FeetPerMeter / FeetPerMile; /// /// Represents the textual symbol for a mile. @@ -836,7 +836,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// Represents the number of yards in a meter. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private const Decimal YardsPerMeter = (FeetPerMeter / FeetPerYard); + private const Decimal YardsPerMeter = FeetPerMeter / FeetPerYard; /// /// Represents the textual symbol for a yard. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs index 71ad9963..02fb5b0a 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs @@ -137,7 +137,7 @@ public Mass(Decimal grams) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Mass a, Mass b) => (a == b) == false; + public static Boolean operator !=(Mass a, Mass b) => a == b == false; /// /// Determines the product of a value and a multiplier. @@ -151,7 +151,7 @@ public Mass(Decimal grams) /// /// The product of the specified and the specified multiplier. /// - public static Mass operator *(Mass multiplicand, Double multiplier) => (multiplicand * Convert.ToDecimal(multiplier)); + public static Mass operator *(Mass multiplicand, Double multiplier) => multiplicand * Convert.ToDecimal(multiplier); /// /// Determines the product of a value and a multiplier. @@ -179,7 +179,7 @@ public Mass(Decimal grams) /// /// The quotient of the specified and the specified divisor. /// - public static Mass operator /(Mass dividend, Double divisor) => (dividend / Convert.ToDecimal(divisor)); + public static Mass operator /(Mass dividend, Double divisor) => dividend / Convert.ToDecimal(divisor); /// /// Determines the quotient of a value and a divisor. @@ -221,7 +221,7 @@ public Mass(Decimal grams) /// /// if the second object is less than the first object, otherwise . /// - public static Boolean operator <(Mass a, Mass b) => a.CompareTo(b) == -1; + public static Boolean operator <(Mass a, Mass b) => a.CompareTo(b) < 0; /// /// Determines whether or not a supplied instance is less than or equal to another supplied instance. @@ -236,7 +236,7 @@ public Mass(Decimal grams) /// if the second object is less than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Mass a, Mass b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Mass a, Mass b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -264,7 +264,7 @@ public Mass(Decimal grams) /// /// if the second object is greater than the first object, otherwise . /// - public static Boolean operator >(Mass a, Mass b) => a.CompareTo(b) == 1; + public static Boolean operator >(Mass a, Mass b) => a.CompareTo(b) > 0; /// /// Determines whether or not a supplied instance is greater than or equal to another supplied instance. @@ -279,7 +279,7 @@ public Mass(Decimal grams) /// if the second object is greater than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Mass a, Mass b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Mass a, Mass b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a mass value to its equivalent. @@ -378,7 +378,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(Mass other) => (Grams == other.Grams); + public Boolean Equals(Mass other) => Grams == other.Grams; /// /// Returns the hash code for this instance. @@ -575,7 +575,7 @@ private static Boolean Parse(String input, out Mass result, Boolean raiseExcepti /// /// Gets the value of the current expressed in centigrams. /// - public Decimal TotalCentigrams => (Grams * CentigramsPerGram); + public Decimal TotalCentigrams => Grams * CentigramsPerGram; /// /// Gets the value of the current expressed in grams. @@ -585,22 +585,22 @@ private static Boolean Parse(String input, out Mass result, Boolean raiseExcepti /// /// Gets the value of the current expressed in kilograms. /// - public Decimal TotalKilograms => (Grams * KilogramsPerGram); + public Decimal TotalKilograms => Grams * KilogramsPerGram; /// /// Gets the value of the current expressed in micro-grams. /// - public Decimal TotalMicrograms => (Grams * MicrogramsPerGram); + public Decimal TotalMicrograms => Grams * MicrogramsPerGram; /// /// Gets the value of the current expressed in milligrams. /// - public Decimal TotalMilligrams => (Grams * MilligramsPerGram); + public Decimal TotalMilligrams => Grams * MilligramsPerGram; /// /// Gets the value of the current expressed in nanograms. /// - public Decimal TotalNanograms => (Grams * NanogramsPerGram); + public Decimal TotalNanograms => Grams * NanogramsPerGram; /// /// Represents the atomic mass unit constant. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs index 2c11ebbb..6456083c 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs @@ -107,7 +107,7 @@ public Temperature(Decimal degreesCelsius) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Temperature a, Temperature b) => (a == b) == false; + public static Boolean operator !=(Temperature a, Temperature b) => a == b == false; /// /// Determines the product of a value and a multiplier. @@ -121,7 +121,7 @@ public Temperature(Decimal degreesCelsius) /// /// The product of the specified and the specified multiplier. /// - public static Temperature operator *(Temperature multiplicand, Double multiplier) => (multiplicand * Convert.ToDecimal(multiplier)); + public static Temperature operator *(Temperature multiplicand, Double multiplier) => multiplicand * Convert.ToDecimal(multiplier); /// /// Determines the product of a value and a multiplier. @@ -149,7 +149,7 @@ public Temperature(Decimal degreesCelsius) /// /// The quotient of the specified and the specified divisor. /// - public static Temperature operator /(Temperature dividend, Double divisor) => (dividend / Convert.ToDecimal(divisor)); + public static Temperature operator /(Temperature dividend, Double divisor) => dividend / Convert.ToDecimal(divisor); /// /// Determines the quotient of a value and a divisor. @@ -191,7 +191,7 @@ public Temperature(Decimal degreesCelsius) /// /// if the second object is less than the first object, otherwise . /// - public static Boolean operator <(Temperature a, Temperature b) => a.CompareTo(b) == -1; + public static Boolean operator <(Temperature a, Temperature b) => a.CompareTo(b) < 0; /// /// Determines whether or not a supplied instance is less than or equal to another supplied @@ -207,7 +207,7 @@ public Temperature(Decimal degreesCelsius) /// if the second object is less than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Temperature a, Temperature b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Temperature a, Temperature b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -235,7 +235,7 @@ public Temperature(Decimal degreesCelsius) /// /// if the second object is greater than the first object, otherwise . /// - public static Boolean operator >(Temperature a, Temperature b) => a.CompareTo(b) == 1; + public static Boolean operator >(Temperature a, Temperature b) => a.CompareTo(b) > 0; /// /// Determines whether or not a supplied instance is greater than or equal to another supplied @@ -251,7 +251,7 @@ public Temperature(Decimal degreesCelsius) /// if the second object is greater than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Temperature a, Temperature b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Temperature a, Temperature b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a temperature value to its @@ -352,7 +352,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(Temperature other) => (DegreesCelsius == other.DegreesCelsius); + public Boolean Equals(Temperature other) => DegreesCelsius == other.DegreesCelsius; /// /// Returns the hash code for this instance. @@ -540,12 +540,12 @@ private static Boolean Parse(String input, out Temperature result, Boolean raise /// /// Gets the value of the current expressed in degrees Fahrenheit. /// - public Decimal TotalDegreesFahrenheit => ((DegreesCelsius * (9m / 5m)) + 32m); + public Decimal TotalDegreesFahrenheit => (DegreesCelsius * (9m / 5m)) + 32m; /// /// Gets the value of the current expressed in kelvins. /// - public Decimal TotalKelvins => (DegreesCelsius + 273.15m); + public Decimal TotalKelvins => DegreesCelsius + 273.15m; /// /// Represents the temperature at the lower limit of the thermodynamic temperature scale. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs index b3189f55..71ee17fb 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs @@ -187,7 +187,7 @@ public Volume(Decimal cubicMeters) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(Volume a, Volume b) => (a == b) == false; + public static Boolean operator !=(Volume a, Volume b) => a == b == false; /// /// Determines the product of an value and a multiplier. @@ -201,7 +201,7 @@ public Volume(Decimal cubicMeters) /// /// The product of the specified and the specified multiplier. /// - public static Volume operator *(Volume multiplicand, Double multiplier) => (multiplicand * Convert.ToDecimal(multiplier)); + public static Volume operator *(Volume multiplicand, Double multiplier) => multiplicand * Convert.ToDecimal(multiplier); /// /// Determines the product of an value and a multiplier. @@ -229,7 +229,7 @@ public Volume(Decimal cubicMeters) /// /// The quotient of the specified and the specified divisor. /// - public static Volume operator /(Volume dividend, Double divisor) => (dividend / Convert.ToDecimal(divisor)); + public static Volume operator /(Volume dividend, Double divisor) => dividend / Convert.ToDecimal(divisor); /// /// Determines the quotient of an value and a divisor. @@ -271,7 +271,7 @@ public Volume(Decimal cubicMeters) /// /// if the second object is less than the first object, otherwise . /// - public static Boolean operator <(Volume a, Volume b) => a.CompareTo(b) == -1; + public static Boolean operator <(Volume a, Volume b) => a.CompareTo(b) < 0; /// /// Determines whether or not a supplied instance is less than or equal to another supplied instance. @@ -286,7 +286,7 @@ public Volume(Decimal cubicMeters) /// if the second object is less than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(Volume a, Volume b) => a.CompareTo(b) < 1; + public static Boolean operator <=(Volume a, Volume b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -314,7 +314,7 @@ public Volume(Decimal cubicMeters) /// /// if the second object is greater than the first object, otherwise . /// - public static Boolean operator >(Volume a, Volume b) => a.CompareTo(b) == 1; + public static Boolean operator >(Volume a, Volume b) => a.CompareTo(b) > 0; /// /// Determines whether or not a supplied instance is greater than or equal to another supplied @@ -330,7 +330,7 @@ public Volume(Decimal cubicMeters) /// if the second object is greater than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(Volume a, Volume b) => a.CompareTo(b) > -1; + public static Boolean operator >=(Volume a, Volume b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a area value to its equivalent. @@ -429,7 +429,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(Volume other) => (CubicMeters == other.CubicMeters); + public Boolean Equals(Volume other) => CubicMeters == other.CubicMeters; /// /// Returns the hash code for this instance. @@ -651,22 +651,22 @@ private static Boolean Parse(String input, out Volume result, Boolean raiseExcep /// /// Gets the value of the current expressed in cubic centimeters. /// - public Decimal TotalCubicCentimeters => (CubicMeters * CubicCentimetersPerCubicMeter); + public Decimal TotalCubicCentimeters => CubicMeters * CubicCentimetersPerCubicMeter; /// /// Gets the value of the current expressed in cubic feet. /// - public Decimal TotalCubicFeet => (CubicMeters * CubicFeetPerCubicMeter); + public Decimal TotalCubicFeet => CubicMeters * CubicFeetPerCubicMeter; /// /// Gets the value of the current expressed in cubic inches. /// - public Decimal TotalCubicInches => (CubicMeters * CubicInchesPerCubicMeter); + public Decimal TotalCubicInches => CubicMeters * CubicInchesPerCubicMeter; /// /// Gets the value of the current expressed in cubic kilometers. /// - public Decimal TotalCubicKilometers => (CubicMeters * CubicKilometersPerCubicMeter); + public Decimal TotalCubicKilometers => CubicMeters * CubicKilometersPerCubicMeter; /// /// Gets the value of the current expressed in cubic meters. @@ -676,32 +676,32 @@ private static Boolean Parse(String input, out Volume result, Boolean raiseExcep /// /// Gets the value of the current expressed in cubic miles. /// - public Decimal TotalCubicMiles => (CubicMeters * CubicMilesPerCubicMeter); + public Decimal TotalCubicMiles => CubicMeters * CubicMilesPerCubicMeter; /// /// Gets the value of the current expressed in cubic millimeters. /// - public Decimal TotalCubicMillimeters => (CubicMeters * CubicMillimetersPerCubicMeter); + public Decimal TotalCubicMillimeters => CubicMeters * CubicMillimetersPerCubicMeter; /// /// Gets the value of the current expressed in cubic yards. /// - public Decimal TotalCubicYards => (CubicMeters * CubicYardsPerCubicMeter); + public Decimal TotalCubicYards => CubicMeters * CubicYardsPerCubicMeter; /// /// Gets the value of the current expressed in gallons. /// - public Decimal TotalGallons => (CubicMeters * GallonsPerCubicMeter); + public Decimal TotalGallons => CubicMeters * GallonsPerCubicMeter; /// /// Gets the value of the current expressed in liters. /// - public Decimal TotalLiters => (CubicMeters * LitersPerCubicMeter); + public Decimal TotalLiters => CubicMeters * LitersPerCubicMeter; /// /// Gets the value of the current expressed in milliliters. /// - public Decimal TotalMilliliters => (CubicMeters * MillilitersPerCubicMeter); + public Decimal TotalMilliliters => CubicMeters * MillilitersPerCubicMeter; /// /// Represents the zero value. diff --git a/src/RapidField.SolidInstruments.Mathematics/Sequences/ArithmeticSequence.cs b/src/RapidField.SolidInstruments.Mathematics/Sequences/ArithmeticSequence.cs index 4745cd1e..c4ce2bfc 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Sequences/ArithmeticSequence.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Sequences/ArithmeticSequence.cs @@ -45,7 +45,7 @@ public ArithmeticSequence(Double firstTerm, Double commonDifference) /// /// The next term in the sequence. /// - protected override Double CalculateNext(IEnumerable calculatedTerms) => (calculatedTerms.Last() + CommonDifference); + protected override Double CalculateNext(IEnumerable calculatedTerms) => calculatedTerms.Last() + CommonDifference; /// /// Gets the constant difference between the terms in the sequence. diff --git a/src/RapidField.SolidInstruments.Mathematics/Sequences/FibonacciSequence.cs b/src/RapidField.SolidInstruments.Mathematics/Sequences/FibonacciSequence.cs index 412e8925..2aabf010 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Sequences/FibonacciSequence.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Sequences/FibonacciSequence.cs @@ -53,7 +53,7 @@ public FibonacciSequence(BigInteger firstTerm, BigInteger secondTerm) protected override BigInteger CalculateNext(IEnumerable calculatedTerms) { var inputTerms = calculatedTerms.Skip(calculatedTerms.Count() - 2).Take(2).ToArray(); - return (inputTerms[0] + inputTerms[1]); + return inputTerms[0] + inputTerms[1]; } /// diff --git a/src/RapidField.SolidInstruments.Mathematics/Sequences/GeometricSequence.cs b/src/RapidField.SolidInstruments.Mathematics/Sequences/GeometricSequence.cs index 1344f9a7..d06ac8b0 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Sequences/GeometricSequence.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Sequences/GeometricSequence.cs @@ -48,7 +48,7 @@ public GeometricSequence(Double firstTerm, Double commonRatio) /// /// The next term in the sequence. /// - protected override Double CalculateNext(IEnumerable calculatedTerms) => (calculatedTerms.Last() * CommonRatio); + protected override Double CalculateNext(IEnumerable calculatedTerms) => calculatedTerms.Last() * CommonRatio; /// /// Gets the constant factor between the terms in the sequence. diff --git a/src/RapidField.SolidInstruments.Mathematics/Statistics/DescriptiveStatistics.cs b/src/RapidField.SolidInstruments.Mathematics/Statistics/DescriptiveStatistics.cs index b1772380..f0f532d6 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Statistics/DescriptiveStatistics.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Statistics/DescriptiveStatistics.cs @@ -53,9 +53,9 @@ internal DescriptiveStatistics(Int32 size, Decimal minimum, Decimal maximum, Dec Maximum = maximum.RejectIf().IsLessThan(minimum, nameof(maximum), nameof(minimum)); Mean = mean; Median = median; - Midrange = ((maximum + minimum) / 2m); + Midrange = (maximum + minimum) / 2m; Minimum = minimum; - Range = (maximum - minimum); + Range = maximum - minimum; Size = size.RejectIf().IsLessThan(1, nameof(size)); StandardDeviation = standardDeviation; Sum = sum; diff --git a/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs index cc15020d..354b2c8d 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs @@ -568,7 +568,7 @@ public static Double Median(this IEnumerable target) } // The collection length is even. Return the mean of the values sharing the median position. - return ((Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d); + return (Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d; } /// @@ -622,7 +622,7 @@ public static Double Median(this IEnumerable target) } // The collection length is even. Return the mean of the values sharing the median position. - return ((Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d); + return (Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d; } /// @@ -676,7 +676,7 @@ public static Double Median(this IEnumerable target) } // The collection length is even. Return the mean of the values sharing the median position. - return ((Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d); + return (Convert.ToDouble(orderedCollection.ElementAt(medianIndices[0])) + Convert.ToDouble(orderedCollection.ElementAt(medianIndices[1]))) / 2d; } /// @@ -730,7 +730,7 @@ public static Double Median(this IEnumerable target) } // The collection length is even. Return the mean of the values sharing the median position. - return ((orderedCollection.ElementAt(medianIndices[0]) + orderedCollection.ElementAt(medianIndices[1])) / 2d); + return (orderedCollection.ElementAt(medianIndices[0]) + orderedCollection.ElementAt(medianIndices[1])) / 2d; } /// @@ -784,7 +784,7 @@ public static Decimal Median(this IEnumerable target) } // The collection length is even. Return the mean of the values sharing the median position. - return ((orderedCollection.ElementAt(medianIndices[0]) + orderedCollection.ElementAt(medianIndices[1])) / 2m); + return (orderedCollection.ElementAt(medianIndices[0]) + orderedCollection.ElementAt(medianIndices[1])) / 2m; } /// @@ -828,7 +828,7 @@ public static Decimal Median(this IEnumerable target) public static Double Midrange(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return ((Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d); + return (Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d; } /// @@ -872,7 +872,7 @@ public static Double Midrange(this IEnumerable target) public static Double Midrange(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return ((Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d); + return (Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d; } /// @@ -916,7 +916,7 @@ public static Double Midrange(this IEnumerable target) public static Double Midrange(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return ((Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d); + return (Convert.ToDouble(target.Min()) + Convert.ToDouble(target.Max())) / 2d; } /// @@ -960,7 +960,7 @@ public static Double Midrange(this IEnumerable target) public static Double Midrange(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return ((target.Min() + target.Max()) / 2d); + return (target.Min() + target.Max()) / 2d; } /// @@ -1004,7 +1004,7 @@ public static Double Midrange(this IEnumerable target) public static Decimal Midrange(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return ((target.Min() + target.Max()) / 2m); + return (target.Min() + target.Max()) / 2m; } /// @@ -1048,7 +1048,7 @@ public static Decimal Midrange(this IEnumerable target) public static Int32 Range(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return (target.Max() - target.Min()); + return target.Max() - target.Min(); } /// @@ -1092,7 +1092,7 @@ public static Int32 Range(this IEnumerable target) public static Int64 Range(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return (target.Max() - target.Min()); + return target.Max() - target.Min(); } /// @@ -1136,7 +1136,7 @@ public static Int64 Range(this IEnumerable target) public static Single Range(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return (target.Max() - target.Min()); + return target.Max() - target.Min(); } /// @@ -1180,7 +1180,7 @@ public static Single Range(this IEnumerable target) public static Double Range(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return (target.Max() - target.Min()); + return target.Max() - target.Min(); } /// @@ -1224,7 +1224,7 @@ public static Double Range(this IEnumerable target) public static Decimal Range(this IEnumerable target) { target.RejectIf().IsNullOrEmpty(nameof(target)); - return (target.Max() - target.Min()); + return target.Max() - target.Min(); } /// @@ -1670,8 +1670,8 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) } // Return the pair of indices sharing the midpoint. - var firstIndex = ((elementCount / 2) - 1); - return new Int32[] { firstIndex, (firstIndex + 1) }; + var firstIndex = (elementCount / 2) - 1; + return new Int32[] { firstIndex, firstIndex + 1 }; } /// @@ -1714,7 +1714,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Mean(this IEnumerable target, Int32 sum) => (Convert.ToDouble(sum) / Convert.ToDouble(target.Count())); + private static Double Mean(this IEnumerable target, Int32 sum) => Convert.ToDouble(sum) / Convert.ToDouble(target.Count()); /// /// Calculate the arithmetic mean of the values in the current collection given the provided sum. @@ -1756,7 +1756,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Mean(this IEnumerable target, Int64 sum) => (Convert.ToDouble(sum) / Convert.ToDouble(target.Count())); + private static Double Mean(this IEnumerable target, Int64 sum) => Convert.ToDouble(sum) / Convert.ToDouble(target.Count()); /// /// Calculate the arithmetic mean of the values in the current collection given the provided sum. @@ -1792,7 +1792,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// is . /// [DebuggerHidden] - private static Double Mean(this IEnumerable target, Single sum) => (Convert.ToDouble(sum) / Convert.ToDouble(target.Count())); + private static Double Mean(this IEnumerable target, Single sum) => Convert.ToDouble(sum) / Convert.ToDouble(target.Count()); /// /// Calculate the arithmetic mean of the values in the current collection given the provided sum. @@ -1828,7 +1828,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// is . /// [DebuggerHidden] - private static Double Mean(this IEnumerable target, Double sum) => (sum / Convert.ToDouble(target.Count())); + private static Double Mean(this IEnumerable target, Double sum) => sum / Convert.ToDouble(target.Count()); /// /// Calculate the arithmetic mean of the values in the current collection given the provided sum. @@ -1864,7 +1864,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// is . /// [DebuggerHidden] - private static Decimal Mean(this IEnumerable target, Decimal sum) => (sum / Convert.ToDecimal(target.Count())); + private static Decimal Mean(this IEnumerable target, Decimal sum) => sum / Convert.ToDecimal(target.Count()); /// /// Calculate the standard deviation of the values in the current collection given the provided @@ -2087,7 +2087,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Variance(this IEnumerable target, Double mean) => ((Convert.ToDouble(target.Sum(number => (number * number))) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d)); + private static Double Variance(this IEnumerable target, Double mean) => (Convert.ToDouble(target.Sum(number => number * number)) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d); /// /// Calculate the variance of the values in the current collection given the provided mean. @@ -2129,7 +2129,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Variance(this IEnumerable target, Double mean) => ((Convert.ToDouble(target.Sum(number => (number * number))) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d)); + private static Double Variance(this IEnumerable target, Double mean) => (Convert.ToDouble(target.Sum(number => number * number)) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d); /// /// Calculate the variance of the values in the current collection given the provided mean. @@ -2171,7 +2171,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Variance(this IEnumerable target, Double mean) => ((Convert.ToDouble(target.Sum(number => (number * number))) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d)); + private static Double Variance(this IEnumerable target, Double mean) => (Convert.ToDouble(target.Sum(number => number * number)) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d); /// /// Calculate the variance of the values in the current collection given the provided mean. @@ -2213,7 +2213,7 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Double Variance(this IEnumerable target, Double mean) => ((target.Sum(number => (number * number)) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d)); + private static Double Variance(this IEnumerable target, Double mean) => (target.Sum(number => number * number) / Convert.ToDouble(target.Count())) - Math.Pow(mean, 2d); /// /// Calculate the variance of the values in the current collection given the provided mean. @@ -2255,6 +2255,6 @@ private static Int32[] DetermineMedianIndices(Int32 elementCount) /// A calculation produced a result that is outside the range of its data type. /// [DebuggerHidden] - private static Decimal Variance(this IEnumerable target, Decimal mean) => ((target.Sum(number => (number * number)) / Convert.ToDecimal(target.Count())) - (mean * mean)); + private static Decimal Variance(this IEnumerable target, Decimal mean) => (target.Sum(number => number * number) / Convert.ToDecimal(target.Count())) - (mean * mean); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs index 5fe7097b..93664886 100644 --- a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs +++ b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs @@ -161,7 +161,7 @@ protected sealed override Task RouteToDeadLetterQueueAsync(AzureServic [DebuggerHidden] private static Guid ExtractCorrelationIdentifier(AzureServiceBusMessage message) { - if (message?.CorrelationId is null == false && Guid.TryParse(message.CorrelationId, out var correlationIdentifier)) + if ((message?.CorrelationId is null) == false && Guid.TryParse(message.CorrelationId, out var correlationIdentifier)) { return correlationIdentifier; } diff --git a/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs b/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs index c9a61b5a..130abdb2 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs @@ -144,7 +144,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(MessagingEntityPath a, IMessagingEntityPath b) => (a == b) == false; + public static Boolean operator !=(MessagingEntityPath a, IMessagingEntityPath b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -159,7 +159,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(MessagingEntityPath a, IMessagingEntityPath b) => a.CompareTo(b) == -1; + public static Boolean operator <(MessagingEntityPath a, IMessagingEntityPath b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another @@ -175,7 +175,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(MessagingEntityPath a, IMessagingEntityPath b) => a.CompareTo(b) < 1; + public static Boolean operator <=(MessagingEntityPath a, IMessagingEntityPath b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -191,11 +191,11 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// public static Boolean operator ==(MessagingEntityPath a, IMessagingEntityPath b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -216,7 +216,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(MessagingEntityPath a, IMessagingEntityPath b) => a.CompareTo(b) == 1; + public static Boolean operator >(MessagingEntityPath a, IMessagingEntityPath b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another @@ -232,7 +232,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(MessagingEntityPath a, IMessagingEntityPath b) => a.CompareTo(b) > -1; + public static Boolean operator >=(MessagingEntityPath a, IMessagingEntityPath b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Converts the specified representation of a messaging entity path to its @@ -253,15 +253,7 @@ private MessagingEntityPath(String messageType, String prefix, String labelOne, /// /// does not contain a valid representation of a messaging entity path. /// - public static MessagingEntityPath Parse(String input) - { - if (Parse(input, out var value, true)) - { - return value; - } - - return default; - } + public static MessagingEntityPath Parse(String input) => Parse(input, out var value, true) ? value : default; /// /// Converts the specified representation of a messaging entity path to its @@ -394,27 +386,27 @@ public override String ToString() if (Prefix.IsNullOrEmpty() == false) { - stringBuilder.Append($"{Prefix}{DelimitingCharacterForPrefix}"); + _ = stringBuilder.Append($"{Prefix}{DelimitingCharacterForPrefix}"); } if (MessageType.IsNullOrEmpty() == false) { - stringBuilder.Append(MessageType); + _ = stringBuilder.Append(MessageType); } if (LabelOne.IsNullOrEmpty() == false) { - stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelOne}"); + _ = stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelOne}"); } if (LabelTwo.IsNullOrEmpty() == false) { - stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelTwo}"); + _ = stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelTwo}"); } if (LabelThree.IsNullOrEmpty() == false) { - stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelThree}"); + _ = stringBuilder.Append($"{DelimitingCharacterForLabelToken}{LabelThree}"); } return stringBuilder.ToString(); diff --git a/src/RapidField.SolidInstruments.Messaging/Service/HeartbeatScheduleItem.cs b/src/RapidField.SolidInstruments.Messaging/Service/HeartbeatScheduleItem.cs index 7f81e4a9..d1d82f17 100644 --- a/src/RapidField.SolidInstruments.Messaging/Service/HeartbeatScheduleItem.cs +++ b/src/RapidField.SolidInstruments.Messaging/Service/HeartbeatScheduleItem.cs @@ -97,7 +97,7 @@ internal HeartbeatScheduleItem(Int32 intervalInSeconds, MessagingEntityType enti /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => (a == b) == false; + public static Boolean operator !=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -112,7 +112,7 @@ internal HeartbeatScheduleItem(Int32 intervalInSeconds, MessagingEntityType enti /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a.CompareTo(b) == -1; + public static Boolean operator <(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another @@ -128,7 +128,7 @@ internal HeartbeatScheduleItem(Int32 intervalInSeconds, MessagingEntityType enti /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a.CompareTo(b) < 1; + public static Boolean operator <=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -169,7 +169,7 @@ internal HeartbeatScheduleItem(Int32 intervalInSeconds, MessagingEntityType enti /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a.CompareTo(b) == 1; + public static Boolean operator >(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another @@ -185,7 +185,7 @@ internal HeartbeatScheduleItem(Int32 intervalInSeconds, MessagingEntityType enti /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a.CompareTo(b) > -1; + public static Boolean operator >=(HeartbeatScheduleItem a, IHeartbeatScheduleItem b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Compares the current to the specified object and returns an indication of their @@ -257,7 +257,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(IHeartbeatScheduleItem other) => (MessageType == other.MessageType && IntervalInSeconds == other.IntervalInSeconds && EntityType == other.EntityType && Label == other.Label); + public Boolean Equals(IHeartbeatScheduleItem other) => MessageType == other.MessageType && IntervalInSeconds == other.IntervalInSeconds && EntityType == other.EntityType && Label == other.Label; /// /// Returns the hash code for this instance. @@ -265,7 +265,7 @@ public override Boolean Equals(Object obj) /// /// A 32-bit signed integer hash code. /// - public override Int32 GetHashCode() => ((IntervalInSeconds ^ (Int32)EntityType) ^ ((Label is null ? 0 : Label.GetHashCode()) ^ MessageType.FullName.GetHashCode())); + public override Int32 GetHashCode() => IntervalInSeconds ^ (Int32)EntityType ^ (Label is null ? 0 : Label.GetHashCode()) ^ MessageType.FullName.GetHashCode(); /// /// Converts the value of the current to its equivalent string diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageLockToken.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageLockToken.cs index 3da7c53d..cc31d135 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageLockToken.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageLockToken.cs @@ -98,7 +98,7 @@ internal MessageLockToken(UInt64 deliveryTag, Guid identifier, Guid messageIdent /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(MessageLockToken a, MessageLockToken b) => (a == b) == false; + public static Boolean operator !=(MessageLockToken a, MessageLockToken b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified instance. @@ -112,7 +112,7 @@ internal MessageLockToken(UInt64 deliveryTag, Guid identifier, Guid messageIdent /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(MessageLockToken a, MessageLockToken b) => a.CompareTo(b) == -1; + public static Boolean operator <(MessageLockToken a, MessageLockToken b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another supplied @@ -128,7 +128,7 @@ internal MessageLockToken(UInt64 deliveryTag, Guid identifier, Guid messageIdent /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(MessageLockToken a, MessageLockToken b) => a.CompareTo(b) < 1; + public static Boolean operator <=(MessageLockToken a, MessageLockToken b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -169,7 +169,7 @@ internal MessageLockToken(UInt64 deliveryTag, Guid identifier, Guid messageIdent /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(MessageLockToken a, MessageLockToken b) => a.CompareTo(b) == 1; + public static Boolean operator >(MessageLockToken a, MessageLockToken b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to another @@ -185,7 +185,7 @@ internal MessageLockToken(UInt64 deliveryTag, Guid identifier, Guid messageIdent /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(MessageLockToken a, MessageLockToken b) => a.CompareTo(b) > -1; + public static Boolean operator >=(MessageLockToken a, MessageLockToken b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Compares the current to the specified object and returns an indication of their relative diff --git a/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs b/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs index 992839bd..0c538667 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs @@ -65,7 +65,7 @@ public T Get() if (Instances.TryGetValue(instanceType, out var extantInstance)) { - return (extantInstance as T); + return extantInstance as T; } var newInstance = GetNew(controlToken); diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerDefinition.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerDefinition.cs index d31cb8b5..efc29fa7 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerDefinition.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerDefinition.cs @@ -53,7 +53,7 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(ObjectContainerDefinition a, IObjectContainerDefinition b) => (a == b) == false; + public static Boolean operator !=(ObjectContainerDefinition a, IObjectContainerDefinition b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -68,7 +68,7 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(ObjectContainerDefinition a, IObjectContainerDefinition b) => a.CompareTo(b) == -1; + public static Boolean operator <(ObjectContainerDefinition a, IObjectContainerDefinition b) => a is null ? b is Object : a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to @@ -84,7 +84,7 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(ObjectContainerDefinition a, IObjectContainerDefinition b) => a.CompareTo(b) < 1; + public static Boolean operator <=(ObjectContainerDefinition a, IObjectContainerDefinition b) => a is null || a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -100,11 +100,11 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// public static Boolean operator ==(ObjectContainerDefinition a, IObjectContainerDefinition b) { - if ((Object)a is null && (Object)b is null) + if (a is null && b is null) { return true; } - else if ((Object)a is null || (Object)b is null) + else if (a is null || b is null) { return false; } @@ -125,7 +125,7 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(ObjectContainerDefinition a, IObjectContainerDefinition b) => a.CompareTo(b) == 1; + public static Boolean operator >(ObjectContainerDefinition a, IObjectContainerDefinition b) => a is Object && a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to @@ -141,7 +141,7 @@ internal ObjectContainerDefinition(Type requestType, Type productType) /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(ObjectContainerDefinition a, IObjectContainerDefinition b) => a.CompareTo(b) > -1; + public static Boolean operator >=(ObjectContainerDefinition a, IObjectContainerDefinition b) => a is null ? b is null : a.CompareTo(b) >= 0; /// /// Compares the current to the specified object and returns an indication of their @@ -158,19 +158,7 @@ public Int32 CompareTo(IObjectContainerDefinition other) { var thisInstanceHashCode = GetHashCode(); var otherInstancHashCode = other.GetHashCode(); - - if (thisInstanceHashCode < otherInstancHashCode) - { - return -1; - } - else if (thisInstanceHashCode > otherInstancHashCode) - { - return 1; - } - else - { - return 0; - } + return thisInstanceHashCode < otherInstancHashCode ? -1 : thisInstanceHashCode > otherInstancHashCode ? 1 : 0; } /// diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs index 1592fc91..61d55606 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs @@ -180,7 +180,7 @@ public Object Produce(Type type) /// An exception was raised during configuration of the factory. /// [DebuggerHidden] - internal virtual ConcurrentDictionary DefineProductionFunctions() => ((ObjectFactoryConfigurationProductionFunctions)(Configuration.ProductionFunctions)).Dictionary; + internal virtual ConcurrentDictionary DefineProductionFunctions() => ((ObjectFactoryConfigurationProductionFunctions)Configuration.ProductionFunctions).Dictionary; /// /// Releases all resources consumed by the current . diff --git a/src/RapidField.SolidInstruments.SignalProcessing/Channel.cs b/src/RapidField.SolidInstruments.SignalProcessing/Channel.cs index aa7e0fff..dd6ca07e 100644 --- a/src/RapidField.SolidInstruments.SignalProcessing/Channel.cs +++ b/src/RapidField.SolidInstruments.SignalProcessing/Channel.cs @@ -324,7 +324,7 @@ public Task> ReadAsync(Int32 index, Int32 lookBehindLength, Int argumentOutOfRangeExceptionParameterName = nameof(lookAheadLength); } - if (argumentOutOfRangeExceptionParameterName is null == false) + if ((argumentOutOfRangeExceptionParameterName is null) == false) { return InvalidReadBehavior switch { @@ -335,9 +335,9 @@ public Task> ReadAsync(Int32 index, Int32 lookBehindLength, Int } } - var startIndex = (index - lookBehindLength); - var count = (lookBehindLength + lookAheadLength + 1); - var endIndex = (startIndex + count); + var startIndex = index - lookBehindLength; + var count = lookBehindLength + lookAheadLength + 1; + var endIndex = startIndex + count; var range = default(T[]); using (var controlToken = StateControl.Enter()) @@ -374,13 +374,13 @@ public Task> ReadAsync(Int32 index, Int32 lookBehindLength, Int for (var i = 0; i < lookBehindLength; i++) { - lookBehindList.Add(new DiscreteUnitOfOutput(range[i], (startIndex + i))); + lookBehindList.Add(new DiscreteUnitOfOutput(range[i], startIndex + i)); } for (var i = 0; i < lookAheadLength; i++) { - var adjustment = (lookBehindLength + i + 1); - lookAheadList.Add(new DiscreteUnitOfOutput(range[adjustment], (startIndex + adjustment))); + var adjustment = lookBehindLength + i + 1; + lookAheadList.Add(new DiscreteUnitOfOutput(range[adjustment], startIndex + adjustment)); } return Task.FromResult>(new SignalSample(unitOfOutput, new OutputRange(lookBehindList), new OutputRange(lookAheadList))); @@ -511,7 +511,7 @@ public String Name /// /// Gets a value indicating whether or not the output stream for the current has a fixed length. /// - public Boolean OutputLengthIsFixed => (OutputLength != UnfixedOutputLength); + public Boolean OutputLengthIsFixed => OutputLength != UnfixedOutputLength; /// /// Gets the type of a discrete unit of output value for the current . diff --git a/src/RapidField.SolidInstruments.SignalProcessing/SignalProcessor.cs b/src/RapidField.SolidInstruments.SignalProcessing/SignalProcessor.cs index 501aca64..398bbe4a 100644 --- a/src/RapidField.SolidInstruments.SignalProcessing/SignalProcessor.cs +++ b/src/RapidField.SolidInstruments.SignalProcessing/SignalProcessor.cs @@ -147,7 +147,7 @@ protected sealed override Boolean TryRead(Int32 startIndex, Int32 count, TOutput { for (var i = 0; i < count; i++) { - var index = (startIndex + i); + var index = startIndex + i; if (TryRead(index, out var outputValue)) { diff --git a/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs b/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs index 210fc544..3c48ba67 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs @@ -130,7 +130,7 @@ public override Int32 GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, B { var buffer = new BigInteger(); - var finalCharacterIndex = (charCount - 1); + var finalCharacterIndex = charCount - 1; for (var i = finalCharacterIndex; i >= 0; i--) { @@ -150,7 +150,7 @@ public override Int32 GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, B } // Copy the buffer to the output stream. - var encodedByteCount = Math.Min((bytes.Length - byteIndex), characterBytes.Length); + var encodedByteCount = Math.Min(bytes.Length - byteIndex, characterBytes.Length); Array.Copy(characterBytes, 0, bytes, byteIndex, encodedByteCount); return encodedByteCount; } diff --git a/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs b/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs index c6d19e77..e5bd590a 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs @@ -69,7 +69,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => (a == b) == false; + public static Boolean operator !=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a == b == false; /// /// Determines whether or not a specified instance is less than another specified @@ -84,7 +84,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// if the second object is earlier than the first object, otherwise . /// - public static Boolean operator <(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) == -1; + public static Boolean operator <(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) < 0; /// /// Determines whether or not a specified instance is less than or equal to another @@ -100,7 +100,7 @@ public EnhancedReadabilityGuid(Guid value) /// if the second object is earlier than or equal to the first object, otherwise /// . /// - public static Boolean operator <=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) < 1; + public static Boolean operator <=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) <= 0; /// /// Determines whether or not two specified instances are equal. @@ -114,19 +114,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// A value indicating whether or not the specified instances are equal. /// - public static Boolean operator ==(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) - { - if ((Object)a is null && (Object)b is null) - { - return true; - } - else if ((Object)a is null || (Object)b is null) - { - return false; - } - - return a.Equals(b); - } + public static Boolean operator ==(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.Equals(b); /// /// Determines whether or not a specified instance is greater than another specified @@ -141,7 +129,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// if the second object is later than the first object, otherwise . /// - public static Boolean operator >(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) == 1; + public static Boolean operator >(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) > 0; /// /// Determines whether or not a specified instance is greater than or equal to @@ -157,7 +145,7 @@ public EnhancedReadabilityGuid(Guid value) /// if the second object is later than or equal to the first object, otherwise /// . /// - public static Boolean operator >=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) > -1; + public static Boolean operator >=(EnhancedReadabilityGuid a, EnhancedReadabilityGuid b) => a.CompareTo(b) >= 0; /// /// Converts the specified representation of a time of day value to its @@ -178,15 +166,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// does not contain a valid representation of a . /// - public static EnhancedReadabilityGuid Parse(String input) - { - if (Parse(input, out var value, true)) - { - return new EnhancedReadabilityGuid(value); - } - - return default; - } + public static EnhancedReadabilityGuid Parse(String input) => Parse(input, out var value, true) ? new EnhancedReadabilityGuid(value) : default; /// /// Converts the specified representation of a time of day value to its @@ -260,7 +240,7 @@ public override Boolean Equals(Object obj) /// /// A value indicating whether or not the specified instances are equal. /// - public Boolean Equals(EnhancedReadabilityGuid other) => (Value == other.Value); + public Boolean Equals(EnhancedReadabilityGuid other) => Value == other.Value; /// /// Returns the hash code for this instance. @@ -401,7 +381,7 @@ private static Boolean Parse(String input, out Guid value, Boolean raiseExceptio [DebuggerHidden] private void Initialize(String input) { - Parse(input, out var value, true); + _ = Parse(input, out var value, true); Value = value; } diff --git a/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs b/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs index c93847f9..dd5e0d96 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs @@ -104,7 +104,7 @@ public override Int32 GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, B try { - var decodedBytes = Enumerable.Range(0, (hexadecimalString.Length / 2)).Select(index => System.Convert.ToByte(hexadecimalString.Substring((index * 2), 2), 16)).ToArray(); + var decodedBytes = Enumerable.Range(0, hexadecimalString.Length / 2).Select(index => System.Convert.ToByte(hexadecimalString.Substring(index * 2, 2), 16)).ToArray(); Array.Copy(decodedBytes, 0, bytes, byteIndex, decodedBytes.Length); return decodedBytes.Length; } diff --git a/test/RapidField.SolidInstruments.Collections.UnitTests/Extensions/ITreeNodeExtensionsTests.cs b/test/RapidField.SolidInstruments.Collections.UnitTests/Extensions/ITreeNodeExtensionsTests.cs index 4e6adb76..597c2840 100644 --- a/test/RapidField.SolidInstruments.Collections.UnitTests/Extensions/ITreeNodeExtensionsTests.cs +++ b/test/RapidField.SolidInstruments.Collections.UnitTests/Extensions/ITreeNodeExtensionsTests.cs @@ -1217,12 +1217,12 @@ public void TraverseUp_ShouldRaiseArgumentNullException_ForFunctions_WithNullPre private static readonly Func, IEnumerable, Int32> SumDownFunction = (node, childResults) => { - return (node.Value + childResults.Sum()); + return node.Value + childResults.Sum(); }; private static readonly Func, Int32, Int32> SumUpFunction = (node, parentResult) => { - return (node.Value + parentResult); + return node.Value + parentResult; }; } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.Collections.UnitTests/SimulatedInfiniteSequence.cs b/test/RapidField.SolidInstruments.Collections.UnitTests/SimulatedInfiniteSequence.cs index ecee6c7b..a59fe689 100644 --- a/test/RapidField.SolidInstruments.Collections.UnitTests/SimulatedInfiniteSequence.cs +++ b/test/RapidField.SolidInstruments.Collections.UnitTests/SimulatedInfiniteSequence.cs @@ -46,6 +46,6 @@ public SimulatedInfiniteSequence(Int32[] seedTerms) /// /// The next term in the sequence. /// - protected override Int32 CalculateNext(IEnumerable calculatedTerms) => (calculatedTerms.Last() + 1); + protected override Int32 CalculateNext(IEnumerable calculatedTerms) => calculatedTerms.Last() + 1; } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.Core.UnitTests/Concurrency/ConcurrencyControlTests.cs b/test/RapidField.SolidInstruments.Core.UnitTests/Concurrency/ConcurrencyControlTests.cs index 11269452..7c610dad 100644 --- a/test/RapidField.SolidInstruments.Core.UnitTests/Concurrency/ConcurrencyControlTests.cs +++ b/test/RapidField.SolidInstruments.Core.UnitTests/Concurrency/ConcurrencyControlTests.cs @@ -180,13 +180,13 @@ internal static void OperationLatency_ShouldBeLow(ConcurrencyControlMode mode, A // Act. var primitiveControlDuration = PerformUsingPrimitive(operations, performUsingPrimitive); var solidControlDuration = PerformUsingSolidControl(operations, mode); - var totalLatency = (solidControlDuration - primitiveControlDuration); + var totalLatency = solidControlDuration - primitiveControlDuration; var latencyPerOperation = TimeSpan.FromTicks(totalLatency.Ticks / operationCount); sumOfLatenciesPerOperation += latencyPerOperation; } // Assert. - var averageLatencyPerOperationInTicks = (sumOfLatenciesPerOperation.Ticks / iterationCount); + var averageLatencyPerOperationInTicks = sumOfLatenciesPerOperation.Ticks / iterationCount; averageLatencyPerOperationInTicks.Should().BeLessThan(latencyThresholdInTicks); } @@ -266,7 +266,7 @@ private static void TestOperation() { var numbers = new Int32[] { 3, 5, 8, 13 }; - for (var i = (numbers.Length - 2); i >= 0; i--) + for (var i = numbers.Length - 2; i >= 0; i--) { if ((numbers[i + 1] % numbers[i]) == 2) { diff --git a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs index 752f7e4f..e5a0ee4b 100644 --- a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs +++ b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs @@ -216,7 +216,7 @@ private void RandomlyModifyModelCollection(RandomNumberGenerator randomnessProvi } else { - ModelCollection.ElementAt(randomnessProvider.GetInt32(0, (collectionLength - 1))).RandomlyModify(randomnessProvider); + ModelCollection.ElementAt(randomnessProvider.GetInt32(0, collectionLength - 1)).RandomlyModify(randomnessProvider); } } diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Hashing/HashTreeTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Hashing/HashTreeTests.cs index 5f64318a..f3832810 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Hashing/HashTreeTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Hashing/HashTreeTests.cs @@ -21,7 +21,7 @@ public void Constructor_ShouldProduceDesiredResults_ForMd5() { // Arrange. var algorithm = HashingAlgorithmSpecification.Md5; - var maxBlockCount = (TreeHeightDictionary.Count - 1); + var maxBlockCount = TreeHeightDictionary.Count - 1; for (var i = 0; i <= maxBlockCount; i++) { @@ -34,7 +34,7 @@ public void Constructor_ShouldProduceDesiredResults_ForShaTwo256() { // Arrange. var algorithm = HashingAlgorithmSpecification.ShaTwo256; - var maxBlockCount = (TreeHeightDictionary.Count - 1); + var maxBlockCount = TreeHeightDictionary.Count - 1; for (var i = 0; i <= maxBlockCount; i++) { @@ -47,7 +47,7 @@ public void Constructor_ShouldProduceDesiredResults_ForShaTwo384() { // Arrange. var algorithm = HashingAlgorithmSpecification.ShaTwo384; - var maxBlockCount = (TreeHeightDictionary.Count - 1); + var maxBlockCount = TreeHeightDictionary.Count - 1; for (var i = 0; i <= maxBlockCount; i++) { @@ -60,7 +60,7 @@ public void Constructor_ShouldProduceDesiredResults_ForShaTwo512() { // Arrange. var algorithm = HashingAlgorithmSpecification.ShaTwo512; - var maxBlockCount = (TreeHeightDictionary.Count - 1); + var maxBlockCount = TreeHeightDictionary.Count - 1; for (var i = 0; i <= maxBlockCount; i++) { diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/RandomByteArrayProfile.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/RandomByteArrayProfile.cs index 858a9bc5..a51dc436 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/RandomByteArrayProfile.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/RandomByteArrayProfile.cs @@ -52,7 +52,7 @@ private void RecordValue(Byte value) foreach (var record in Records) { - var valueHasBeenRecorded = (record.Count > 0); + var valueHasBeenRecorded = record.Count > 0; if (record.Value == value) { @@ -113,7 +113,7 @@ public ByteRecord(Byte value) /// /// Gets the average length between occurrences of in the associated array. /// - public Double AverageLengthBetween => (LengthsBetween.Any() ? LengthsBetween.Average() : 0d); + public Double AverageLengthBetween => LengthsBetween.Any() ? LengthsBetween.Average() : 0d; /// /// Gets or sets the frequency of in the associated array. diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/SecureMemoryTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/SecureMemoryTests.cs index 1cf8958a..1339172f 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/SecureMemoryTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/SecureMemoryTests.cs @@ -112,7 +112,7 @@ public void GenerateHardenedRandomBytes_ShouldYieldHighEntropy() var valueRange = 256; var confidence = 0.223d; var curveTolerance = 5m; - var length = (valueRange * valueRange); + var length = valueRange * valueRange; var target = (RandomByteArrayProfile)null; var meanTarget = valueRange; var meanLowerBoundary = Convert.ToDecimal(meanTarget - (meanTarget * confidence)); @@ -243,7 +243,7 @@ public void ShouldNotLeakMemory() } finalAllocation = Convert.ToDouble(GC.GetTotalMemory(true)); - allocationRange = (finalAllocation - initialAllocation); + allocationRange = finalAllocation - initialAllocation; // Assert. allocationRange.Should().BeLessThan(length * iterationCount * (1d - confidence)); diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/CascadingSymmetricKeyTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/CascadingSymmetricKeyTests.cs index e17b63a9..e7827ecb 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/CascadingSymmetricKeyTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/CascadingSymmetricKeyTests.cs @@ -303,13 +303,13 @@ public void ToSecureMemory_ShouldReturnValidResult() // Act. using (var secureMemory = target.ToSecureMemory()) { - secureMemory.Access((plaintext => + secureMemory.Access(plaintext => { // Assert. plaintext.Should().NotBeNullOrEmpty(); plaintext.Length.Should().Be(cascadingKeyLengthInBytes); plaintext.Count(value => value == 0x00).Should().NotBe((Int32)plaintext.Length); - })); + }); } } } diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/SymmetricProcessorTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/SymmetricProcessorTests.cs index a6f30cc7..225dbe3c 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/SymmetricProcessorTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Symmetric/SymmetricProcessorTests.cs @@ -564,7 +564,7 @@ private static void Encrypt_ShouldReproduceTestVector(SymmetricAlgorithmSpecific using (var secureKeyMemory = new SecureMemory(key.Length)) { // Arrange. - var blockLengthInBytes = (blockLengthInBits / 8); + var blockLengthInBytes = blockLengthInBits / 8; var target = new SymmetricProcessor(randomnessProvider); secureKeyMemory.Access(keyMemory => { diff --git a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedEntity.cs b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedEntity.cs index 17d413c7..52f53ed8 100644 --- a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedEntity.cs +++ b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedEntity.cs @@ -57,7 +57,7 @@ protected SimulatedEntity(Guid identifier, TValue value) /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(SimulatedEntity a, SimulatedEntity b) => (a == b) == false; + public static Boolean operator !=(SimulatedEntity a, SimulatedEntity b) => a == b == false; /// /// Determines whether or not two specified instances are equal. @@ -150,7 +150,7 @@ public Boolean Equals(SimulatedEntity other) /// /// A 32-bit signed integer hash code. /// - public override Int32 GetHashCode() => (Identifier.GetHashCode() ^ Value.ToString().GetHashCode()); + public override Int32 GetHashCode() => Identifier.GetHashCode() ^ Value.ToString().GetHashCode(); /// /// Represents the entity's value. diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Data/SimulatedScalarLineSeries.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Data/SimulatedScalarLineSeries.cs index c02d4b44..14da871b 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Data/SimulatedScalarLineSeries.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Data/SimulatedScalarLineSeries.cs @@ -58,10 +58,10 @@ public SimulatedScalarLineSeries(IDictionary data) /// protected sealed override Decimal InterpolateLinear(Int32 xAxisValue, Int32 downwardXAxisValue, Decimal downwardYAxisValue, Int32 upwardXAxisValue, Decimal upwardYAxisValue) { - var yAxisRange = (upwardYAxisValue - downwardYAxisValue); + var yAxisRange = upwardYAxisValue - downwardYAxisValue; var positionInXAxisRange = Convert.ToDecimal(xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue)); - var adjustment = (yAxisRange * positionInXAxisRange); - return (downwardYAxisValue + adjustment); + var adjustment = yAxisRange * positionInXAxisRange; + return downwardYAxisValue + adjustment; } /// @@ -88,7 +88,7 @@ protected sealed override Decimal InterpolateLinear(Int32 xAxisValue, Int32 down protected sealed override Decimal InterpolateNearest(Int32 xAxisValue, Int32 downwardXAxisValue, Decimal downwardYAxisValue, Int32 upwardXAxisValue, Decimal upwardYAxisValue) { var positionInXAxisRange = xAxisValue.PositionInRange(downwardXAxisValue, upwardXAxisValue); - return (positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue); + return positionInXAxisRange < 0.5d ? downwardYAxisValue : upwardYAxisValue; } } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/AreaTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/AreaTests.cs index 012b955e..9e1439aa 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/AreaTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/AreaTests.cs @@ -20,7 +20,7 @@ public void AdditionOperator_ShouldProduceDesiredResults() var addend = new Area(2.5d); // Act. - var result = (augend + addend); + var result = augend + addend; // Assert. result.Should().Be(new Area(8.5m)); @@ -60,7 +60,7 @@ public void DivisionOperator_ShouldProduceDesiredResults() var divisor = 2.5d; // Act. - var result = (dividend / divisor); + var result = dividend / divisor; // Assert. result.Should().Be(new Area(2.4m)); @@ -283,7 +283,7 @@ public void SubtractionOperator_ShouldProduceDesiredResults() var minuend = new Area(2.5d); // Act. - var result = (subtrahend - minuend); + var result = subtrahend - minuend; // Assert. result.Should().Be(new Area(3.5m)); diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/GeographicCoordinatesTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/GeographicCoordinatesTests.cs index 6ce8d491..29653ece 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/GeographicCoordinatesTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/GeographicCoordinatesTests.cs @@ -25,8 +25,8 @@ public void EqualityComparer_ShouldReturnValidResult() var targetThree = new GeographicCoordinates(latitude, longitudeTwo); // Assert. - (targetOne.Equals(targetTwo)).Should().BeTrue(); - (targetTwo.Equals(targetThree)).Should().BeFalse(); + targetOne.Equals(targetTwo).Should().BeTrue(); + targetTwo.Equals(targetThree).Should().BeFalse(); (targetTwo == targetOne).Should().BeTrue(); (targetThree == targetOne).Should().BeFalse(); (targetOne != targetThree).Should().BeTrue(); diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/LengthTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/LengthTests.cs index 12df4fa2..28656a15 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/LengthTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/LengthTests.cs @@ -20,7 +20,7 @@ public void AdditionOperator_ShouldProduceDesiredResults() var addend = new Length(2.5d); // Act. - var result = (augend + addend); + var result = augend + addend; // Assert. result.Should().Be(new Length(8.5m)); @@ -61,7 +61,7 @@ public void DivisionOperator_ShouldProduceDesiredResults() var expectedQuotient = new Length(2.4d); // Act. - var result = (dividend / divisor); + var result = dividend / divisor; // Assert. result.Should().Be(new Length(2.4m)); @@ -285,7 +285,7 @@ public void SubtractionOperator_ShouldProduceDesiredResults() var expectedDifference = new Length(3.5d); // Act. - var result = (subtrahend - minuend); + var result = subtrahend - minuend; // Assert. result.Should().Be(new Length(3.5m)); diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/MassTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/MassTests.cs index 5431c62d..2c4a22cf 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/MassTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/MassTests.cs @@ -20,7 +20,7 @@ public void AdditionOperator_ShouldProduceDesiredResults() var addend = new Mass(2.5d); // Act. - var result = (augend + addend); + var result = augend + addend; // Assert. result.Should().Be(new Mass(8.5m)); @@ -60,7 +60,7 @@ public void DivisionOperator_ShouldProduceDesiredResults() var divisor = 2.5d; // Act. - var result = (dividend / divisor); + var result = dividend / divisor; // Assert. result.Should().Be(new Mass(2.4m)); @@ -223,7 +223,7 @@ public void SubtractionOperator_ShouldProduceDesiredResults() var minuend = new Mass(2.5d); // Act. - var result = (subtrahend - minuend); + var result = subtrahend - minuend; // Assert. result.Should().Be(new Mass(3.5m)); diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/TemperatureTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/TemperatureTests.cs index 81984242..5e6b3b95 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/TemperatureTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/TemperatureTests.cs @@ -33,7 +33,7 @@ public void AdditionOperator_ShouldProduceDesiredResults() var addend = new Temperature(2.5d); // Act. - var result = (augend + addend); + var result = augend + addend; // Assert. result.Should().Be(new Temperature(8.5m)); @@ -73,7 +73,7 @@ public void DivisionOperator_ShouldProduceDesiredResults() var divisor = 2.5d; // Act. - var result = (dividend / divisor); + var result = dividend / divisor; // Assert. result.Should().Be(new Temperature(2.4m)); @@ -191,7 +191,7 @@ public void SubtractionOperator_ShouldProduceDesiredResults() var minuend = new Temperature(2.5d); // Act. - var result = (subtrahend - minuend); + var result = subtrahend - minuend; // Assert. result.Should().Be(new Temperature(3.5m)); diff --git a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/VolumeTests.cs b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/VolumeTests.cs index 35b86a64..5638c150 100644 --- a/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/VolumeTests.cs +++ b/test/RapidField.SolidInstruments.Mathematics.UnitTests/Physics/VolumeTests.cs @@ -21,7 +21,7 @@ public void AdditionOperator_ShouldProduceDesiredResults() var addend = new Volume(2.5d); // Act. - var result = (augend + addend); + var result = augend + addend; // Assert. result.Should().Be(new Volume(8.5m)); @@ -61,7 +61,7 @@ public void DivisionOperator_ShouldProduceDesiredResults() var divisor = 2.5d; // Act. - var result = (dividend / divisor); + var result = dividend / divisor; // Assert. result.Should().Be(new Volume(2.4m)); @@ -299,7 +299,7 @@ public void SubtractionOperator_ShouldProduceDesiredResults() var minuend = new Volume(2.5d); // Act. - var result = (subtrahend - minuend); + var result = subtrahend - minuend; // Assert. result.Should().Be(new Volume(3.5m)); diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/CreateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/CreateDomainModelCommand.cs index 07463b31..adb5ca5f 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/CreateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/CreateDomainModelCommand.cs @@ -121,7 +121,7 @@ public CreateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateCustomerEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/DeleteDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/DeleteDomainModelCommand.cs index 1ded2144..4bd87476 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/DeleteDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/DeleteDomainModelCommand.cs @@ -121,7 +121,7 @@ public DeleteDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteCustomerEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/UpdateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/UpdateDomainModelCommand.cs index 59e3c78d..1fbd6f3e 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/UpdateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Customer/UpdateDomainModelCommand.cs @@ -121,7 +121,7 @@ public UpdateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateCustomerEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/CreateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/CreateDomainModelCommand.cs index a43c3ae6..1ef4a860 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/CreateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/CreateDomainModelCommand.cs @@ -121,7 +121,7 @@ public CreateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateCustomerOrderEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/DeleteDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/DeleteDomainModelCommand.cs index 25e3052b..9672070b 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/DeleteDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/DeleteDomainModelCommand.cs @@ -121,7 +121,7 @@ public DeleteDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteCustomerOrderEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/UpdateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/UpdateDomainModelCommand.cs index 2e102425..a231e0b3 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/UpdateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/CustomerOrder/UpdateDomainModelCommand.cs @@ -121,7 +121,7 @@ public UpdateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateCustomerOrderEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/CreateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/CreateDomainModelCommand.cs index be3b856a..0a001077 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/CreateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/CreateDomainModelCommand.cs @@ -121,7 +121,7 @@ public CreateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateProductEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/DeleteDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/DeleteDomainModelCommand.cs index 5e3ef64b..cb5db23f 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/DeleteDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/DeleteDomainModelCommand.cs @@ -121,7 +121,7 @@ public DeleteDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteProductEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/UpdateDomainModelCommand.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/UpdateDomainModelCommand.cs index 05104874..7d7a838f 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/UpdateDomainModelCommand.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Commands/ModelState/Product/UpdateDomainModelCommand.cs @@ -121,7 +121,7 @@ public UpdateDomainModelCommand(DomainModel model, IEnumerable labels, G } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateProductEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelCreatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelCreatedEvent.cs index 08978209..d90d4239 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelCreatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelCreatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerCreatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelDeletedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelDeletedEvent.cs index 598ebcd0..95122697 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelDeletedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelDeletedEvent.cs @@ -172,7 +172,7 @@ public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerDeletedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelUpdatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelUpdatedEvent.cs index 226401f8..56294c49 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelUpdatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Customer/DomainModelUpdatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerUpdatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelCreatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelCreatedEvent.cs index 2e10a64e..a368fee3 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelCreatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelCreatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderCreatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelDeletedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelDeletedEvent.cs index 0f7d365b..eb1df9c6 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelDeletedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelDeletedEvent.cs @@ -172,7 +172,7 @@ public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderDeletedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelUpdatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelUpdatedEvent.cs index 6282552e..2cb2abe6 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelUpdatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/CustomerOrder/DomainModelUpdatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderUpdatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelCreatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelCreatedEvent.cs index ad9284c5..42bb42a4 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelCreatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelCreatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelCreatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductCreatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelDeletedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelDeletedEvent.cs index a1511ac8..4f945382 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelDeletedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelDeletedEvent.cs @@ -172,7 +172,7 @@ public DomainModelDeletedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductDeletedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelUpdatedEvent.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelUpdatedEvent.cs index 781c177b..e64093e8 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelUpdatedEvent.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Events/ModelState/Product/DomainModelUpdatedEvent.cs @@ -172,7 +172,7 @@ public DomainModelUpdatedEvent(DomainModel model, IEnumerable labels, Ev } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductUpdatedEvent"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/CreateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/CreateDomainModelCommandMessage.cs index daf1f896..9d891dac 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/CreateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/CreateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public CreateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateCustomerCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/DeleteDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/DeleteDomainModelCommandMessage.cs index 8b66970d..6620c9f7 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/DeleteDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/DeleteDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public DeleteDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteCustomerCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/UpdateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/UpdateDomainModelCommandMessage.cs index 1bbdba4a..b67d4fb6 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/UpdateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Customer/UpdateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public UpdateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateCustomerCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/CreateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/CreateDomainModelCommandMessage.cs index 0b87e6f1..eb92dd5f 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/CreateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/CreateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public CreateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateCustomerOrderCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/DeleteDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/DeleteDomainModelCommandMessage.cs index d70960bf..6d7a54fa 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/DeleteDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/DeleteDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public DeleteDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteCustomerOrderCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/UpdateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/UpdateDomainModelCommandMessage.cs index 10db61ca..a23958f4 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/UpdateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/CustomerOrder/UpdateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public UpdateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateCustomerOrderCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/CreateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/CreateDomainModelCommandMessage.cs index fb58eb3b..a796eeb4 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/CreateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/CreateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public CreateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CreateProductCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/DeleteDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/DeleteDomainModelCommandMessage.cs index 8497c504..640f8555 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/DeleteDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/DeleteDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public DeleteDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "DeleteProductCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/UpdateDomainModelCommandMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/UpdateDomainModelCommandMessage.cs index db7ed669..7545cd04 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/UpdateDomainModelCommandMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Command/ModelState/Product/UpdateDomainModelCommandMessage.cs @@ -45,7 +45,7 @@ public UpdateDomainModelCommandMessage(DomainModelCommand commandObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "UpdateProductCommandMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelCreatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelCreatedEventMessage.cs index 59aca6f9..90fba790 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelCreatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelCreatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelCreatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerCreatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelDeletedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelDeletedEventMessage.cs index 83ecd552..3b1845bf 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelDeletedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelDeletedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelDeletedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerDeletedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelUpdatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelUpdatedEventMessage.cs index 345701d3..df8b66af 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelUpdatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Customer/DomainModelUpdatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelUpdatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerUpdatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelCreatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelCreatedEventMessage.cs index 35cff2d0..2a25dfcc 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelCreatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelCreatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelCreatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderCreatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelDeletedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelDeletedEventMessage.cs index 9c15a585..8075c025 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelDeletedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelDeletedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelDeletedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderDeletedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelUpdatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelUpdatedEventMessage.cs index 06be2ba5..1fbed5d6 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelUpdatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/CustomerOrder/DomainModelUpdatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelUpdatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrderUpdatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelCreatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelCreatedEventMessage.cs index db830094..78cca428 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelCreatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelCreatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelCreatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductCreatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelDeletedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelDeletedEventMessage.cs index 9838d7cc..2d6159cf 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelDeletedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelDeletedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelDeletedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductDeletedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelUpdatedEventMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelUpdatedEventMessage.cs index e5bcf74f..cf9421cf 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelUpdatedEventMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/Event/ModelState/Product/DomainModelUpdatedEventMessage.cs @@ -43,7 +43,7 @@ public DomainModelUpdatedEventMessage(DomainModelEvent eventObject) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "ProductUpdatedEventMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/RequestMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/RequestMessage.cs index 333cd01e..72956612 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/RequestMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/RequestMessage.cs @@ -39,7 +39,7 @@ public RequestMessage(Guid correlationIdentifier) } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "PingRequestMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/ResponseMessage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/ResponseMessage.cs index 1bfe5081..39943ab5 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/ResponseMessage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Messages/RequestResponse/Ping/ResponseMessage.cs @@ -44,7 +44,7 @@ public ResponseMessage(Guid requestMessageIdentifier, Guid correlationIdentifier } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "PingResponseMessage"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs index 2ec00b71..b4bec699 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs @@ -58,7 +58,7 @@ public String Name } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "Customer"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/CustomerOrder/DomainModel.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/CustomerOrder/DomainModel.cs index 80f4b1ae..5f9b069d 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/CustomerOrder/DomainModel.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/CustomerOrder/DomainModel.cs @@ -99,7 +99,7 @@ public ICollection Products public Decimal TotalCost => Products.Select(product => product.Price ?? 0m).Sum(); /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "CustomerOrder"; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs index 499f89e7..ebd95850 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs @@ -74,7 +74,7 @@ public Decimal? Price } /// - /// Represents the name that is used when representing this current type in serialization and transport contexts. + /// Represents the name that is used when representing this type in serialization and transport contexts. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const String DataContractName = "Product"; diff --git a/test/RapidField.SolidInstruments.Messaging.UnitTests/SimulatedObject.cs b/test/RapidField.SolidInstruments.Messaging.UnitTests/SimulatedObject.cs index 93d1b916..fdb27da3 100644 --- a/test/RapidField.SolidInstruments.Messaging.UnitTests/SimulatedObject.cs +++ b/test/RapidField.SolidInstruments.Messaging.UnitTests/SimulatedObject.cs @@ -41,7 +41,7 @@ public SimulatedObject() /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(SimulatedObject a, SimulatedObject b) => (a == b) == false; + public static Boolean operator !=(SimulatedObject a, SimulatedObject b) => a == b == false; /// /// Determines whether or not two specified instances are equal. @@ -123,19 +123,19 @@ public Boolean Equals(SimulatedObject other) { return false; } - else if (DecimalValues is null && other.DecimalValues is null == false) + else if (DecimalValues is null && (other.DecimalValues is null) == false) { return false; } - else if (DecimalValues is null == false && other.DecimalValues is null) + else if ((DecimalValues is null) == false && other.DecimalValues is null) { return false; } - else if (NestedObjects is null && other.NestedObjects is null == false) + else if (NestedObjects is null && (other.NestedObjects is null) == false) { return false; } - else if (NestedObjects is null == false && other.NestedObjects is null) + else if ((NestedObjects is null) == false && other.NestedObjects is null) { return false; } diff --git a/test/RapidField.SolidInstruments.Serialization.UnitTests/SimulatedObject.cs b/test/RapidField.SolidInstruments.Serialization.UnitTests/SimulatedObject.cs index d7f84062..46186f7b 100644 --- a/test/RapidField.SolidInstruments.Serialization.UnitTests/SimulatedObject.cs +++ b/test/RapidField.SolidInstruments.Serialization.UnitTests/SimulatedObject.cs @@ -41,7 +41,7 @@ public SimulatedObject() /// /// A value indicating whether or not the specified instances are not equal. /// - public static Boolean operator !=(SimulatedObject a, SimulatedObject b) => (a == b) == false; + public static Boolean operator !=(SimulatedObject a, SimulatedObject b) => a == b == false; /// /// Determines whether or not two specified instances are equal. @@ -123,19 +123,19 @@ public Boolean Equals(SimulatedObject other) { return false; } - else if (DecimalValues is null && other.DecimalValues is null == false) + else if (DecimalValues is null && (other.DecimalValues is null) == false) { return false; } - else if (DecimalValues is null == false && other.DecimalValues is null) + else if ((DecimalValues is null) == false && other.DecimalValues is null) { return false; } - else if (NestedObjects is null && other.NestedObjects is null == false) + else if (NestedObjects is null && (other.NestedObjects is null) == false) { return false; } - else if (NestedObjects is null == false && other.NestedObjects is null) + else if ((NestedObjects is null) == false && other.NestedObjects is null) { return false; } diff --git a/test/RapidField.SolidInstruments.SignalProcessing.UnitTests/SimulatedSignalProcessor.cs b/test/RapidField.SolidInstruments.SignalProcessing.UnitTests/SimulatedSignalProcessor.cs index 6ad6d960..aaa5f466 100644 --- a/test/RapidField.SolidInstruments.SignalProcessing.UnitTests/SimulatedSignalProcessor.cs +++ b/test/RapidField.SolidInstruments.SignalProcessing.UnitTests/SimulatedSignalProcessor.cs @@ -57,7 +57,7 @@ protected sealed override Boolean TryRead(SimulatedChannelCollection inputChanne var channelAReadTask = inputChannels.ChannelA.ReadAsync(index); var channelBReadTask = inputChannels.ChannelB.ReadAsync(index); Task.WaitAll(channelAReadTask, channelBReadTask); - outputValue = (settings.Factor * (channelAReadTask.Result.Value + channelBReadTask.Result.Value)); + outputValue = settings.Factor * (channelAReadTask.Result.Value + channelBReadTask.Result.Value); return true; } }