diff --git a/.editorconfig b/.editorconfig
index 3856cdf..56b46ef 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -83,6 +83,7 @@ dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
+dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
diff --git a/Archive/.editorconfig b/Archive/.editorconfig
new file mode 100644
index 0000000..2220133
--- /dev/null
+++ b/Archive/.editorconfig
@@ -0,0 +1,243 @@
+[*.cs]
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_labels = one_less_than_current
+csharp_indent_switch_labels = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+csharp_prefer_braces = false
+csharp_prefer_simple_default_expression = true:warning
+csharp_prefer_simple_using_statement = true:warning
+csharp_prefer_static_local_function = true:warning
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = false
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
+csharp_style_allow_embedded_statements_on_same_line_experimental = true
+csharp_style_conditional_delegate_call = true
+csharp_style_deconstructed_variable_declaration = false
+csharp_style_expression_bodied_accessors = when_on_single_line:warning
+csharp_style_expression_bodied_constructors = when_on_single_line:warning
+csharp_style_expression_bodied_indexers = when_on_single_line:warning
+csharp_style_expression_bodied_lambdas = when_on_single_line:warning
+csharp_style_expression_bodied_local_functions = when_on_single_line:warning
+csharp_style_expression_bodied_methods = when_on_single_line:warning
+csharp_style_expression_bodied_operators = when_on_single_line:warning
+csharp_style_expression_bodied_properties = when_on_single_line:warning
+csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
+csharp_style_inlined_variable_declaration = false
+csharp_style_namespace_declarations = file_scoped:warning
+csharp_style_pattern_local_over_anonymous_function = true:warning
+csharp_style_pattern_matching_over_as_with_null_check = true:warning
+csharp_style_pattern_matching_over_is_with_cast_check = true:warning
+csharp_style_prefer_index_operator = false:warning
+csharp_style_prefer_not_pattern = true:warning
+csharp_style_prefer_null_check_over_type_check = true
+csharp_style_prefer_pattern_matching = true:warning
+csharp_style_prefer_range_operator = false:warning
+csharp_style_prefer_switch_expression = true:warning
+csharp_style_throw_expression = true
+csharp_style_unused_value_assignment_preference = discard_variable:warning
+csharp_style_unused_value_expression_statement_preference = discard_variable:warning
+csharp_style_var_elsewhere = false:warning
+csharp_style_var_for_built_in_types = false:warning
+csharp_style_var_when_type_is_apparent = false:warning
+csharp_using_directive_placement = outside_namespace
+dotnet_code_quality_unused_parameters = all
+dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
+dotnet_code_quality.CAXXXX.api_surface = private, internal
+dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations
+dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
+dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
+dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
+dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
+dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
+dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
+dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter
+dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
+dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
+dotnet_naming_rule.class_should_be_pascal_case.severity = warning
+dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.class_should_be_pascal_case.symbols = class
+dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
+dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
+dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
+dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
+dotnet_naming_rule.event_should_be_pascal_case.severity = warning
+dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.event_should_be_pascal_case.symbols = event
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.method_should_be_pascal_case.severity = warning
+dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.method_should_be_pascal_case.symbols = method
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
+dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
+dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
+dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
+dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
+dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
+dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
+dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
+dotnet_naming_rule.property_should_be_pascal_case.severity = warning
+dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.property_should_be_pascal_case.symbols = property
+dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
+dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
+dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
+dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
+dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
+dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
+dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
+dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
+dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
+dotnet_naming_rule.types_should_be_pascal_case.severity = warning
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
+dotnet_naming_style.private_of_internal_field.required_prefix = _
+dotnet_naming_style.private_of_internal_field.required_suffix =
+dotnet_naming_style.private_of_internal_field.word_separator =
+dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.abstract_method.applicable_kinds = method
+dotnet_naming_symbols.abstract_method.required_modifiers = abstract
+dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.class.applicable_kinds = class
+dotnet_naming_symbols.class.required_modifiers =
+dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.delegate.applicable_kinds = delegate
+dotnet_naming_symbols.delegate.required_modifiers =
+dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.enum.applicable_kinds = enum
+dotnet_naming_symbols.enum.required_modifiers =
+dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.event.applicable_kinds = event
+dotnet_naming_symbols.event.required_modifiers =
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.required_modifiers =
+dotnet_naming_symbols.method.applicable_accessibilities = public
+dotnet_naming_symbols.method.applicable_kinds = method
+dotnet_naming_symbols.method.required_modifiers =
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.required_modifiers =
+dotnet_naming_symbols.private_method.applicable_accessibilities = private
+dotnet_naming_symbols.private_method.applicable_kinds = method
+dotnet_naming_symbols.private_method.required_modifiers =
+dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
+dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
+dotnet_naming_symbols.private_or_internal_field.required_modifiers =
+dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
+dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
+dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
+dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.property.applicable_kinds = property
+dotnet_naming_symbols.property.required_modifiers =
+dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
+dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
+dotnet_naming_symbols.public_or_protected_field.required_modifiers =
+dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.static_field.applicable_kinds = field
+dotnet_naming_symbols.static_field.required_modifiers = static
+dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.static_method.applicable_kinds = method
+dotnet_naming_symbols.static_method.required_modifiers = static
+dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.struct.applicable_kinds = struct
+dotnet_naming_symbols.struct.required_modifiers =
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.required_modifiers =
+dotnet_remove_unnecessary_suppression_exclusions = 0
+dotnet_separate_import_directive_groups = false
+dotnet_sort_system_directives_first = false
+dotnet_style_allow_multiple_blank_lines_experimental = false:warning
+dotnet_style_allow_statement_immediately_after_block_experimental = true
+dotnet_style_coalesce_expression = true
+dotnet_style_collection_initializer = true:warning
+dotnet_style_explicit_tuple_names = true:warning
+dotnet_style_namespace_match_folder = true
+dotnet_style_null_propagation = true:warning
+dotnet_style_object_initializer = true:warning
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
+dotnet_style_predefined_type_for_locals_parameters_members = true
+dotnet_style_predefined_type_for_member_access = true
+dotnet_style_prefer_auto_properties = true:warning
+dotnet_style_prefer_compound_assignment = true:warning
+dotnet_style_prefer_conditional_expression_over_assignment = false
+dotnet_style_prefer_conditional_expression_over_return = false
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
+dotnet_style_prefer_inferred_tuple_names = true:warning
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
+dotnet_style_prefer_simplified_boolean_expressions = true:warning
+dotnet_style_prefer_simplified_interpolation = true
+dotnet_style_qualification_for_event = false:error
+dotnet_style_qualification_for_field = false
+dotnet_style_qualification_for_method = false:error
+dotnet_style_qualification_for_property = false:error
+dotnet_style_readonly_field = true:warning
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+end_of_line = crlf
+file_header_template = unset
+indent_size = 4
+indent_style = space
+insert_final_newline = false
+root = true
+tab_width = 4
+# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
+# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
+# https://github.com/dotnet/project-system/blob/main/.editorconfig
\ No newline at end of file
diff --git a/Archive/ApiControllers/ReactorsController.cs b/Archive/ApiControllers/ReactorsController.cs
new file mode 100644
index 0000000..7707cfb
--- /dev/null
+++ b/Archive/ApiControllers/ReactorsController.cs
@@ -0,0 +1,99 @@
+using Microsoft.AspNetCore.Mvc;
+using System.Linq;
+
+namespace OI.Metrology.Archive.ApiContollers;
+
+using OI.Metrology.Archive.Models;
+using OI.Metrology.Shared.Repositories;
+using System.Text.Json;
+
+public class ReactorsController : Controller
+{
+
+ private readonly IMetrologyRepo _Repo;
+ private readonly AppSettings _AppSettings;
+
+ public ReactorsController(AppSettings appSettings, IMetrologyRepo repo)
+ {
+ _Repo = repo;
+ _AppSettings = appSettings;
+ }
+
+ private static int[] EvenReactors()
+ {
+ int[] results = new int[] {
+ 20,
+ 22,
+ 24,
+ 26,
+ 28,
+ 30,
+ 32,
+ 34,
+ 36,
+ 38,
+ 40,
+ 42,
+ 44,
+ 46,
+ 48,
+ 50,
+ 52,
+ 54,
+ 56,
+ 58,
+ 60,
+ 62,
+ 64,
+ 66,
+ 68,
+ 70,
+ 72,
+ 74
+ };
+ return results;
+ }
+
+ private static int[] OddReactors()
+ {
+ int[] results = new int[] {
+ 21,
+ 23,
+ 25,
+ 27,
+ 29,
+ 31,
+ 33,
+ 35,
+ 37,
+ 39,
+ 41,
+ 43,
+ 45,
+ 47,
+ 49,
+ 51,
+ 53,
+ 55,
+ 57,
+ 59,
+ 61,
+ 63,
+ 65,
+ 73,
+ 75,
+ 77,
+ 79
+ };
+ return results;
+ }
+
+ [HttpGet("/api/reactors/{even}")]
+ public IActionResult Index(bool even)
+ {
+ int[] n = even ? EvenReactors() : OddReactors();
+ var r = n.Select(l => new { Name = $"R{l}", Id = l });
+ return Json(r, new JsonSerializerOptions { PropertyNamingPolicy = null, WriteIndented = true });
+ }
+
+}
\ No newline at end of file
diff --git a/Archive/Archive.csproj b/Archive/Archive.csproj
index 7baedc6..38ac565 100644
--- a/Archive/Archive.csproj
+++ b/Archive/Archive.csproj
@@ -14,6 +14,9 @@
win-x64
net6.0
+
+
+
@@ -28,23 +31,17 @@
-
-
-
+
-
-
-
-
-
-
+
+
+
+
-
-
-
+
diff --git a/Archive/Controllers/PagesController.cs b/Archive/Controllers/PagesController.cs
index fcf25ad..980be34 100644
--- a/Archive/Controllers/PagesController.cs
+++ b/Archive/Controllers/PagesController.cs
@@ -122,4 +122,9 @@ public class PagesController : Controller
return View(results);
}
+ [HttpGet]
+ [Route("/Reactor")]
+ [Route("/Metrology/Reactor")]
+ public IActionResult Reactor() => View(new RunInfo());
+
}
\ No newline at end of file
diff --git a/Archive/Models/Binder/AppSettings.cs b/Archive/Models/Binder/AppSettings.cs
index 5b416de..e7ea7d8 100644
--- a/Archive/Models/Binder/AppSettings.cs
+++ b/Archive/Models/Binder/AppSettings.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Configuration;
+using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
@@ -36,6 +37,36 @@ public class AppSettings
private static Models.AppSettings Get(AppSettings appSettings)
{
Models.AppSettings result;
+ if (appSettings.ApiLoggingContentTypes is null)
+ throw new NullReferenceException(nameof(ApiLoggingContentTypes));
+ if (appSettings.ApiLoggingPathPrefixes is null)
+ throw new NullReferenceException(nameof(ApiLoggingPathPrefixes));
+ if (appSettings.ApiLogPath is null)
+ throw new NullReferenceException(nameof(ApiLogPath));
+ if (appSettings.AttachmentPath is null)
+ throw new NullReferenceException(nameof(AttachmentPath));
+ if (appSettings.BuildNumber is null)
+ throw new NullReferenceException(nameof(BuildNumber));
+ if (appSettings.Company is null)
+ throw new NullReferenceException(nameof(Company));
+ if (appSettings.ConnectionString is null)
+ throw new NullReferenceException(nameof(ConnectionString));
+ if (appSettings.GitCommitSeven is null)
+ throw new NullReferenceException(nameof(GitCommitSeven));
+ if (appSettings.InboundApiAllowedIPList is null)
+ throw new NullReferenceException(nameof(InboundApiAllowedIPList));
+ if (appSettings.MonAResource is null)
+ throw new NullReferenceException(nameof(MonAResource));
+ if (appSettings.MonASite is null)
+ throw new NullReferenceException(nameof(MonASite));
+ if (appSettings.Oi2SqlConnectionString is null)
+ throw new NullReferenceException(nameof(Oi2SqlConnectionString));
+ if (appSettings.OIExportPath is null)
+ throw new NullReferenceException(nameof(OIExportPath));
+ if (appSettings.URLs is null)
+ throw new NullReferenceException(nameof(URLs));
+ if (appSettings.WorkingDirectoryName is null)
+ throw new NullReferenceException(nameof(WorkingDirectoryName));
result = new(
appSettings.ApiLoggingContentTypes,
appSettings.ApiLoggingPathPrefixes,
diff --git a/Archive/Program.cs b/Archive/Program.cs
index 9cb14c0..5e5135d 100644
--- a/Archive/Program.cs
+++ b/Archive/Program.cs
@@ -21,6 +21,8 @@ namespace OI.Metrology.Archive;
public class Program
{
+ internal readonly AppSettings _AppSettings;
+
private static (string, WebApplicationOptions) Get(string[] args)
{
string webRootPath;
@@ -50,10 +52,10 @@ public class Program
(string assemblyName, WebApplicationOptions _) = Get(args);
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
_ = webApplicationBuilder.Configuration.AddUserSecrets();
- AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
- if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
+ AppSettings _AppSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
+ if (string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName))
throw new Exception("Working directory name must have a value!");
- string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
+ string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, _AppSettings.WorkingDirectoryName);
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
@@ -63,10 +65,10 @@ public class Program
{
_ = webApplicationBuilder.Services.Configure(options => options.SuppressModelStateInvalidFilter = true);
_ = webApplicationBuilder.Services.AddControllersWithViews();
- _ = new MetrologyRepo(new SQLDbConnectionFactory(appSettings), null);
+ _ = new MetrologyRepo(new SQLDbConnectionFactory(_AppSettings), null);
_ = webApplicationBuilder.Services.AddDistributedMemoryCache();
_ = webApplicationBuilder.Services.AddMemoryCache();
- _ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
+ _ = webApplicationBuilder.Services.AddSingleton(_ => _AppSettings);
_ = webApplicationBuilder.Services.AddScoped();
_ = webApplicationBuilder.Services.AddScoped();
_ = webApplicationBuilder.Services.AddScoped();
@@ -97,7 +99,7 @@ public class Program
}
else
{
- if (string.IsNullOrEmpty(appSettings.URLs))
+ if (string.IsNullOrEmpty(_AppSettings.URLs))
{
Environment.ExitCode = -1;
webApplication.Lifetime.StopApplication();
diff --git a/Archive/Repositories/MetrologyRepo.cs b/Archive/Repositories/MetrologyRepo.cs
index 78ce1d9..6b52937 100644
--- a/Archive/Repositories/MetrologyRepo.cs
+++ b/Archive/Repositories/MetrologyRepo.cs
@@ -227,8 +227,7 @@ public class MetrologyRepo : IMetrologyRepo
parmnumber += 1;
object sqlValue = ((JValue)jp.Value).Value;
- if (sqlValue == null)
- sqlValue = DBNull.Value;
+ sqlValue ??= DBNull.Value;
AddParameter(cmd, parmname, sqlValue);
}
@@ -251,8 +250,7 @@ public class MetrologyRepo : IMetrologyRepo
parmnumber += 1;
object sqlValue = ((JValue)jp.Value).Value;
- if (sqlValue == null)
- sqlValue = DBNull.Value;
+ sqlValue ??= DBNull.Value;
AddParameter(cmd, parmname, sqlValue);
}
diff --git a/Archive/Views/Pages/Reactor.cshtml b/Archive/Views/Pages/Reactor.cshtml
new file mode 100644
index 0000000..5fcf203
--- /dev/null
+++ b/Archive/Views/Pages/Reactor.cshtml
@@ -0,0 +1,377 @@
+@model OI.Metrology.Shared.ViewModels.RunInfo
+@{
+ ViewData["Title"] = "Reactor";
+}
+
+
+Reactor
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj
index 9e48445..fb6cdae 100644
--- a/Shared/Shared.csproj
+++ b/Shared/Shared.csproj
@@ -30,7 +30,7 @@
Linux
-
+
\ No newline at end of file
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 9deff53..11ef256 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -27,17 +27,19 @@
Linux
-
+
+
-
+
+
-
-
+
+
-
+
diff --git a/Tests/UnitTestExample.cs b/Tests/UnitTestExample.cs
index 7b729a8..97ea732 100644
--- a/Tests/UnitTestExample.cs
+++ b/Tests/UnitTestExample.cs
@@ -27,7 +27,7 @@ public class UnitTestExample
.AddEnvironmentVariables()
.AddJsonFile("appsettings.Development.json");
configurationRoot = configurationBuilder.Build();
- appSettings = OI.Metrology.Tests.Models.Binder.AppSettings.Get(configurationRoot);
+ appSettings = Models.Binder.AppSettings.Get(configurationRoot);
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
diff --git a/Tests/UnitTestReactorController.cs b/Tests/UnitTestReactorController.cs
new file mode 100644
index 0000000..614bf9c
--- /dev/null
+++ b/Tests/UnitTestReactorController.cs
@@ -0,0 +1,109 @@
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.Extensions.DependencyInjection;
+using Serilog;
+using System.Net;
+
+namespace OI.Metrology.Tests;
+
+[TestClass]
+public class UnitTestReactorController
+{
+
+ private static TestContext? _TestContext;
+ private static WebApplicationFactory? _WebApplicationFactory;
+
+ [ClassInitialize]
+ public static void ClassInitAsync(TestContext testContext)
+ {
+ _TestContext = testContext;
+ _WebApplicationFactory = new WebApplicationFactory();
+ }
+
+ [TestMethod]
+ public async Task GetReactors_ShouldReturnAllReactorsAsync()
+ {
+ HttpResponseMessage httpResponseMessage;
+ if (_WebApplicationFactory is null)
+ throw new NullReferenceException(nameof(_WebApplicationFactory));
+ HttpClient httpClient = _WebApplicationFactory.CreateClient();
+ ILogger log = Log.ForContext();
+ log.Information("Starting Web Application");
+ IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
+ Archive.Models.AppSettings appSettings = serviceProvider.GetRequiredService();
+ httpResponseMessage = await httpClient.GetAsync($"api/{nameof(Archive.ApiContollers.ReactorsController)[..^10]}/true");
+ Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
+ Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
+ httpResponseMessage = await httpClient.GetAsync($"api/{nameof(Archive.ApiContollers.ReactorsController)[..^10]}/false");
+ Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
+ // string result = await httpResponseMessage.Content.ReadAsStringAsync();
+ // Assert.AreEqual("\"Sample Name 1\"", result);
+ httpClient.Dispose();
+ log.Information($"{_TestContext?.TestName} completed");
+ }
+
+ // [TestMethod]
+ // public void GetAllProducts_ShouldReturnAllProducts()
+ // {
+ // var testProducts = GetTestProducts();
+ // var controller = new OI.Metrology.Archive.ApiContollers.ReactorsController(testProducts);
+
+ // var result = controller.GetAllProducts() as List;
+ // Assert.AreEqual(testProducts.Count, result.Count);
+ // }
+
+ // [TestMethod]
+ // public async Task GetAllProductsAsync_ShouldReturnAllProducts()
+ // {
+ // var testProducts = GetTestProducts();
+ // var controller = new OI.Metrology.Archive.ApiContollers.ReactorsController(testProducts);
+
+ // var result = await controller.GetAllProductsAsync() as List;
+ // Assert.AreEqual(testProducts.Count, result.Count);
+ // }
+
+ // [TestMethod]
+ // public void GetProduct_ShouldReturnCorrectProduct()
+ // {
+ // var testProducts = GetTestProducts();
+ // var controller = new OI.Metrology.Archive.ApiContollers.ReactorsController(testProducts);
+
+ // var result = controller.GetProduct(4) as OkNegotiatedContentResult;
+ // Assert.IsNotNull(result);
+ // Assert.AreEqual(testProducts[3].Name, result.Content.Name);
+ // }
+
+ // [TestMethod]
+ // public async Task GetProductAsync_ShouldReturnCorrectProduct()
+ // {
+ // var testProducts = GetTestProducts();
+ // var controller = new OI.Metrology.Archive.ApiContollers.ReactorsController(testProducts);
+
+ // var result = await controller.GetProductAsync(4) as OkNegotiatedContentResult;
+ // Assert.IsNotNull(result);
+ // Assert.AreEqual(testProducts[3].Name, result.Content.Name);
+ // }
+
+ // [TestMethod]
+ // public void GetProduct_ShouldNotFindProduct()
+ // {
+ // var controller = new OI.Metrology.Archive.ApiContollers.ReactorsController(GetTestProducts());
+
+ // var result = controller.GetProduct(999);
+ // Assert.IsInstanceOfType(result, typeof(NotFoundResult));
+ // }
+
+ // private List GetTestProducts()
+ // {
+ // var testProducts = new List();
+ // testProducts.Add(new Product { Id = 1, Name = "Demo1", Price = 1 });
+ // testProducts.Add(new Product { Id = 2, Name = "Demo2", Price = 3.75M });
+ // testProducts.Add(new Product { Id = 3, Name = "Demo3", Price = 16.99M });
+ // testProducts.Add(new Product { Id = 4, Name = "Demo4", Price = 11.00M });
+
+ // return testProducts;
+ // }
+
+ [ClassCleanup]
+ public static void ClassCleanup() => _WebApplicationFactory?.Dispose();
+
+}
\ No newline at end of file
diff --git a/Viewer/Repositories/MetrologyRepo.cs b/Viewer/Repositories/MetrologyRepo.cs
index fc46dc9..c6a31bb 100644
--- a/Viewer/Repositories/MetrologyRepo.cs
+++ b/Viewer/Repositories/MetrologyRepo.cs
@@ -230,8 +230,7 @@ public class MetrologyRepo : IMetrologyRepo
parmnumber += 1;
object sqlValue = ((JValue)jp.Value).Value;
- if (sqlValue == null)
- sqlValue = DBNull.Value;
+ sqlValue ??= DBNull.Value;
AddParameter(cmd, parmname, sqlValue);
}
@@ -254,8 +253,7 @@ public class MetrologyRepo : IMetrologyRepo
parmnumber += 1;
object sqlValue = ((JValue)jp.Value).Value;
- if (sqlValue == null)
- sqlValue = DBNull.Value;
+ sqlValue ??= DBNull.Value;
AddParameter(cmd, parmname, sqlValue);
}
diff --git a/Viewer/Viewer.csproj b/Viewer/Viewer.csproj
index 7baedc6..992f5a6 100644
--- a/Viewer/Viewer.csproj
+++ b/Viewer/Viewer.csproj
@@ -28,23 +28,17 @@
-
-
-
+
-
-
-
-
-
-
+
+
+
+
-
-
-
+