Tasks 184281, 184799, 184800, 184801 and 184802

Align .editorconfig files

Move Controller logic to DMO classes

GlobalVars.AppSettings = Models.AppSettings.GetFromConfigurationManager();

Question EditorConfig
Project level editorconfig
Format White Spaces
AppSetting when EnvironmentVariable not set
Corrective Actions Tests
Schedule Actions Tests
DMO Tests
Controller Tests

Get ready to use VSCode IDE
This commit is contained in:
2024-12-04 11:58:13 -07:00
parent 538b1f817e
commit b1c6903c1c
150 changed files with 29146 additions and 33456 deletions

View File

@ -0,0 +1,379 @@
[*.md]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.csproj]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.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 = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false
csharp_prefer_qualified_reference = true:error
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_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
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 = true: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 = true: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_analyzer_diagnostic.category-Design.severity = error
dotnet_analyzer_diagnostic.category-Documentation.severity = error
dotnet_analyzer_diagnostic.category-Globalization.severity = none
dotnet_analyzer_diagnostic.category-Interoperability.severity = error
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
dotnet_analyzer_diagnostic.category-Naming.severity = none
dotnet_analyzer_diagnostic.category-Performance.severity = none
dotnet_analyzer_diagnostic.category-Reliability.severity = error
dotnet_analyzer_diagnostic.category-Security.severity = error
dotnet_analyzer_diagnostic.category-SingleFile.severity = error
dotnet_analyzer_diagnostic.category-Style.severity = error
dotnet_analyzer_diagnostic.category-Usage.severity = error
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public
dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1001.severity = error # CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1511.severity = warning # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1513.severity = warning # Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = error # 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.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
dotnet_diagnostic.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
dotnet_diagnostic.CA2201.severity = none # CA2201: Exception type System.NullReferenceException is reserved by the runtime
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
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.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = error # Using directive is unnecessary
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0048.severity = none # Parentheses preferences (IDE0047 and IDE0048)
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
dotnet_diagnostic.IDE0058.severity = error # IDE0058: Expression value is never used
dotnet_diagnostic.IDE0060.severity = error # IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines
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 = true
dotnet_sort_system_directives_first = true
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:warning
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
# Question
csharp_prefer_simple_using_statement = false # Question
csharp_style_expression_bodied_constructors = when_on_single_line:none # Question
csharp_style_expression_bodied_properties = true # Question
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning # Question
csharp_style_pattern_matching_over_as_with_null_check = false # Question
csharp_style_prefer_pattern_matching = false # Question
csharp_style_prefer_range_operator = false # Question
csharp_style_prefer_switch_expression = false # Question
csharp_style_unused_value_assignment_preference = unused_local_variable # Question
csharp_style_unused_value_expression_statement_preference = false # Question
csharp_style_var_elsewhere = false:none # Question
csharp_style_var_for_built_in_types = false:none # Question
csharp_style_var_when_type_is_apparent = false:warning # Question
dotnet_diagnostic.CA1001.severity = none # Question - Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = none # Question - Do not declare visible instance fields
dotnet_diagnostic.CA1416.severity = none # Question - This call site is reachable on all platforms.
dotnet_diagnostic.CA1510.severity = none # Question - Use
dotnet_diagnostic.CA1834.severity = none # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = none # Question - Avoid using
dotnet_diagnostic.CA1862.severity = none # Question - Prefer using
dotnet_diagnostic.CA2208.severity = none # Question - Instantiate argument exceptions correctly
dotnet_diagnostic.CA2211.severity = none # Question - Non-constant fields should not be visible
dotnet_diagnostic.CA2249.severity = none # Question - Use
dotnet_diagnostic.CA2253.severity = none # Question - Named placeholders should not be numeric values
dotnet_diagnostic.CS0103.severity = none # Question - The name
dotnet_diagnostic.CS0168.severity = none # Question - The variable
dotnet_diagnostic.CS0219.severity = none # Question - The variable
dotnet_diagnostic.CS0612.severity = none # Question - is obsolete
dotnet_diagnostic.CS0618.severity = none # Question - Compiler Warning (level 2)
dotnet_diagnostic.CS0659.severity = none # Question - Compiler Warning (level 3)
dotnet_diagnostic.CS8019.severity = warning # Question - Unnecessary using directive.
dotnet_diagnostic.CS8600.severity = none # Question - Converting null literal or possible null value to non-nullable type
dotnet_diagnostic.CS8602.severity = none # Question - Dereference of a possibly null reference.
dotnet_diagnostic.CS8603.severity = none # Question - Possible null reference return
dotnet_diagnostic.CS8604.severity = none # Question - Possible null reference argument for parameter.
dotnet_diagnostic.CS8618.severity = none # Question - Non-nullable variable must contain a non-null value when exiting constructor
dotnet_diagnostic.CS8625.severity = none # Question - Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8629.severity = none # Question - Nullable value type may be null
dotnet_diagnostic.CS8765.severity = none # Question - Nullability of type of parameter
dotnet_diagnostic.IDE0005.severity = none # Question - Remove unnecessary using directives
dotnet_diagnostic.IDE0008.severity = warning # Question - Use explicit type instead of
dotnet_diagnostic.IDE0017.severity = none # Question - Object initialization can be simplified
dotnet_diagnostic.IDE0019.severity = none # Question - Use pattern matching
dotnet_diagnostic.IDE0021.severity = none # Question - Use expression body for constructor
dotnet_diagnostic.IDE0022.severity = none # Question - Use expression body for method
dotnet_diagnostic.IDE0025.severity = none # Question - Use expression body for property
dotnet_diagnostic.IDE0027.severity = none # Question - Use expression body for accessor
dotnet_diagnostic.IDE0028.severity = none # Question - Use collection initializers or expressions
dotnet_diagnostic.IDE0031.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0032.severity = none # Question - Use auto property
dotnet_diagnostic.IDE0037.severity = none # Question - Member name can be simplified
dotnet_diagnostic.IDE0041.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0047.severity = none # Question - Parentheses preferences
dotnet_diagnostic.IDE0049.severity = warning # Question - Name can be simplified
dotnet_diagnostic.IDE0051.severity = none # Question - Remove unused private member
dotnet_diagnostic.IDE0053.severity = none # Question - Use expression body for lambdas
dotnet_diagnostic.IDE0054.severity = none # Question - Use compound assignment
dotnet_diagnostic.IDE0055.severity = none # Question - Formatting rule
dotnet_diagnostic.IDE0057.severity = none # Question - Substring can be simplified
dotnet_diagnostic.IDE0058.severity = none # Question - Remove unnecessary expression value
dotnet_diagnostic.IDE0059.severity = none # Question - Unnecessary assignment of a value to
dotnet_diagnostic.IDE0060.severity = none # Question - Remove unused parameter
dotnet_diagnostic.IDE0063.severity = none # Question - Use simple
dotnet_diagnostic.IDE0065.severity = none # Question -
dotnet_diagnostic.IDE0066.severity = none # Question - Use
dotnet_diagnostic.IDE0078.severity = none # Question - Use pattern matching (may change code meaning)
dotnet_diagnostic.IDE0090.severity = warning # Question - Simplify new expression
dotnet_diagnostic.IDE0160.severity = warning # Question - Use block-scoped namespace
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE0270.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0300.severity = none # Question - Collection initialization can be simplified
dotnet_diagnostic.IDE1006.severity = none # Question - Use collection expression for builder dotnet_style_prefer_collection_expression
dotnet_style_null_propagation = false # Question
dotnet_style_object_initializer = false # Question
dotnet_style_prefer_auto_properties = false # Question
dotnet_style_prefer_is_null_check_over_reference_equality_method = false # Question
dotnet_style_prefer_inferred_anonymous_type_member_names = false:warning # Question

View File

@ -0,0 +1 @@
[]

30
Fab2ApprovalTests/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/FabApprovalWorkerServiceTests.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
}
]
}

6
Fab2ApprovalTests/.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,6 @@
# mklink
```bash 1731711780354 = 638673085803540000 = Fri Nov 15 2024 16:02:59 GMT-0700 (Mountain Standard Time)
# mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalTests\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\3942d1fb-d585-40ae-8985-d276d1b94b77"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalTests\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d"
```

424
Fab2ApprovalTests/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,424 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"files.exclude": {
"**/.git": false,
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"cSpell.words": [
"abutton",
"accessibilities",
"accodingly",
"acknowledgmentby",
"Acks",
"actionsheet",
"Additonal",
"Addtional",
"againm",
"agendaview",
"Antlr",
"Appover",
"Appprrovers",
"Approvalog",
"Aprovers",
"Aproverslist",
"asax",
"aspnetmvc",
"Assignedto",
"Atachments",
"Attachemnt",
"Attachemnts",
"Attchment",
"auditee",
"Auditee",
"Auditees",
"automaically",
"Autthorized",
"beacuase",
"beforeunload",
"Belguim",
"bfound",
"bgcolor",
"Bies",
"binded",
"blackbackground",
"blackhover",
"blackpressed",
"blueenergy",
"blueopal",
"buttongroup",
"BYMRB",
"bytesgot",
"CAID",
"casection",
"CAXXXX",
"CCPCR",
"CCPCRB",
"cellspacing",
"Cheeso's",
"chkbx",
"Clib",
"colorpicker",
"columnmenu",
"columnsreorder",
"columnsresize",
"comming",
"Containmen",
"Copmments",
"correctiv",
"Correctivet",
"Creat",
"currentd",
"Cyle",
"dadada",
"darkbluehover",
"darkbluepressed",
"darkred",
"datafields",
"datasource",
"dataviz",
"datepicker",
"datetimepicker",
"dayview",
"Deletet",
"Delgation",
"DENITED",
"Deparmtent",
"departmentids",
"Descirption",
"devprog",
"dfeffc",
"Disp",
"Dispo",
"Dispoitio",
"Dispos",
"Dispositon",
"Dispostion",
"Dispostions",
"dispotypevalidation",
"Docbase",
"Documentum",
"Documetum",
"dont",
"downlaoded",
"draganddrop",
"dragcancel",
"dropdownlist",
"Eamils",
"ECNPCRB",
"Ecns",
"edmx",
"EECN",
"emai",
"emailparams",
"Emergrncy",
"energyblue",
"Eran",
"Esql",
"ETECN",
"EXCELOPENXML",
"existinglocation",
"Expando",
"extrafield",
"fadc",
"fbec",
"fcfdfd",
"fdff",
"fece",
"feeebd",
"ffdc",
"ffdd",
"fieldset",
"FILIPE",
"filtermenu",
"Fldr",
"flintstone",
"FLOWLOCS",
"FMEA",
"ftplib",
"FTPSPN",
"GETDATE",
"gitea",
"globaldocudms",
"glyphicons",
"groupable",
"Guids",
"halflings",
"Hexsize",
"highcontrast",
"Hmac",
"holdsteps",
"hostspecific",
"icenium",
"IECN",
"imagebrowser",
"IMRB",
"Infineon",
"Insertd",
"inverseicons",
"IPCRB",
"ISADMIN",
"islast",
"ISNULL",
"ITAR",
"jquery",
"jqueryval",
"jqwidgets",
"jqxbuttongroup",
"jqxbuttons",
"jqxcalendar",
"jqxchart",
"jqxcheckbox",
"jqxcolorpicker",
"jqxcombobox",
"jqxcore",
"jqxdata",
"jqxdatatable",
"jqxdatetimeinput",
"jqxdocking",
"jqxdockpanel",
"jqxdragdrop",
"jqxdropdownbutton",
"jqxdropdownlist",
"jqxexpander",
"jqxgauge",
"jqxgrid",
"jqxinput",
"jqxknockout",
"jqxlistbox",
"jqxlistmenu",
"jqxmaskedinput",
"jqxmenu",
"jqxnavigationbar",
"jqxnumberinput",
"jqxpanel",
"jqxpasswordinput",
"jqxprogressbar",
"jqxradiobutton",
"jqxrangeselector",
"jqxrating",
"jqxresponse",
"jqxscrollbar",
"jqxscrollview",
"jqxslider",
"jqxsplitter",
"jqxswitchbutton",
"jqxtabs",
"jqxtooltip",
"jqxtouch",
"jqxtree",
"jqxtreegrid",
"jqxtreemap",
"jqxvalidator",
"jqxwindow",
"kendogridcustom",
"kendoui",
"labelelement",
"labelledby",
"Leanred",
"lightgray",
"linkbutton",
"Linq",
"Listdiv",
"listview",
"Lnks",
"localfilename",
"loclist",
"logis",
"logtext",
"loopmis",
"lotdispo",
"LOTDISPSITION",
"Lotfile",
"lotlist",
"lotstatusoption",
"LTRIM",
"MADUREIRA",
"mailrelay",
"MDTM",
"meego",
"meetingid",
"menubutton",
"mesafi",
"metroblack",
"metrodark",
"miliseconds",
"modalview",
"modernizr",
"Modernizr",
"monthview",
"MRBIs",
"Mrbs",
"msecs",
"multipleextended",
"Navigatable",
"nbsp",
"newbase",
"newchange",
"newdi",
"newfilename",
"newsource",
"Newtonsoft",
"notications",
"Notifcation",
"Notifyf",
"NTLM",
"Nullcc",
"numerictextbox",
"objdata",
"OCAP",
"occured",
"odata",
"oldfilename",
"OLHOLD",
"onclick",
"onmousemove",
"OPDESC",
"OPENQUERY",
"Oper",
"operationslist",
"Orginator",
"Originatorname",
"Ouellette",
"Owin",
"pageable",
"Pageable",
"panelbar",
"parentid",
"parminput",
"parms",
"Parms",
"particula",
"pasv",
"PASV",
"PATINDEX",
"PCRB",
"PCRBID",
"pcrvalues",
"pdbonly",
"Preventitive",
"preventivet",
"Prevetative",
"proces",
"Processedl",
"procs",
"productfamilies",
"progess",
"progressbar",
"qrcode",
"Quanityt",
"rangebar",
"Recep",
"Recepient",
"recieved",
"recordlock",
"remotefilename",
"reorderable",
"reportform",
"reportslist",
"reportslistdiv",
"Reqquired",
"Reqs",
"Requiest",
"Responsibles",
"RETR",
"Revisioing",
"Revisioned",
"Revison",
"rgba",
"rkotian",
"RNFR",
"RNTO",
"Roless",
"roundbg",
"RTRIM",
"SAMDB",
"scroller",
"scrollview",
"seleced",
"selectionlog",
"Selectpart",
"sess",
"Sfisharepoint",
"shinyblack",
"showpassword",
"SIGNON",
"simpleparser",
"slddrw",
"sldprt",
"sortasc",
"sortascbutton",
"sortdesc",
"sortdescbutton",
"sortremove",
"sparkline",
"splitview",
"SPNMRB",
"SPNPDB",
"SSRS",
"Sssign",
"Staus",
"stylesheet",
"Submited",
"subrole",
"subroles",
"Succefully",
"Succesfully",
"sucessfully",
"SURP",
"Swashbuckle",
"SWRN",
"tabindex",
"tabstrip",
"Tahoma",
"taskcompleted",
"Tasklist",
"Taveler",
"TECN",
"TECNs",
"TEMIRWAP",
"tempecd",
"tempimplement",
"templabel",
"tempvalue",
"TEMSA",
"timepicker",
"Tobe",
"Toplevel",
"Totrav",
"trainingby",
"Traininglist",
"traininglistdiv",
"transanction",
"Trav",
"Traveller",
"Traverler",
"TRAVLELER",
"Travler",
"TREEVIEW",
"trigerred",
"ttinclude",
"Uhandled",
"Updat",
"Uplaod",
"Upto",
"userevents",
"userids",
"userlist",
"Validatable",
"valueelement",
"Variabls",
"Verdana",
"vgrid",
"viewmodel",
"vsdoc",
"whethere",
"windowsphone",
"Winsock",
"worlflow"
]
}

135
Fab2ApprovalTests/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,135 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"set",
"_UserSecretsId",
"3942d1fb-d585-40ae-8985-d276d1b94b77"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "testDebug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "testRelease",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Fab2ApprovalTests.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -0,0 +1,96 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.Controller;
[TestClass]
public class HomeControllerTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void GetMyOpenActionItems(ILogger? logger, AppSettings appSettings) {
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
OpenActionItemViewModel[] openActionItemViewModels = lotDispositionDMO.GetMyOpenActionItems(appSettings.UserId).ToArray();
if (openActionItemViewModels.Length == 0) { }
}
#if Release
[Ignore]
#endif
[TestMethod]
public void GetMyOpenActionItemsIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
GetMyOpenActionItems(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
private static void GetTaskList(ILogger? logger, AppSettings appSettings) {
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
IssuesViewModel[] issuesViewModels = lotDispositionDMO.GetTaskList(appSettings.UserId).ToArray();
if (issuesViewModels.Length == 0) { }
}
#if Release
[Ignore]
#endif
[TestMethod]
public void GetTaskListIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
GetTaskList(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,63 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class AccountDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void AccountDMO(AppSettings appSettings, HttpClient httpClient) {
#pragma warning disable IDE0059, CS8625
UserAccountDMO userAccountDMO = new();
LoginModel loginModel = userAccountDMO.GetUserByID(appSettings.UserId);
Task<LoginResult> loginResultTask = Fab2ApprovalSystem.DMO.AccountDMO.LoginAsync(httpClient, loginModel: loginModel);
loginResultTask.Wait();
Task<LoginResult> loginResultTaskB = Fab2ApprovalSystem.DMO.AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt: null);
loginResultTaskB.Wait();
if (loginModel is null) { }
#pragma warning restore IDE0059, CS8625
}
#if Release
[Ignore]
#endif
[TestMethod]
public void AccountDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
Assert.IsTrue(httpClient is not null);
httpClient.BaseAddress = new Uri(appSettings.ApiBaseUrl);
if (System.Diagnostics.Debugger.IsAttached)
AccountDMO(appSettings, httpClient);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,93 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class AdminDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void AdminDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
AdminDMO adminDMO = new();
// void AddNewTrainingGroup(string groupName);
// void AddUserRoles(int subRole, string userids);
// void AddUserToGroup(int userId, int groupId);
// void DeleteFromGroup(int userId, int groupId);
// void DeleteTrainingGroup(int groupID);
// adminDMO.DeleteUserFromAllTrainingGroups(appSettings.UserId);
// void DeleteUserRoles(int subRole, string userids);
// IEnumerable<LoginModel> GetAllUsersBySubRole(int subRole);
Role[] roles = adminDMO.GetSubRoles().ToArray();
ParentChildModel[] newRoles = adminDMO.GetAllSubRoles().ToArray();
// TECNNotificationsUser[] tECNNotificationsUsers = adminDMO.GetTECNNotificationUsers().ToArray();
// List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID);
// TrainingGroup[] trainingGroups = adminDMO.GetTrainingGroups().ToArray();
TrainingReportUser[] trainingReportUsers = adminDMO.GetTrainingReportUsers().ToArray();
UserSubRoles[] userSubRoless = adminDMO.GetUserSubRoles(appSettings.UserId).ToArray();
// adminDMO.TECNExpirationAddUser(appSettings.UserId);
// adminDMO.TECNExpirationDeleteUser(appSettings.UserId);
// adminDMO.TrainingReportAddUser(appSettings.UserId);
// adminDMO.TrainingReportDeleteUser(appSettings.UserId);
if (adminDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void AdminDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
AdminDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,100 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class AuditDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void AuditDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
AuditDMO auditDMO = new(appSettings);
// void DeleteAuditReportAttachment(int attachmentID);
// void DeleteCAFindingsItem(int caFindingsID);
int[] ints = auditDMO.Get8DQA().ToArray();
AuditedArea[] auditedAreas = auditDMO.GetAuditAreaList().ToArray();
// IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID);
// AuditFindings GetAuditFindingsByID(int auditFindingsID);
// IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo);
// Audit GetAuditItem(int auditNo, int userID);
// Audit GetAuditItemReadOnly(int auditNo, int userID);
Auditor[] auditors = auditDMO.GetAuditorList().ToArray();
// IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo);
// C_8DAuditedStandard[] c_8DAuditedStandards = auditDMO.GetAuditStandardList().ToArray();
AuditType[] auditTypes = auditDMO.GetAuditTypeList().ToArray();
// CAFindings GetCAFindingsItem(int caFindingsID);
// IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID);
// IEnumerable<CAFindings> GetCAFindingsList(int auditNo);
CANoList[] cANoLists = auditDMO.GetCorrectiveActionNoList().ToArray();
// int GetOpenCACountByAuditNo(int auditNo);
CAUserList[] cAUserLists = auditDMO.GetUserList().ToArray();
// Audit InsertAudit(Audit audit);
// void InsertAuditReportAttachment(AuditReportAttachment attach);
// void InsertCAFindings(CAFindings model);
// int IsCAAssignedToAudit(int CANo, int auditNo);
// void ReleaseLockOnDocument(int userID, int issueID);
// void UpdateAudit(Audit audit, int userID);
// void UpdateCAFindings(CAFindings model);
if (auditDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void AuditDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
AuditDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,79 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class ChangeControlDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void ChangeControlDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
ChangeControlDMO changeControlDMO = new(appSettings);
// IEnumerable<CCAttachment> GetCCAttachment(int planNumber);
// IEnumerable<CCMeetingAttachment> GetMeetingAttachments(int meetingID);
// IEnumerable<MeetingDecisionSummaryList> GetMeetingDecisionSummaryList(int planNumber);
// IEnumerable<CCMeeting> GetMeetingList(int planNumber);
// void ReassignOwner(int planNumber, int newOwnerID, string comments, int userID);
if (changeControlDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void ChangeControlDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
ChangeControlDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,123 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class CorrectiveActionDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void CorrectiveActionDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
CorrectiveActionDMO correctiveActionDMO = new(appSettings);
// void ApproveSection(int issueID, int userID, string DSection);
// void DeleteCAAttachment(int attachmentID);
// void DeleteD3ContainmentActionItem(int d3ContainmentActionID);
// void DeleteD5D6CorrectivetAction(int d5d6CAID);
// void DeleteD7PreventiveActionItem(int D7PAID);
int[] ints = correctiveActionDMO.Get8DQA().ToArray();
CAUserList[] cAUserLists = correctiveActionDMO.GetAllUserList().ToArray();
// string GetCAAttachmentFileName(string fileGUID);
// IEnumerable<CA_Attachment> GetCAAttachmentsList(int caNo, string section);
CAD3D5D7Due[] cAD3D5D7Dues = correctiveActionDMO.GetCAD3D5D7Due().ToArray();
// IEnumerable<CA_Attachment> GetCAFindingsItemAttachments(int caFindingsID);
// CorrectiveAction GetCAItem(int caNo, int userID);
// CorrectiveAction GetCAItemReadOnly(int caNo, int userID);
// IEnumerable<CASectionApproval> GetCASectionApprovalLog(int caNo);
CASource[] cASources = correctiveActionDMO.GetCASourceList().ToArray();
// IEnumerable<D3ContainmentAction> GetD3ContainmentActions(int caNo);
RiskAssessmentArea[] riskAssessmentAreas = correctiveActionDMO.GetD3RiskAssessmentAreas().ToArray();
// D5D6CorrectivetAction GetD5D5CAItem(int d5d6CAID);
// IEnumerable<D5D6CorrectivetAction> GetD5D6CorrectivetActions(int caNo);
D5D6Improvement[] d5D6Improvements = correctiveActionDMO.GetD5D6Improvement().ToArray();
// IEnumerable<CA_Attachment> GetD5D6ItemAttachments(int d5d6CAID);
// IEnumerable<CA_Attachment> GetD7ItemAttachments(int d7PAID);
// D7PreventiveAction GetD7PAItem(int d7PAID);
// IEnumerable<D7PreventiveAction> GetD7PreventiveActions(int caNo);
IssuesViewModel[] issuesViewModels = correctiveActionDMO.GetECNList().ToArray();
Module[] modules = correctiveActionDMO.GetModuleList().ToArray();
// List<string> GetRejectionAssigneeEmailList(int caNo);
CAUserList[] cAUserListsB = correctiveActionDMO.GetUserList().ToArray();
// CorrectiveAction InsertCA(CorrectiveAction ca);
// void InsertCAAttachment(CA_Attachment attach);
// void InsertD3ContainmentAction(D3ContainmentAction model);
// void InsertD5D6CorrectivetAction(D5D6CorrectivetAction model);
// void InsertD7PreventiveAction(D7PreventiveAction model);
// bool IsAIAssignee(int userId, int caId);
// bool IsLastSectionApprover(int caNo, string dSection);
// bool IsUserSectionApprover(int issueId, int userId);
// void RejectSection(int issueID, int userID, string DSection, string comments);
// void ReleaseLockOnDocument(int userID, int issueID);
// DateTime SetCAComplete(int issueID);
// DateTime SetCAD3DueDate(int issueID);
// DateTime SetCAD5D7DueDate(int issueID);
// void SetD3D5D7NotificationDate(int caNo, string section);
// int StartApproval(int issueID, int userID, int worlflowNumber);
// void StartSectionApproval(int issueID, int userID, string DSection);
// void UpdateCorrectiveAction(CorrectiveAction model);
// void UpdateD3ContainmentAction(D3ContainmentAction model);
// void UpdateD5D6CorrectivetAction(D5D6CorrectivetAction model);
// void UpdateD7PreventiveAction(D7PreventiveAction model);
if (correctiveActionDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void CorrectiveActionDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
CorrectiveActionDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,103 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class EngChangeNoticeDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void EngChangeNoticeDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
ECN_DMO ecnDMO = new();
// void CancelECN(int? ecnNumber);
// bool CanSubmitECN(int ecnNumber);
// void DeleteDocument(int ecnNumber, int userid, string ecnTypeString);
// void DeleteECNAttachment(int attachmentID);
// bool ECNApproveCancelled_ExpiredDocument(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType);
// void ECNResetTECNAtRejection(int ecnNumber, int userID, int docType);
IssuesViewModel[] issuesViewModels = ecnDMO.GetAllTECNs().ToArray();
// IEnumerable<ApprovalLogHistory> GetECNApprovalLogHistory(int ecnNumber);
// IEnumerable<ECNAttachment> GetECNAttachments(int ecnNumber);
IssuesViewModel[] issuesViewModelsB = ecnDMO.GetECN_TECNPendingApprovals(appSettings.UserId).ToArray();
// string GetFileName(string attachmentID);
// IEnumerable<IssuesViewModel> GetMyConvertedTECNsToECNs(int userID, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiredTECNs(int userID, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiringTECNs(int userID, int maxDays);
// List<string> GetRejectionOrginatorEmailList(int ecnNumber);
int[] ints = ecnDMO.GetTECNNotificationUsers().ToArray();
// void InsertECNAttachment(ECNAttachment attach);
// int PCRBExists(int pcrb);
// void ReassignOriginatorECN(int ecnNumber, int newOriginatorID, string comments, int userID);
// void ReleaseLockOnDocument(int userID, int issueID);
// int ReSubmitDocument(int issueID, int userID, int documentType, out int allowedITAR, string descriptionOfChange, string reasonForChange, string ecnTypeString, out int newECNNumber, int categoryId);
// void SaveAfterSubmitByApprover(int ecnNumber, string implementationDetails);
// void SetToExecutionStep(int ecnNumber, int userid, int documentType, string ecnTypeString);
// int SubmitDocument(int issueID, int userID, int documentType, out int allowedITAR);
// int SubmitForCancellation(int issueID, byte currentStep, int userID, int documentType, string ecnType, int TECNOperationType);
// int SubmitTECNExtensionDocument(int issueID, int userID, int documentType, DateTime extensionDate);
// void TECNExtensionLog(int ecnNumber, DateTime extensionDate);
// void UpdateECNType(int ecnNumber, string ecnType);
if (ecnDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void EngChangeNoticeDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
EngChangeNoticeDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,119 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests;
[TestClass]
public class LotDispositionDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void LotDispositionDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
// void DeleteAllLotDispoLot(int issueID);
// void DeleteCADocument(int CANo, int userID, string caTypeString);
// void DeleteLotDispoAttachment(int attachmentID);
// void DeleteLotDispoLot(int lotID);
AuditList[] auditLists = lotDispositionDMO.GetAuditList(appSettings.UserId).ToArray();
// Errors! // ChangeControlList[] changeControlLists = lotDispositionDMO.GetChangeControls(appSettings.UserId).ToArray();
CorrectiveAction[] correctiveActions = lotDispositionDMO.GetCorrectiveActionList(appSettings.UserId).ToArray();
LotDispoDepartment[] lotDispoDepartments = lotDispositionDMO.GetDepartments().ToArray();
IssuesViewModel[] issuesViewModels = lotDispositionDMO.GetDocuments().ToArray();
IssuesViewModel[] issuesViewModelsB = lotDispositionDMO.GetECNList(appSettings.UserId).ToArray();
// string GetFileName(string attachmentID);
// Attachment[] GetLotDispoAttachments(int issueID);
// LotDisposition GetLotDispositionItem(int issueID, out int isITAR, int userID);
// LotDisposition GetLotDispositionItemForRead(int issueID, out int isITAR, int userID);
IssuesViewModel[] issuesViewModelsC = lotDispositionDMO.GetLotDispositionList(appSettings.UserId).ToArray();
// Lot[] GetLotDispositionLots(int issueID);
// LotDispositionLotSummaryViewModel GetLotDispositionLotSummary(int issueID);
IssuesViewModel[] issuesViewModelsD = lotDispositionDMO.GetLotDispositions().ToArray();
LotStatusOptionViewModel[] lotStatusOptionViewModels = lotDispositionDMO.GetLotStatusOptions().ToArray();
// ScrapLot GetLotStausDetail(int issueID, string lotNumber);
IssuesViewModel[] issuesViewModelsE = lotDispositionDMO.GetMRBList(appSettings.UserId).ToArray();
// SPN_MRB[] GetMRBsFromSPN(string lotNumber);
OpenActionItemViewModel[] openActionItemViewModels = lotDispositionDMO.GetMyOpenActionItems(appSettings.UserId).ToArray();
// string[] GetRejectionOrginatorEmailList(int issueID).ToArray();
// ResponsibilityIssue[] GetResponsibilityIssueList(int responsibilityID);
Responsibility[] responsibilities = lotDispositionDMO.GetResponsibilityList().ToArray().ToArray();
// int GetRHLotCount(int issueID);
IssuesViewModel[] issuesViewModelsF = lotDispositionDMO.GetTaskList(appSettings.UserId).ToArray();
Users[] users = lotDispositionDMO.GetUserList().ToArray();
IssuesViewModel[] issuesViewModelsG = lotDispositionDMO.GetWorkRequests().ToArray();
// void InsertChildLot_NotInTheMRB(string lotNumber);
// void InsertComments(int issueID, string comments, int commentedBy);
// int InsertLot(Lot lot, bool getLotInfo);
// LotDisposition InsertLotDisposition(LotDisposition lotDispo);
// void InsertLotDispositionAttachment(Attachment attach);
// void ReleaseLockOnDocument(int userID, int issueID);
// Lot[] SearchLots(string searchText);
// int SubmitDocument(int issueID, bool peRequired, bool mrbRequired, int userID);
// void UpdateLotDispoLot(Lot lot);
// void UpdateLotDisposition(LotDisposition lotDispo);
// void UpdateLotScrapReleaseStatus(ScrapLot scrap);
// void UpdateLotStatus(ScrapLot lotStatus);
// void UpdateLotStatusAll(ScrapLot scrap, int lotStatus);
// void UpdateReasonForDisposition(int issueID, string reasonForDisposition);
if (lotDispositionDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void LotDispositionDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
LotDispositionDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,105 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class LotTravelerDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void LotTravelerDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
LotTravelerDMO lotTravelerDMO = new(appSettings);
// int CanAddLocationOperation(LTLotTravelerHoldSteps model);
// int CreateLotTravelerRevision(LTLotTravelerHoldSteps model, int userID);
// void CreateTraveler(int ltLotID, int workRequestID, int UserID);
// int CreateWorkRequestRevision(LTWorkRequest data, int userID);
// void DeleteLot(int ltLotID);
// IEnumerable<LTLot> GetLotList(int workRequestID);
// IEnumerable<LTLot> GetLotListBasedOnSWRNumber(int swrNumber);
// IEnumerable<LotWithTraveler> GetLotsWithTraveler(int workRequestID);
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForReadOnly(int ltLotID, int revisionNumber);
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForUpdate(int ltLotID, int UserID);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravelerHolStepsByRevision(int ltLotID, int revisionNumber);
// IEnumerable<RevisionHistory> GetLotTravelerRevisionHistory(int lotID);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravHoldSteps(int ltLotID);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravHoldStepsCompleted(int ltLotID);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravHoldStepsPending(int ltLotID);
// LotTravelerPdf GetLotTravlerPdf(int ltLotID, int revisionNumber);
// List<Revision> GetLotTravRevisions(int ltLotID);
// List<string> GetRejectionOrginatorEmailList(int workRequestID);
// IEnumerable<ApprovalLogHistory> GetWorkReqApprovalLogHistory(int swrNumber);
// IEnumerable<RevisionHistory> GetWorkReqRevisionHistory(int swrNumber);
// List<Revision> GetWorkReqRevisions(int swrNumber);
// void InsertLot(LTLot lot);
// int InsertLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
// void ReassignOriginator(int workRequestID, int newOriginatorID, string comments, int userID);
// void ReleaseLockOnDocument(int userID, int workRequestID);
// void ReleaseLockOnLotTravelerUpdateDoc(int userID, int ltLotID);
// void RestoreLotTravToPrevRevision(int prevLotTravRevID, int newLotTravRevID);
// int SubmitDocument(int workRequestID, int userID, int documentType, out int allowedITAR);
// int UpdateLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
// void UpdateLotTravlerExecution(int lotTravHoldStepID, string taskComments, bool CompletedFlag, int userID);
// int UpdateRevisedLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
if (lotTravelerDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void LotTravelerDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
LotTravelerDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,77 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class MatReviewBoardDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void MatReviewBoardDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
MRB_DMO matReviewBoardDMO = new(appSettings);
// MRBAttachment GetMRBAttachment(int attachmentID);
CAUserList[] cAUserLists = matReviewBoardDMO.GetUserList().ToArray();
// void UpdateContainmentAction(ContainmentActionObj model);
if (matReviewBoardDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void MatReviewBoardDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
MatReviewBoardDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,76 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class MiscDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void MiscDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
MiscDMO miscDMO = new();
ApproveListModel[] approveListModels = miscDMO.GetApprovalReminderList().ToArray();
// void UpdateApprovalNotifyDate(int approvalId);
if (miscDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void MiscDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
MiscDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,86 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class PartsRequestDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void PartsRequestDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
PartsRequestDMO partsRequestDMO = new(appSettings);
// void DeleteAttachment(int attachmentID);
// void DeleteDocument(int prNumber, int userid);
// PartsRequest Get(int PRNumber);
// IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber);
// IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber);
// string GetFileName(string attachmentID);
MyPartsRequestList[] myPartsRequestLists = partsRequestDMO.GetMyPartsRequests(appSettings.UserId).ToArray();
PartsRequestList[] partsRequestLists = partsRequestDMO.GetPartsRequestList().ToArray();
// void Insert(PartsRequest pr);
// void InsertAttachment(PartsRequestAttachment attach);
// void Submit(int prNumber, int userID);
// void Update(PartsRequest pr);
if (partsRequestDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void PartsRequestDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
PartsRequestDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,108 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class TrainingDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void TrainingDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
TrainingDMO trainingDMO = new();
// void AcknowledgeDocument(int trainingDocAckID);
// void AddTrainingGroupToECN(int ECNNumber, int groupId);
// bool CheckTrainingAssignmentStatus(int trainingAssignmentID);
// bool CheckTrainingStatus(int trainingAssignmentID);
// bool CheckValidDocAck(int docAckId);
// int Create(int issueId);
// int CreateAssignment(int trainingId, int userId);
// void DeleteAssignmentByUserId(int userId);
// void DeleteTraining(int trainingId);
// void DeleteTrainingAssignment(int trainingAssignmentId);
// void DeleteTrainingDocAck(int trainingAssignmentId);
// Training[] trainings = trainingDMO.GetAllOpenTrainings().ToArray();
// List<TrainingAssignment> GetAllTrainingAssignments(int TrainingID);
// Training[] trainingsB = trainingDMO.GetAllTrainings().ToArray();
// List<TrainingDocAck> GetAssignedDocs(int trainingAssignmentId);
// TrainingAssignment GetAssignment(int assignmentId);
// List<int> GetECNAssignedTrainingGroups(int ECNNumber);
// List<TrainingAssignment> GetOpenAssignmentsByTrainingID(int trainingID);
// List<int> GetTrainees(int groupId);
// Training GetTraining(int trainingId);
// List<TrainingAssignment> GetTrainingAssignments(int TrainingID);
// List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID);
// List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID);
// TrainingGroup GetTrainingGroupByID(int groupId);
// TrainingGroup[] trainingGroups = trainingDMO.GetTrainingGroups().ToArray();
// int GetTrainingId(int issueId);
// int GetTrainingIdByAssignment(int trainingAssignmentID);
// Training[] trainingsC = trainingDMO.GetTrainings().ToArray();
// bool IsUserAssigned(int userId, int trainingId);
// bool isUserTrainingMember(int groupId, int userId);
// void reOpenTraining(int trainingId);
// void SetTrainingFlag(int ECNNumber);
// void UpdateAssignmentStatus(int trainingAssignmentID);
// void UpdateTrainingStatus(int trainingId);
if (trainingDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void TrainingDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
TrainingDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,79 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class UserAccountDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void UserAccountDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
UserAccountDMO userAccountDMO = new();
LoginModel[] loginModels = userAccountDMO.GetAllActiveUsers().ToArray();
LoginModel[] loginModelsB = userAccountDMO.GetAllUsers().ToArray();
LoginModel loginModel = userAccountDMO.GetUserByID(appSettings.UserId);
LoginModel loginModelB = userAccountDMO.GetUser(loginModel.LoginID);
string userEmail = userAccountDMO.GetUserEmailByID(appSettings.UserId);
if (userAccountDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void UserAccountDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
UserAccountDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,86 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class WorkflowDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void WorkflowDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
WorkflowDMO workflowDMO = new();
// string AddAdditionalApproval(int issueID, string userIDs, byte step, int documentType);
// string AddEECNApproval(int ecnNumber, byte step, int documentType, string engUserIDs, string opUserIDs);
// bool Approve(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType, int workFlowNumber);
// string DelegateDocumentApproval(int issueID, int delegateFromUser, int delegateToUser);
// string GetApproversForCancelled_ExpiredTECNDocs(int ecnNumber);
// string GetSubRoleItems(int issueID, int docType);
// string GetSubRolesForPartsRequestNextStep(int prNumber);
// WorkflowSteps GetWorkflowStep(int docTypeID, int wfNumber, int stepNumber);
// string ReAssignApproval(int issueID, int assignedFromUser, int assignedToUser, byte step, int docType);
// bool Recall(int issueID, byte step, string comments, int userID, int docType);
// bool Reject(int issueID, byte step, string comments, int userID, int docType);
// void RejectTECNExtension(int ecnNumber, byte step, string comments, int userID, int docType);
if (workflowDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
public void WorkflowDMOIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
WorkflowDMO(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'=='true'">
<DefineConstants>Windows</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsOSX)'=='true'">
<DefineConstants>OSX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>Release</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<VSTestLogger>trx</VSTestLogger>
<VSTestCollect>XPlat Code Coverage</VSTestCollect>
<VSTestResultsDirectory>../.vscode/TestResults</VSTestResultsDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq.Dapper" Version="1.0.7" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fab2ApprovalMKLink\Fab2ApprovalMKLink.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,129 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.General;
[TestClass]
public class CorrectiveActionTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
private static DateTime? SetD3DueDate(int cANo) => throw new NotImplementedException();
private static DateTime? SetD5D7DueDate(int cANo) => throw new NotImplementedException();
private static void NotifyApprovers(int cANo, int v) => throw new NotImplementedException();
private static void NotifySectionApprover(int cANo, int qAID, string sectionApproval) => throw new NotImplementedException();
private static void NotifyAssignee(int cANo, int d1AssigneeID, string v, DateTime? d3DueDate, DateTime? d5D7DueDate) => throw new NotImplementedException();
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void Edit(int currentUserId, CorrectiveActionDMO caDMO, CorrectiveAction model) {
CorrectiveAction caPrevious = caDMO.GetCAItemReadOnly(model.CANo, currentUserId);
if (currentUserId != caPrevious.D1AssigneeID && currentUserId != caPrevious.QAID && currentUserId != caPrevious.RequestorID)
throw new Exception("User is not authorized to save the CA.");
try {
if (model.TriggerApproval) {
//model.FollowUpDate = DateTime.Now.AddMonths(6);
}
caDMO.UpdateCorrectiveAction(model);
if ((model.D1AssigneeID != model.CurrentD1AssigneeID && model.CASubmitted) || (model.CASubmitted && !caPrevious.CASubmitted)) {
//Set Due Dates here:
DateTime? D3DueDate = null;
DateTime? D5D7DueDate = null;
if (model.CAType != "D0") {
D3DueDate = SetD3DueDate(model.CANo);
if (model.CAType != "D3") {
D5D7DueDate = SetD5D7DueDate(model.CANo);
}
}
NotifyAssignee(model.CANo, model.D1AssigneeID, "CorrectiveActionAssignee.txt", D3DueDate, D5D7DueDate);
}
if (model.TriggerSectionApproval) {
if (model.SectionApproval == "D5D6D7Validation") {
caDMO.StartSectionApproval(model.CANo, model.RequestorID, model.SectionApproval);
throw new Exception("Successfully Saved...Validation initiated!");
}
caDMO.StartSectionApproval(model.CANo, model.QAID, model.SectionApproval);
caDMO.StartSectionApproval(model.CANo, model.RequestorID, model.SectionApproval);
NotifySectionApprover(model.CANo, model.QAID, model.SectionApproval);
NotifySectionApprover(model.CANo, model.RequestorID, model.SectionApproval);
//NotifyApprovers(model.CANo, 1);
throw new Exception("Successfully Saved...Approval initiated!");
}
if (model.TriggerApproval) {
_ = caDMO.StartApproval(model.CANo, currentUserId, model.WorkFlowNumber);
NotifyApprovers(model.CANo, 1);
throw new Exception("Successfully Saved...Approval initiated!");
}
} catch (Exception ex) {
throw new Exception(ex.Message);
}
}
internal static void TestCorrectiveAction(ILogger? logger, AppSettings appSettings, int caNo) {
SetGlobalVars(logger, appSettings);
CorrectiveAction ca;
CorrectiveActionDMO caDMO = new(appSettings);
ca = caDMO.GetCAItemReadOnly(caNo, appSettings.UserId);
if (ca is null)
throw new Exception($"{nameof(ca)}");
ca = caDMO.GetCAItem(caNo, appSettings.UserId);
if (ca is null)
throw new Exception($"{nameof(ca)}");
Edit(appSettings.UserId, caDMO, ca);
}
#if Release
[Ignore]
#endif
[DataTestMethod]
[DataRow(295)]
public void TestCorrectiveActionIsAttachedOnly(int caNo) {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
TestCorrectiveAction(_Logger, appSettings, caNo);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,90 @@
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Workers;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Quartz;
using Quartz.Impl;
namespace Fab2ApprovalTests.General;
[TestClass]
public class ScheduleTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void Init(ILogger? logger, AppSettings appSettings) {
SetGlobalVars(logger, appSettings);
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
IScheduler scheduler = schedulerFactory.GetScheduler(_TestContext.CancellationTokenSource.Token).GetAwaiter().GetResult();
IJobDetail oooTrainingReportJob = JobBuilder.Create<OOOTrainingReportJob>()
.WithIdentity("oooTrainingReportJob", "trainingReportGroup")
.Build();
ITrigger oooTrainingReportTrigger = TriggerBuilder.Create()
.WithIdentity("oooTrainingReportTrigger", "trainingReportGroup")
.WithCronSchedule("15 13 * * MON")
.ForJob(oooTrainingReportJob)
.Build();
_ = scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger, _TestContext.CancellationTokenSource.Token);
}
#if Release
[Ignore]
#endif
[TestMethod]
public void InitIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
Init(_Logger, appSettings);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1 @@
global using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@ -0,0 +1,49 @@
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Utilities;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.Utilities;
[TestClass]
public class EmailUtilitiesTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
#if Release
[Ignore]
#endif
[TestMethod]
public void EmailUtilitiesIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
EmailUtilities.SendNotification("mike.phares@infineon.com", [], "Test: Subject", "Body");
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,50 @@
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Utilities;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.Utilities;
[TestClass]
public class UserUtilitiesTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
#if Release
[Ignore]
#endif
[TestMethod]
public void UserUtilitiesIsAttachedOnly() {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached) {
List<AllUserModel> allUserModels = UserUtilities.GetMesaUsers();
Assert.IsNotNull(allUserModels);
}
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}