Compare commits
	
		
			1 Commits
		
	
	
		
			7b2a843664
			...
			06-05-a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 51878972c6 | 
| @ -105,7 +105,7 @@ dotnet_diagnostic.CS8936.severity = error # Feature 'collection expressions' is | ||||
| 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 = none # Using directive is unnecessary | ||||
| dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary | ||||
| dotnet_diagnostic.IDE0028.severity = none # 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 | ||||
| @ -115,7 +115,6 @@ dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]cs | ||||
| dotnet_diagnostic.IDE0300.severity = none # IDE0300: Collection initialization can be simplified | ||||
| dotnet_diagnostic.IDE0301.severity = none #IDE0301: Collection initialization can be simplified | ||||
| dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified | ||||
| dotnet_diagnostic.MSTEST0015.severity = none # MSTEST0015: Test method {method} should not be ignored | ||||
| 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 | ||||
|  | ||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -345,4 +345,4 @@ ASALocalRun/ | ||||
| .kanbn | ||||
| Tests/.kanbn | ||||
|  | ||||
| secrets.json | ||||
| /Wafer-Counter/.vscode/.UserSecrets/secrets.json | ||||
							
								
								
									
										6
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ | ||||
|             "name": ".NET Core Launch (web) - Server", | ||||
|             "type": "coreclr", | ||||
|             "request": "launch", | ||||
|             "preLaunchTask": "Build Server", | ||||
|             "preLaunchTask": "buildServer", | ||||
|             // If you have changed target frameworks, make sure to update the program path. | ||||
|             "program": "${workspaceFolder}/Server/bin/Debug/net8.0/win-x64/OI.Metrology.Server.dll", | ||||
|             "args": [], | ||||
| @ -31,7 +31,7 @@ | ||||
|             "name": ".NET Core Attach - Server", | ||||
|             "type": "coreclr", | ||||
|             "request": "attach", | ||||
|             "preLaunchTask": "Watch Server", | ||||
|             "preLaunchTask": "watchServer", | ||||
|             "processName": "OI.Metrology.Server.exe" | ||||
|         }, | ||||
|         { | ||||
| @ -41,7 +41,7 @@ | ||||
|             "name": ".NET Core Launch (web) - ClientHub", | ||||
|             "type": "coreclr", | ||||
|             "request": "launch", | ||||
|             "preLaunchTask": "Build Client Hub", | ||||
|             "preLaunchTask": "buildClientHub", | ||||
|             // If you have changed target frameworks, make sure to update the program path. | ||||
|             "program": "${workspaceFolder}/ClientHub/bin/Debug/net7.0/win-x64/OI.Metrology.ClientHub.dll", | ||||
|             "args": [], | ||||
|  | ||||
							
								
								
									
										66
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										66
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -28,60 +28,72 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Build Server", | ||||
|             "label": "buildServer", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/Server/OI.Metrology.Server.csproj" | ||||
|                 "${workspaceFolder}/Server/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Build Tests", | ||||
|             "label": "buildTests", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/Tests/OI.Metrology.Tests.csproj" | ||||
|                 "${workspaceFolder}/Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Build Shared", | ||||
|             "label": "buildShared", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/Shared/OI.Metrology.Shared.csproj" | ||||
|                 "${workspaceFolder}/Shared/OI.Metrology.Shared.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Publish Server", | ||||
|             "label": "publishServer", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/Server/OI.Metrology.Server.csproj" | ||||
|                 "${workspaceFolder}/Server/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Debug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Release", | ||||
|             "label": "testDebug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "testRelease", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "-c", | ||||
|                 "Release" | ||||
|             ], | ||||
| @ -103,7 +115,7 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Old Watch", | ||||
|             "label": "old-watch", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -115,7 +127,7 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Watch Server", | ||||
|             "label": "watchServer", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -149,27 +161,31 @@ | ||||
|             } | ||||
|         }, | ||||
|         { | ||||
|             "label": "Build Client Hub", | ||||
|             "label": "buildClientHub", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/ClientHub/OI.Metrology.ClientHub.csproj" | ||||
|                 "${workspaceFolder}/ClientHub/OI.Metrology.ClientHub.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Publish Client Hub", | ||||
|             "label": "publishClientHub", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/ClientHub/OI.Metrology.ClientHub.csproj" | ||||
|                 "${workspaceFolder}/ClientHub/OI.Metrology.ClientHub.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Watch Client Hub", | ||||
|             "label": "watchClientHub", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|  | ||||
							
								
								
									
										8
									
								
								Archive/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								Archive/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -7,7 +7,9 @@ | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/Archive.csproj" | ||||
|                 "${workspaceFolder}/Archive.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
| @ -17,7 +19,9 @@ | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/Archive.csproj" | ||||
|                 "${workspaceFolder}/Archive.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|  | ||||
							
								
								
									
										2
									
								
								Server/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								Server/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ | ||||
|             "name": ".NET Core Launch (web)", | ||||
|             "type": "coreclr", | ||||
|             "request": "launch", | ||||
|             "preLaunchTask": "Build", | ||||
|             "preLaunchTask": "build", | ||||
|             // If you have changed target frameworks, make sure to update the program path. | ||||
|             "program": "${workspaceFolder}/bin/Debug/net8.0/OI.Metrology.Server.dll", | ||||
|             "args": [], | ||||
|  | ||||
							
								
								
									
										5
									
								
								Server/.vscode/mklink.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								Server/.vscode/mklink.md
									
									
									
									
										vendored
									
									
								
							| @ -1,5 +0,0 @@ | ||||
| # mklink | ||||
|  | ||||
| ```bash Thu Aug 29 2024 09:47:22 GMT-0700 (Mountain Standard Time) | ||||
| mklink /J "L:\DevOps\OpenInsight-Metrology-Viewer\OI-Metrology\Server\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\b0a3891c-b775-422c-80ee-63a2f385045d" | ||||
| ``` | ||||
							
								
								
									
										480
									
								
								Server/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										480
									
								
								Server/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -1,164 +1,60 @@ | ||||
| { | ||||
|     "inputs": [ | ||||
|         { | ||||
|             "default": "Development", | ||||
|             "description": "Which ASP Net Core Environment?", | ||||
|             "id": "ASPNETCORE_ENVIRONMENT", | ||||
|             "options": [ | ||||
|                 "Development", | ||||
|                 "Production" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{AssemblyTitle}", | ||||
|             "description": "What Assembly Title?", | ||||
|             "id": "AssemblyTitle", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.BuildId}", | ||||
|             "description": "Which Build BuildId?", | ||||
|             "id": "Build.BuildId", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Reason}", | ||||
|             "description": "Which Build Reason?", | ||||
|             "id": "Build.Reason", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Id}", | ||||
|             "description": "Which Build Repository Id?", | ||||
|             "id": "Build.Repository.Id", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Name}", | ||||
|             "description": "Which Build Repository Name?", | ||||
|             "id": "Build.Repository.Name", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.SourceVersion}", | ||||
|             "description": "Which Build Source Version?", | ||||
|             "id": "Build.SourceVersion", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "Debug", | ||||
|             "description": "Which Configuration?", | ||||
|             "id": "Configuration", | ||||
|             "options": [ | ||||
|                 "Debug", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "net8.0", | ||||
|             "description": "Which Core Version?", | ||||
|             "id": "CoreVersion", | ||||
|             "options": [ | ||||
|                 "net8.0" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe", | ||||
|             "description": "Which MS Build?", | ||||
|             "id": "MSBuild", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/", | ||||
|             "description": "Which Nuget Source?", | ||||
|             "id": "NugetSource", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "win-x64", | ||||
|             "description": "Which Runtime?", | ||||
|             "id": "Runtime", | ||||
|             "options": [ | ||||
|                 "win-x64", | ||||
|                 "win-x32", | ||||
|                 "linux-x64", | ||||
|                 "linux-x32" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "L:/", | ||||
|             "description": "Which System DefaultWorkingDirectory?", | ||||
|             "id": "System.DefaultWorkingDirectory", | ||||
|             "options": [ | ||||
|                 "L:/", | ||||
|                 "D:/", | ||||
|                 "C:/" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "v4.8", | ||||
|             "description": "Which Core Target Framework Version?", | ||||
|             "id": "TargetFrameworkVersion", | ||||
|             "options": [ | ||||
|                 "v4.8" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{UserSecretsId}", | ||||
|             "description": "Which Core User Secrets Id?", | ||||
|             "id": "UserSecretsId", | ||||
|             "type": "promptString" | ||||
|         } | ||||
|     ], | ||||
|     "version": "2.0.0", | ||||
|     "tasks": [ | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build" | ||||
|             ], | ||||
|             "label": "build", | ||||
|             "command": "dotnet", | ||||
|             "label": "Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj" | ||||
|                 "${workspaceFolder}/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Build Tests", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "buildTests", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj" | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Test Debug", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "testDebug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "testRelease", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "-c", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Test Release", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "format", | ||||
|                 "--report", | ||||
| @ -168,24 +64,27 @@ | ||||
|                 "--severity", | ||||
|                 "warn" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Format", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format-Whitespace", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "format", | ||||
|                 "whitespace" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Format Whitespace", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "publish", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "--configuration", | ||||
|                 "Release", | ||||
|                 "--runtime", | ||||
| @ -194,14 +93,17 @@ | ||||
|                 "-o", | ||||
|                 "D:/web-sites/OI-Metrology/hh-3498d1da-_______-OI-Metrology-Release/Server" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Publish AOT", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "--configuration", | ||||
|                 "Release", | ||||
|                 "--runtime", | ||||
| @ -209,280 +111,64 @@ | ||||
|                 "-p:PublishAot=true", | ||||
|                 "/property:GenerateFullPaths=true" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Publish AOT", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "old-watch", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "watch", | ||||
|                 "run" | ||||
|                 "run", | ||||
|                 "--project", | ||||
|                 "${workspaceFolder}/OI.Metrology.Server.csproj" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Old Watch", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "watch", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "watch", | ||||
|                 "--launch-profile", | ||||
|                 "http", | ||||
|                 "run", | ||||
|                 "--project", | ||||
|                 "${workspaceFolder}/OI.Metrology.Server.csproj", | ||||
|                 "--verbose" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "isBackground": true, | ||||
|             "dependsOn": [ | ||||
|                 "build" | ||||
|             ], | ||||
|             "isBackground": true, | ||||
|             "label": "Watch", | ||||
|             "problemMatcher": { | ||||
|                 "fileLocation": "relative", | ||||
|                 "pattern": { | ||||
|                     "regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$", | ||||
|                     "file": 1, | ||||
|                     "location": 2, | ||||
|                     "severity": 3, | ||||
|                     "code": 4, | ||||
|                     "message": 5 | ||||
|                 }, | ||||
|                 "background": { | ||||
|                     "activeOnStart": true, | ||||
|                     "beginsPattern": "^.*Shutdown requested.*", | ||||
|                     "endsPattern": "^.*Application started.*" | ||||
|                 }, | ||||
|                 "fileLocation": "relative", | ||||
|                 "pattern": { | ||||
|                     "code": 4, | ||||
|                     "file": 1, | ||||
|                     "location": 2, | ||||
|                     "message": 5, | ||||
|                     "regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$", | ||||
|                     "severity": 3 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "label": "File-Folder-Helper AOT s X Server", | ||||
|             "type": "shell", | ||||
|             "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe", | ||||
|             "args": [ | ||||
|                 "s", | ||||
|                 "X", | ||||
|                 "L:/DevOps/Mesa_FI/OI-Metrology Day-Helper-2024-01-08 L:/DevOps/Mesa_FI/OI-Metrology/Server" | ||||
|             ], | ||||
|             "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe", | ||||
|             "label": "File-Folder-Helper AOT s X Server", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "echo Assembly Title: ${input:AssemblyTitle} & echo Build Id: ${input:Build.BuildId} & echo Build Reason: ${input:Build.Reason} & echo Repo Id: ${input:Build.Repository.Id} & echo Repo Name: ${input:Build.Repository.Name} & echo Source Version: ${input:Build.SourceVersion} & echo Configuration: ${input:Configuration} & echo Core Version: ${input:CoreVersion} & echo Nuget Source: ${input:NugetSource} & echo Runtime: ${input:Runtime}", | ||||
|             "label": "Echo Check", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "dotnet user-secrets init & dotnet user-secrets set BuildNumber ${input:Build.BuildId} & dotnet user-secrets set GitCommit ${input:Build.SourceVersion} & dotnet user-secrets list", | ||||
|             "label": "App - Safe storage of app secrets", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--source", | ||||
|                 "${input:NugetSource}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--source", | ||||
|                 "${input:NugetSource}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Test", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--runtime", | ||||
|                 "${input:Runtime}", | ||||
|                 "--self-contained" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--runtime", | ||||
|                 "${input:Runtime}", | ||||
|                 "-p:PublishAot=true" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - AOT Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /MIR \"bin/${input:Configuration}/${input:CoreVersion}/${input:Runtime}/publish\" \"D:/${input:CoreVersion}/${input:Runtime}/${input:Build.Repository.Name}/${input:Configuration}/${input:Build.BuildId}/${input:AssemblyTitle}\") ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Copy Files to: D:/", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "tool", | ||||
|                 "restore" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tool Restore", | ||||
|             "problemMatcher": [], | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "ReportGenerator", | ||||
|                 "-reports:${input:System.DefaultWorkingDirectory}/TestResults/**/coverage.cobertura.xml", | ||||
|                 "-targetDir:${input:Build.ArtifactStagingDirectory}/Coverage", | ||||
|                 "-reportTypes:Html_Dark" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Report Generator", | ||||
|             "problemMatcher": [], | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "clean", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Clean", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "clean", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Clean", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe stop apppool /apppool.name:${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Stop Pool", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe stop site /site.name:${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Stop Website", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "rmdir D:/web-sites/${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Remove MKLink", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "mklink /J \"D:\\web-sites\\${input:AssemblyTitle}.${input:Configuration}\" \"D:\\$(CoreVersion)\\$(Runtime)\\$(Build.Repository.Name)\\$(Configuration)\\$(Build.BuildId)\\$(AssemblyTitle)\"", | ||||
|             "label": "Create MKLink", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "mkdir D:/web-sites/${input:AssemblyTitle}.${input:Configuration}/${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Make Directory", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /IS /IT /IM \"%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)\" \"D:/$(CoreVersion)/$(Runtime)/$(Build.Repository.Name)/$(Configuration)/$(Build.BuildId)/$(AssemblyTitle)\" secrets.json) ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Replace User Secrets Id File", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /IS /IT /IM \"%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)\" \"D:/$(CoreVersion)/$(Runtime)/$(Build.Repository.Name)/$(Configuration)/$(Build.BuildId)/$(AssemblyTitle)\" web.config) ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Replace Web Configuration File", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe start apppool /apppool.name:${input:AssemblyTitle}.${input:Configuration}", | ||||
|             "label": "Start Pool", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe start site /site.name:${input:AssemblyTitle}.${input:Configuration}", | ||||
|             "label": "Start Website", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "App - AOT Publish", | ||||
|                 "Tool Restore", | ||||
|                 "Report Generator" | ||||
|             ], | ||||
|             "command": "echo", | ||||
|             "dependsOn": [ | ||||
|                 "Echo Check", | ||||
|                 "App - Safe storage of app secrets", | ||||
|                 "App - Build", | ||||
|                 "Tests - Build", | ||||
|                 "Tests - Test", | ||||
|                 "App - Publish", | ||||
|                 "Copy Files to: D:/", | ||||
|                 "Tests - Clean", | ||||
|                 "App - Clean", | ||||
|                 "Stop Pool", | ||||
|                 "Stop Website", | ||||
|                 "Remove MKLink", | ||||
|                 "Create MKLink", | ||||
|                 "Make Directory", | ||||
|                 "Replace User Secrets Id File", | ||||
|                 "Replace Web Configuration File", | ||||
|                 "Start Pool", | ||||
|                 "Start Website" | ||||
|             ], | ||||
|             "dependsOrder": "sequence", | ||||
|             "label": "Pipeline", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|             "problemMatcher": [] | ||||
|         } | ||||
|     ], | ||||
|     "version": "2.0.0" | ||||
|     ] | ||||
| } | ||||
| @ -1,5 +1,4 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using OI.Metrology.Server.Models; | ||||
| using OI.Metrology.Shared.Models.Stateless; | ||||
|  | ||||
| namespace OI.Metrology.Server.ApiControllers; | ||||
| @ -9,9 +8,9 @@ namespace OI.Metrology.Server.ApiControllers; | ||||
| public class AppSettingsController : ControllerBase, IAppSettingsController<ActionResult> | ||||
| { | ||||
|  | ||||
|     private readonly IAppSettingsRepository<AppSettings> _AppSettingsRepository; | ||||
|     private readonly IAppSettingsRepository<Models.Binder.AppSettings> _AppSettingsRepository; | ||||
|  | ||||
|     public AppSettingsController(IAppSettingsRepository<AppSettings> AppSettingsRepository) => _AppSettingsRepository = AppSettingsRepository; | ||||
|     public AppSettingsController(IAppSettingsRepository<Models.Binder.AppSettings> AppSettingsRepository) => _AppSettingsRepository = AppSettingsRepository; | ||||
|  | ||||
|     [HttpGet(nameof(IAppSettingsController<ActionResult>.Action.App))] | ||||
|     public ActionResult GetAppSettings() => | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace OI.Metrology.Server.Models; | ||||
|  | ||||
| @ -37,75 +36,8 @@ public record AppSettings(string ApiFileShare, | ||||
|  | ||||
|     public override string ToString() | ||||
|     { | ||||
|         string result = JsonSerializer.Serialize(this, AppSettingsSourceGenerationContext.Default.AppSettings); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private static void Verify(AppSettings appSettings) | ||||
|     { | ||||
|         if (string.IsNullOrEmpty(appSettings.Company)) | ||||
|             throw new Exception("Company name must have a value!"); | ||||
|         if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName)) | ||||
|             throw new Exception("Working directory name must have a value!"); | ||||
|     } | ||||
|  | ||||
|     public static AppSettings Get(IConfigurationRoot configurationRoot) | ||||
|     { | ||||
|         AppSettings result; | ||||
|         AppSettings? appSettings = configurationRoot.Get<AppSettings>(); | ||||
| #pragma warning restore IL3050, IL2026 | ||||
|         if (appSettings is null | ||||
|             || appSettings?.Company is null) | ||||
|         { | ||||
|             List<string> paths = []; | ||||
|             foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers) | ||||
|             { | ||||
|                 if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider) | ||||
|                     continue; | ||||
|                 if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider) | ||||
|                     continue; | ||||
|                 paths.Add(physicalFileProvider.Root); | ||||
|             } | ||||
|             throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}"); | ||||
|         } | ||||
|         result = new(appSettings.ApiFileShare, | ||||
|                      appSettings.ApiLoggingContentTypes, | ||||
|                      appSettings.ApiLoggingPathPrefixes, | ||||
|                      appSettings.ApiLogPath, | ||||
|                      appSettings.ApiUrl, | ||||
|                      appSettings.BuildNumber, | ||||
|                      appSettings.Company, | ||||
|                      appSettings.ConnectionString, | ||||
|                      appSettings.EcCharacterizationSi, | ||||
|                      appSettings.EcMesaFileShareCharacterizationSi, | ||||
|                      appSettings.EcMesaFileShareMetrologySi, | ||||
|                      appSettings.EcMetrologySi, | ||||
|                      appSettings.GitCommitSeven, | ||||
|                      appSettings.InboundApiAllowedIPList, | ||||
|                      appSettings.IqsColumns, | ||||
|                      appSettings.IqsFileSegments, | ||||
|                      appSettings.IqsKey, | ||||
|                      appSettings.IqsRed, | ||||
|                      appSettings.IqsYellow, | ||||
|                      appSettings.IsDevelopment, | ||||
|                      appSettings.IsStaging, | ||||
|                      appSettings.MockRoot, | ||||
|                      appSettings.MonAResource, | ||||
|                      appSettings.MonASite, | ||||
|                      appSettings.OpenInsightApplicationProgrammingInterface, | ||||
|                      appSettings.TableToPath, | ||||
|                      appSettings.URLs, | ||||
|                      appSettings.WaferCounterDestinationDirectory, | ||||
|                      appSettings.WaferCounterTwoFileSecondsWait, | ||||
|                      appSettings.WorkingDirectoryName); | ||||
|         Verify(result); | ||||
|         string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true)] | ||||
| [JsonSerializable(typeof(AppSettings))] | ||||
| public partial class AppSettingsSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
							
								
								
									
										2
									
								
								Server/Models/Binder/.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Server/Models/Binder/.editorconfig
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| [*.cs] | ||||
| csharp_preserve_single_line_statements = true | ||||
							
								
								
									
										148
									
								
								Server/Models/Binder/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										148
									
								
								Server/Models/Binder/AppSettings.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,148 @@ | ||||
| using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace OI.Metrology.Server.Models.Binder; | ||||
|  | ||||
| public class AppSettings | ||||
| { | ||||
|  | ||||
|     public string? ApiFileShare { get; set; } | ||||
|     public string? ApiLoggingContentTypes { get; set; } | ||||
|     public string? ApiLoggingPathPrefixes { get; set; } | ||||
|     public string? ApiLogPath { get; set; } | ||||
|     public string? ApiUrl { get; set; } | ||||
|     public string? BuildNumber { get; set; } | ||||
|     public string? Company { get; set; } | ||||
|     public string? ConnectionString { get; set; } | ||||
|     public string? EcCharacterizationSi { get; set; } | ||||
|     public string? EcMesaFileShareCharacterizationSi { get; set; } | ||||
|     public string? EcMesaFileShareMetrologySi { get; set; } | ||||
|     public string? EcMetrologySi { get; set; } | ||||
|     public string? GitCommitSeven { get; set; } | ||||
|     public string? InboundApiAllowedIPList { get; set; } | ||||
|     public string? IqsColumns { get; set; } | ||||
|     public string[]? IqsFileSegments { get; set; } | ||||
|     public string? IqsKey { get; set; } | ||||
|     public string? IqsRed { get; set; } | ||||
|     public string? IqsYellow { get; set; } | ||||
|     public bool? IsDevelopment { get; set; } | ||||
|     public bool? IsStaging { get; set; } | ||||
|     public string? MockRoot { get; set; } | ||||
|     public string? MonAResource { get; set; } | ||||
|     public string? MonASite { get; set; } | ||||
|     public string? OpenInsightApplicationProgrammingInterface { get; set; } | ||||
|     public Dictionary<string, string>? TableToPath { get; set; } | ||||
|     public string? URLs { get; set; } | ||||
|     public string? WaferCounterDestinationDirectory { get; set; } | ||||
|     public int? WaferCounterTwoFileSecondsWait { get; set; } | ||||
|     public string? WorkingDirectoryName { get; set; } | ||||
|  | ||||
|     public override string ToString() | ||||
|     { | ||||
|         string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true }); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     private static void PreVerify(IConfigurationRoot configurationRoot, AppSettings? appSettings) | ||||
|     { | ||||
|         if (appSettings?.ApiFileShare is null) | ||||
|         { | ||||
|             List<string> paths = new(); | ||||
|             foreach (IConfigurationProvider configurationProvider in configurationRoot.Providers) | ||||
|             { | ||||
|                 if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider) | ||||
|                     continue; | ||||
|                 if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider) | ||||
|                     continue; | ||||
|                 paths.Add(physicalFileProvider.Root); | ||||
|             } | ||||
|             throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static Models.AppSettings Get(AppSettings? appSettings) | ||||
|     { | ||||
|         Models.AppSettings result; | ||||
|         if (appSettings is null) throw new NullReferenceException(nameof(appSettings)); | ||||
|         if (appSettings.ApiFileShare is null) throw new NullReferenceException(nameof(ApiFileShare)); | ||||
|         if (appSettings.ApiLoggingContentTypes is null) throw new NullReferenceException(nameof(ApiLoggingContentTypes)); | ||||
|         if (appSettings.ApiLoggingPathPrefixes is null) throw new NullReferenceException(nameof(ApiLoggingPathPrefixes)); | ||||
|         if (appSettings.ApiLogPath is null) throw new NullReferenceException(nameof(ApiLogPath)); | ||||
|         if (appSettings.ApiUrl is null) throw new NullReferenceException(nameof(ApiUrl)); | ||||
|         if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber)); | ||||
|         if (appSettings.Company is null) throw new NullReferenceException(nameof(Company)); | ||||
|         if (appSettings.ConnectionString is null) throw new NullReferenceException(nameof(ConnectionString)); | ||||
|         if (appSettings.EcCharacterizationSi is null) throw new NullReferenceException(nameof(EcCharacterizationSi)); | ||||
|         if (appSettings.EcMesaFileShareCharacterizationSi is null) throw new NullReferenceException(nameof(EcMesaFileShareCharacterizationSi)); | ||||
|         if (appSettings.EcMesaFileShareMetrologySi is null) throw new NullReferenceException(nameof(EcMesaFileShareMetrologySi)); | ||||
|         if (appSettings.EcMetrologySi is null) throw new NullReferenceException(nameof(EcMetrologySi)); | ||||
|         if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven)); | ||||
|         if (appSettings.InboundApiAllowedIPList is null) throw new NullReferenceException(nameof(InboundApiAllowedIPList)); | ||||
|         if (appSettings.IqsColumns is null) throw new NullReferenceException(nameof(IqsColumns)); | ||||
|         if (appSettings.IqsFileSegments is null) throw new NullReferenceException(nameof(IqsFileSegments)); | ||||
|         if (appSettings.IqsKey is null) throw new NullReferenceException(nameof(IqsKey)); | ||||
|         if (appSettings.IqsRed is null) throw new NullReferenceException(nameof(IqsRed)); | ||||
|         if (appSettings.IqsYellow is null) throw new NullReferenceException(nameof(IqsYellow)); | ||||
|         if (appSettings.IsDevelopment is null) throw new NullReferenceException(nameof(IsDevelopment)); | ||||
|         if (appSettings.IsStaging is null) throw new NullReferenceException(nameof(IsStaging)); | ||||
|         if (appSettings.MockRoot is null) throw new NullReferenceException(nameof(MockRoot)); | ||||
|         if (appSettings.MonAResource is null) throw new NullReferenceException(nameof(MonAResource)); | ||||
|         if (appSettings.MonASite is null) throw new NullReferenceException(nameof(MonASite)); | ||||
|         if (appSettings.OpenInsightApplicationProgrammingInterface is null) throw new NullReferenceException(nameof(OpenInsightApplicationProgrammingInterface)); | ||||
|         if (appSettings.URLs is null) throw new NullReferenceException(nameof(URLs)); | ||||
|         if (appSettings.TableToPath is null) throw new NullReferenceException(nameof(TableToPath)); | ||||
|         if (appSettings.WaferCounterDestinationDirectory is null) throw new NullReferenceException(nameof(WaferCounterDestinationDirectory)); | ||||
|         if (appSettings.WaferCounterTwoFileSecondsWait is null) throw new NullReferenceException(nameof(WaferCounterTwoFileSecondsWait)); | ||||
|         if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName)); | ||||
|         result = new( | ||||
|             appSettings.ApiFileShare, | ||||
|             appSettings.ApiLoggingContentTypes, | ||||
|             appSettings.ApiLoggingPathPrefixes, | ||||
|             appSettings.ApiLogPath, | ||||
|             appSettings.ApiUrl, | ||||
|             appSettings.BuildNumber, | ||||
|             appSettings.Company, | ||||
|             appSettings.ConnectionString, | ||||
|             appSettings.EcCharacterizationSi, | ||||
|             appSettings.EcMesaFileShareCharacterizationSi, | ||||
|             appSettings.EcMesaFileShareMetrologySi, | ||||
|             appSettings.EcMetrologySi, | ||||
|             appSettings.GitCommitSeven, | ||||
|             appSettings.InboundApiAllowedIPList, | ||||
|             appSettings.IqsColumns, | ||||
|             appSettings.IqsFileSegments, | ||||
|             appSettings.IqsKey, | ||||
|             appSettings.IqsRed, | ||||
|             appSettings.IqsYellow, | ||||
|             appSettings.IsDevelopment.Value, | ||||
|             appSettings.IsStaging.Value, | ||||
|             appSettings.MockRoot, | ||||
|             appSettings.MonAResource, | ||||
|             appSettings.MonASite, | ||||
|             appSettings.OpenInsightApplicationProgrammingInterface, | ||||
|             appSettings.TableToPath, | ||||
|             appSettings.URLs, | ||||
|             appSettings.WaferCounterDestinationDirectory, | ||||
|             appSettings.WaferCounterTwoFileSecondsWait.Value, | ||||
|             appSettings.WorkingDirectoryName); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     public static Models.AppSettings Get(IConfigurationRoot configurationRoot) | ||||
|     { | ||||
|         Models.AppSettings result; | ||||
| #pragma warning disable IL3050, IL2026 | ||||
|         AppSettings? appSettings = configurationRoot.Get<AppSettings>(); | ||||
| #pragma warning restore IL3050, IL2026 | ||||
|         PreVerify(configurationRoot, appSettings); | ||||
|         result = Get(appSettings); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true)] | ||||
| [JsonSerializable(typeof(AppSettings))] | ||||
| internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
| @ -43,7 +43,7 @@ public class Program | ||||
|         (string assemblyName, WebApplicationOptions _) = Get(args); | ||||
|         WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args); | ||||
|         _ = webApplicationBuilder.Configuration.AddUserSecrets<Program>(); | ||||
|         AppSettings appSettings = AppSettings.Get(webApplicationBuilder.Configuration); | ||||
|         AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration); | ||||
|         if (string.IsNullOrEmpty(appSettings.Company)) | ||||
|             throw new Exception("Company name must have a value!"); | ||||
|         if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName)) | ||||
| @ -78,7 +78,7 @@ public class Program | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<ISpreadingResistanceProfileService, SpreadingResistanceProfileService>(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<AppSettings>>(_ => appSettingsRepository); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository); | ||||
|  | ||||
|             _ = webApplicationBuilder.Services.AddSwaggerGen(); | ||||
|             _ = webApplicationBuilder.Services.AddSession(sessionOptions => | ||||
|  | ||||
| @ -3,20 +3,27 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
|  | ||||
| namespace OI.Metrology.Server.Repository; | ||||
|  | ||||
| public class AppSettingsRepository : IAppSettingsRepository<AppSettings> | ||||
| public class AppSettingsRepository : IAppSettingsRepository<Models.Binder.AppSettings> | ||||
| { | ||||
|  | ||||
|     private readonly AppSettings _AppSettings; | ||||
|  | ||||
|     public AppSettingsRepository(AppSettings appSettings) => _AppSettings = appSettings; | ||||
|  | ||||
|     internal AppSettings GetAppSettings() | ||||
|     internal Models.Binder.AppSettings GetAppSettings() | ||||
|     { | ||||
|         AppSettings result = _AppSettings; | ||||
|         Models.Binder.AppSettings result = new() | ||||
|         { | ||||
|             BuildNumber = _AppSettings.BuildNumber, | ||||
|             Company = _AppSettings.Company, | ||||
|             GitCommitSeven = _AppSettings.GitCommitSeven, | ||||
|             IsDevelopment = _AppSettings.IsDevelopment, | ||||
|             IsStaging = _AppSettings.IsStaging, | ||||
|         }; | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     AppSettings IAppSettingsRepository<AppSettings>.GetAppSettings() => GetAppSettings(); | ||||
|     Models.Binder.AppSettings IAppSettingsRepository<Models.Binder.AppSettings>.GetAppSettings() => GetAppSettings(); | ||||
|  | ||||
|     internal string GetBuildNumberAndGitCommitSeven() | ||||
|     { | ||||
| @ -38,8 +45,8 @@ public class AppSettingsRepository : IAppSettingsRepository<AppSettings> | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     string IAppSettingsRepository<AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven(); | ||||
|     string IAppSettingsRepository<Models.Binder.AppSettings>.GetBuildNumberAndGitCommitSeven() => GetBuildNumberAndGitCommitSeven(); | ||||
|  | ||||
|     void IAppSettingsRepository<AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings(); | ||||
|     void IAppSettingsRepository<Models.Binder.AppSettings>.VerifyConnectionStrings() => VerifyConnectionStrings(); | ||||
|  | ||||
| } | ||||
| @ -227,7 +227,7 @@ public class ToolTypesRepository : IToolTypesRepository | ||||
|                 { | ||||
|                     HttpClient httpClient = _HttpClientFactory.CreateClient(); | ||||
|                     httpClient.BaseAddress = new(_AppSettings.ApiFileShare); | ||||
|                     _FileShareRepository.CopyFile(httpClient, processDataStandardFormat, Path.Combine(directly, $"Viewer_{Path.GetFileName(processDataStandardFormat)}")); | ||||
|                     _FileShareRepository.CopyFile(httpClient, processDataStandardFormat, Path.Combine(directly, $"Viewer{Path.GetFileName(processDataStandardFormat)}")); | ||||
|                     result = null; | ||||
|                 } | ||||
|                 catch (Exception ex) { result = ex.Message; } | ||||
|  | ||||
| @ -1,198 +0,0 @@ | ||||
| trigger: | ||||
|   branches: | ||||
|     include: | ||||
|       - master | ||||
|   paths: | ||||
|     include: | ||||
|       - Server | ||||
|  | ||||
| variables: | ||||
|   runtime: 'win-x64' | ||||
|   coreVersion: 'net8.0' | ||||
|   nugetSource: 'https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/' | ||||
|  | ||||
| stages: | ||||
|   - stage: Development | ||||
|     displayName: Development | ||||
|     pool: | ||||
|       name: 'OpenInsight Metrology Viewer' | ||||
|       demands: OpenInsight-Metrology-Viewer-Server-Development | ||||
|     variables: | ||||
|       ASPNETCORE_ENVIRONMENT: 'Development' | ||||
|       assemblyTitle: 'OI.Metrology.Server' | ||||
|       configuration: 'Debug' | ||||
|       userSecretsId: 'b0a3891c-b775-422c-80ee-63a2f385045d' | ||||
|     jobs: | ||||
|       - job: DebugDotnet | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo Assembly Title: $(AssemblyTitle) | ||||
|               echo Build Id: $(Build.BuildId) | ||||
|               echo Build Reason: $(Build.Reason) | ||||
|               echo Repo Id: $(Build.Repository.Id) | ||||
|               echo Repo Name: $(Build.Repository.Name) | ||||
|               echo Source Version: $(Build.SourceVersion) | ||||
|               echo Configuration: $(Configuration) | ||||
|               echo Core Version: $(CoreVersion) | ||||
|               echo Nuget Source: $(NugetSource) | ||||
|               echo Runtime: $(Runtime) | ||||
|               echo UserSecretsId: $(UserSecretsId) | ||||
|             displayName: 'Echo Check' | ||||
|  | ||||
|           - script: | | ||||
|               dotnet user-secrets init | ||||
|               dotnet user-secrets set BuildNumber $(Build.BuildId) | ||||
|               dotnet user-secrets set GitCommit $(Build.SourceVersion) | ||||
|               dotnet user-secrets list | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Safe storage of app secrets' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Build' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Build' | ||||
|  | ||||
|           - script: dotnet test --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Test' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) --self-contained | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Publish' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) -p:PublishAot=true | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - AOT Publish' | ||||
|             enabled: false | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|             displayName: 'Copy Files to: D:\' | ||||
|             inputs: | ||||
|               Contents: '*' | ||||
|               SourceFolder: 'Server\bin\$(Configuration)\$(CoreVersion)\$(Runtime)\publish' | ||||
|               TargetFolder: 'D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)' | ||||
|               OverWrite: true | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Clean' | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Server | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe stop apppool /apppool.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Stop Pool' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe stop site /site.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Stop Website' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: rmdir "D:\web-sites\$(AssemblyTitle).$(Configuration)" | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Remove MKLink' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: mklink /J "D:\web-sites\$(AssemblyTitle).$(Configuration)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Create MKLink' | ||||
|  | ||||
|           - script: mkdir "D:\web-sites\$(AssemblyTitle).$(Configuration)\$(AssemblyTitle).$(Configuration)" | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Make Directory' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: (robocopy /E /IS /IT /IM "%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" secrets.json) ^& IF %ERRORLEVEL% LEQ 7 exit 0 | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Replace User Secrets Id File' | ||||
|  | ||||
|           - script: (robocopy /E /IS /IT /IM "%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" web.config) ^& IF %ERRORLEVEL% LEQ 7 exit 0 | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Replace Web Configuration File' | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe start apppool /apppool.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Start Pool' | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe start site /site.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'Start Website' | ||||
|  | ||||
|   - stage: Release | ||||
|     displayName: Release | ||||
|     pool: | ||||
|       name: 'OpenInsight Metrology Viewer' | ||||
|       demands: OpenInsight-Metrology-Viewer-Server | ||||
|     variables: | ||||
|       ASPNETCORE_ENVIRONMENT: 'Production' | ||||
|       assemblyTitle: 'OI.Metrology.Server' | ||||
|       configuration: 'Release' | ||||
|     jobs: | ||||
|       - job: ReleaseDotnet | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo Assembly Title: $(AssemblyTitle) | ||||
|               echo Build Id: $(Build.BuildId) | ||||
|               echo Build Reason: $(Build.Reason) | ||||
|               echo Repo Id: $(Build.Repository.Id) | ||||
|               echo Repo Name: $(Build.Repository.Name) | ||||
|               echo Source Version: $(Build.SourceVersion) | ||||
|               echo Configuration: $(Configuration) | ||||
|               echo Core Version: $(CoreVersion) | ||||
|               echo Nuget Source: $(NugetSource) | ||||
|               echo Runtime: $(Runtime) | ||||
|             displayName: 'Echo Check' | ||||
|  | ||||
|           - script: | | ||||
|               dotnet user-secrets init | ||||
|               dotnet user-secrets set BuildNumber $(Build.BuildId) | ||||
|               dotnet user-secrets set GitCommit $(Build.SourceVersion) | ||||
|               dotnet user-secrets list | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Safe storage of app secrets' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Build' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Build' | ||||
|  | ||||
|           - script: dotnet test --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Test' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) --self-contained | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Publish' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) -p:PublishAot=true | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - AOT Publish' | ||||
|             enabled: false | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|             displayName: 'Copy Files to: D:\' | ||||
|             inputs: | ||||
|               Contents: '*' | ||||
|               SourceFolder: 'Server\bin\$(Configuration)\$(CoreVersion)\$(Runtime)\publish' | ||||
|               TargetFolder: 'D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)' | ||||
|               OverWrite: true | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Clean' | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Server | ||||
|             displayName: 'App - Clean' | ||||
|  | ||||
|           - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|             displayName: 'Force Fail' | ||||
|             enabled: false | ||||
							
								
								
									
										16
									
								
								Shared/Models/Stateless/IAzureDevOpsController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Shared/Models/Stateless/IAzureDevOpsController.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| namespace OI.Metrology.Shared.Models.Stateless; | ||||
|  | ||||
| public interface IAzureDevOpsController<T> | ||||
| { | ||||
|  | ||||
|     enum Action : int | ||||
|     { | ||||
|         Index = 0, | ||||
|         Save = 1 | ||||
|     } | ||||
|  | ||||
|     static string GetRouteName() => nameof(IAzureDevOpsController<T>)[1..^10]; | ||||
|  | ||||
|     T Save(); | ||||
|  | ||||
| } | ||||
							
								
								
									
										8
									
								
								Shared/Models/Stateless/IAzureDevOpsRepository.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Shared/Models/Stateless/IAzureDevOpsRepository.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| namespace OI.Metrology.Shared.Models.Stateless; | ||||
|  | ||||
| public interface IAzureDevOpsRepository | ||||
| { | ||||
|  | ||||
|     void Save(PollValue pollValue); | ||||
|  | ||||
| } | ||||
| @ -29,7 +29,7 @@ | ||||
|         <DefineConstants>Linux</DefineConstants> | ||||
|     </PropertyGroup> | ||||
|     <ItemGroup> | ||||
|         <PackageReference Include="System.Text.Json" Version="9.0.7" /> | ||||
|         <PackageReference Include="System.Text.Json" Version="8.0.0" /> | ||||
|         <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||||
|         <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" /> | ||||
|     </ItemGroup> | ||||
|  | ||||
							
								
								
									
										6
									
								
								Tests/.vscode/mklink.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								Tests/.vscode/mklink.md
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +0,0 @@ | ||||
| # mklink | ||||
|  | ||||
| ```bash Thu Aug 29 2024 09:47:22 GMT-0700 (Mountain Standard Time) | ||||
| mklink /J "L:\DevOps\OpenInsight-Metrology-Viewer\OI-Metrology\Tests\.vscode\.UserSecrets-Server" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\b0a3891c-b775-422c-80ee-63a2f385045d" | ||||
| mklink /J "L:\DevOps\OpenInsight-Metrology-Viewer\OI-Metrology\Tests\.vscode\.UserSecrets-Wafer-Counter" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\2a0acd34-8f61-47a3-8818-73fa8fe04902" | ||||
| ``` | ||||
							
								
								
									
										20
									
								
								Tests/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								Tests/.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @ -1,24 +1,6 @@ | ||||
| { | ||||
|     "coverage-gutters.coverageBaseDir": "../.vscode/TestResults/**", | ||||
|     "cSpell.words": [ | ||||
|         "appsettings", | ||||
|         "BIORAD", | ||||
|         "datebegin", | ||||
|         "dateend", | ||||
|         "Dispo", | ||||
|         "headerid", | ||||
|         "headertitles", | ||||
|         "infineon", | ||||
|         "markasawaiting", | ||||
|         "markasreviewed", | ||||
|         "mesfs", | ||||
|         "messa", | ||||
|         "Newtonsoft", | ||||
|         "pdsf", | ||||
|         "RESIMAPCDE", | ||||
|         "ROTR", | ||||
|         "SGRP", | ||||
|         "Tencor", | ||||
|         "TSNO" | ||||
|         "datebegin" | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										47
									
								
								Tests/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								Tests/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -2,57 +2,43 @@ | ||||
|     "version": "2.0.0", | ||||
|     "tasks": [ | ||||
|         { | ||||
|             "label": "Build", | ||||
|             "label": "build", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build" | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Debug", | ||||
|             "label": "testDebug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "--settings:test.runsettings" | ||||
|                 "${workspaceFolder}/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Debug with Settings", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "--settings:Settings.xml" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Release", | ||||
|             "label": "testRelease", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "-c", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Test Release with Settings", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "-c", | ||||
|                 "Release", | ||||
|                 "--settings:Settings.xml" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format", | ||||
|             "command": "dotnet", | ||||
| @ -69,7 +55,7 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format Whitespace", | ||||
|             "label": "Format-Whitespace", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
| @ -79,11 +65,14 @@ | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Publish", | ||||
|             "label": "publish", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/../Server/OI.Metrology.Server.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "--configuration", | ||||
|                 "Release", | ||||
|                 "--runtime", | ||||
|  | ||||
| @ -1,21 +0,0 @@ | ||||
| using System.Diagnostics; | ||||
|  | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| public class BaseTestClass | ||||
| { | ||||
|  | ||||
|     private static int _FailedTests; | ||||
|     private readonly int _Threshold = 5; | ||||
|  | ||||
|     protected void IncrementFailedTests() | ||||
|     { | ||||
|         if (++_FailedTests >= _Threshold) | ||||
|         { | ||||
|             for (int i = 0; i < 10; i++) | ||||
|                 Thread.Sleep(500); | ||||
|             Process.GetCurrentProcess().Kill(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -1,9 +0,0 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <RunSettings> | ||||
|   <MSTest> | ||||
|     <Parallelize> | ||||
|       <Workers>0</Workers> | ||||
|       <Scope>MethodLevel</Scope> | ||||
|     </Parallelize> | ||||
|   </MSTest> | ||||
| </RunSettings> | ||||
| @ -8,14 +8,14 @@ using System.Net.Http.Json; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitAwaitingDispoController : BaseTestClass | ||||
| public class UnitAwaitingDispoController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -23,32 +23,19 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
|         _ControllerName = nameof(Server.ApiControllers.AwaitingDispoController)[..^10]; | ||||
|     } | ||||
|  | ||||
|     private static void NonThrowTryCatch() | ||||
|     { | ||||
|         try | ||||
|         { throw new Exception(); } | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IAwaitingDispoController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -59,8 +46,8 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IEnumerable<AwaitingDisposition>? awaitingDispositions = metrologyRepository?.GetAwaitingDisposition(); | ||||
|         Assert.IsNotNull(awaitingDispositions); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(awaitingDispositions is not null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -69,10 +56,10 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -83,7 +70,7 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         _ = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: false); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -92,9 +79,9 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/markasreviewed"); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -106,7 +93,7 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         int? dateCleared = metrologyRepository?.UpdateReviewDate(toolTypeId: 1, headerId: 1, clearDate: true); | ||||
|         Assert.IsTrue(dateCleared <= 1); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -115,9 +102,9 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.PostAsync($"api/{_ControllerName}/markasawaiting", null); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -128,7 +115,7 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         Guid? guid = metrologyRepository?.GetHeaderAttachmentID(toolTypeId: 1, headerId: 1); | ||||
|         Assert.IsNotNull(guid); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -136,10 +123,10 @@ public class UnitAwaitingDispoController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/1/header-attachment-id?headerid=1"); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content.ToString()); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -8,14 +8,14 @@ using System.Text; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitInboundController : BaseTestClass | ||||
| public class UnitInboundController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -23,6 +23,7 @@ public class UnitInboundController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -36,19 +37,12 @@ public class UnitInboundController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IInboundController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -64,9 +58,9 @@ public class UnitInboundController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad", GetStringContent()); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -76,9 +70,9 @@ public class UnitInboundController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.PostAsync($"api/{_ControllerName}/BioRad/attachment", GetStringContent()); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -8,14 +8,14 @@ using System.Net; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestAppSettingsController : BaseTestClass | ||||
| public class UnitTestAppSettingsController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -23,6 +23,7 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -36,19 +37,23 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestConnectionString() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>(); | ||||
|         appSettingsRepository?.VerifyConnectionStrings(); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -59,7 +64,7 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>(); | ||||
|         Assert.IsNotNull(appSettings); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -68,10 +73,10 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IAppSettingsRepository<AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<AppSettings>>(); | ||||
|         AppSettings? appSettings = appSettingsRepository?.GetAppSettings(); | ||||
|         Assert.IsNotNull(appSettings); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>(); | ||||
|         Server.Models.Binder.AppSettings? appSettings = appSettingsRepository?.GetAppSettings(); | ||||
|         Assert.IsTrue(appSettings is not null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -80,17 +85,16 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string actionName = nameof(IAppSettingsController<object>.Action.App); | ||||
|         HttpResponseMessage? httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}"); | ||||
|         Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content.Headers.ContentType); | ||||
|         Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType.ToString()); | ||||
|         string? json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString()); | ||||
|         string json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAppSettings)}.json"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         Assert.AreNotEqual("[]", json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(json != "[]"); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -99,10 +103,10 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IAppSettingsRepository<AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<AppSettings>>(); | ||||
|         IAppSettingsRepository<Server.Models.Binder.AppSettings>? appSettingsRepository = serviceProvider?.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>(); | ||||
|         string? result = appSettingsRepository?.GetBuildNumberAndGitCommitSeven(); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(result is not null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -111,16 +115,15 @@ public class UnitTestAppSettingsController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string actionName = nameof(IAppSettingsController<object>.Action.DevOps); | ||||
|         HttpResponseMessage? httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}"); | ||||
|         Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content.Headers.ContentType); | ||||
|         Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType.ToString()); | ||||
|         string? json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString()); | ||||
|         string json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -7,14 +7,14 @@ using System.Net; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestClientSettingsController : BaseTestClass | ||||
| public class UnitTestClientSettingsController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,37 +22,21 @@ public class UnitTestClientSettingsController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
|         _ControllerName = nameof(Server.ApiControllers.ClientSettingsController)[..^10]; | ||||
|     } | ||||
|  | ||||
|     private static void NonThrowTryCatch() | ||||
|     { | ||||
|         try | ||||
|         { throw new Exception(); } | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IClientSettingsController<object>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void GetClientSettings() | ||||
|     { | ||||
| @ -61,33 +45,31 @@ public class UnitTestClientSettingsController : BaseTestClass | ||||
|         IClientSettingsRepository? clientSettingsRepository = serviceProvider?.GetRequiredService<IClientSettingsRepository>(); | ||||
| #if DEBUG | ||||
|         List<string>? clientSettings = clientSettingsRepository?.GetClientSettings(null); | ||||
|         Assert.IsNotNull(clientSettings); | ||||
|         Assert.IsTrue(clientSettings is not null); | ||||
| #endif | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
| #pragma warning disable CS1998 | ||||
|     [TestMethod] | ||||
|     public async Task GetClientSettingsApi() | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
| #if DEBUG | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string actionName = nameof(IClientSettingsController<object>.Action.Client); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}"); | ||||
|         Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content.Headers.ContentType); | ||||
|         Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType.ToString()); | ||||
|         string? json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString()); | ||||
|         string json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetClientSettings)}.json"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         Assert.AreNotEqual("[]", json); | ||||
|         Assert.IsTrue(json != "[]"); | ||||
| #endif | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
| #pragma warning restore CS1998 | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void GetIpAddress() | ||||
| @ -96,8 +78,8 @@ public class UnitTestClientSettingsController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IClientSettingsRepository? clientSettingsRepository = serviceProvider?.GetRequiredService<IClientSettingsRepository>(); | ||||
|         string? ipAddress = clientSettingsRepository?.GetIpAddress(null); | ||||
|         Assert.IsNotNull(ipAddress); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(ipAddress is not null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -105,16 +87,15 @@ public class UnitTestClientSettingsController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string actionName = nameof(IClientSettingsController<object>.Action.IP); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}"); | ||||
|         Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         Assert.IsNotNull(httpResponseMessage.Content.Headers.ContentType); | ||||
|         Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType.ToString()); | ||||
|         string? json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString()); | ||||
|         string json = await httpResponseMessage.Content.ReadAsStringAsync(); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetIpAddress)}.json"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -9,14 +9,14 @@ using System.Text; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestExportController : BaseTestClass | ||||
| public class UnitTestExportController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -24,6 +24,7 @@ public class UnitTestExportController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -37,19 +38,12 @@ public class UnitTestExportController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -67,7 +61,7 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         string? result = exportRepository?.GetExport(GetHeaderCommon()); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -76,11 +70,11 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/export"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExport)}.txt"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -89,10 +83,10 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/export", GetStringContent()); | ||||
|         Assert.AreEqual(System.Net.HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -104,7 +98,7 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         Result<HeaderCommon[]>? result = exportRepository?.GetHeaders(GetHeaderCommon()); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -113,12 +107,12 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/headers"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json); | ||||
|         Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -127,10 +121,10 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/headers", GetStringContent()); | ||||
|         Assert.AreEqual(System.Net.HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -142,7 +136,7 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         Result<HeaderCommon[]>? result = exportRepository?.GetLogistics(GetHeaderCommon()); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -151,12 +145,12 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/logistics"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLogistics)}.json"), json); | ||||
|         Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -165,10 +159,10 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/logistics", GetStringContent()); | ||||
|         Assert.AreEqual(System.Net.HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -180,7 +174,7 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         string? result = exportRepository?.GetProcessDataStandardFormat(GetHeaderCommon()); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -189,11 +183,11 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/processDataStandardFormat"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProcessDataStandardFormat)}.pdsf"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -202,10 +196,10 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/processDataStandardFormat", GetStringContent()); | ||||
|         Assert.AreEqual(System.Net.HttpStatusCode.OK, httpResponseMessage.StatusCode); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -217,11 +211,11 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<DataTable>? result = exportRepository?.GetExportData(metrologyRepository, toolTypeId: 1, datebegin: null, dateend: null); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -230,16 +224,15 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/export?datebegin=&dateend="); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExportData)}.json"), json); | ||||
|         Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public void GetCSVExport() | ||||
|     { | ||||
| @ -247,10 +240,10 @@ public class UnitTestExportController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IExportRepository? exportRepository = serviceProvider?.GetRequiredService<IExportRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         string? result = exportRepository?.GetCSVExport(metrologyRepository, toolTypeId: 1, datebegin: null, dateend: null); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -259,11 +252,11 @@ public class UnitTestExportController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/1/csv?datebegin=&dateend="); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCSVExport)}.csv"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -9,14 +9,14 @@ using System.Collections.ObjectModel; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestFileShareController : BaseTestClass | ||||
| public class UnitTestFileShareController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -24,6 +24,7 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>(); | ||||
| @ -38,19 +39,12 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -60,10 +54,10 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/file-share/copy-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -73,29 +67,25 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/file-share/move-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
|     [TestMethod] | ||||
|     public async Task FileWriteApi() | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/file-share/file-write/?path=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\b.pdsf&contents=b"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void GetArchiveData() | ||||
|     { | ||||
| @ -104,7 +94,7 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|         CharacterizationParameters characterizationParameters; | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>(); | ||||
|         characterizationParameters = new("MU", "MU-6INCH", "*.wc", null, null, "6INCH"); | ||||
|         characterizationParameters = new("FQA", "FQA-8INCH", "*.wc", null, null, "8INCH"); | ||||
|         result = fileShareRepository?.GetArchiveData(characterizationParameters); | ||||
|         Assert.IsNotNull(result); | ||||
|         characterizationParameters = new(string.Empty, "BIORAD4", "BIO*.json", null, null, "8INCH"); | ||||
| @ -113,28 +103,22 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|         characterizationParameters = new(string.Empty, "CDE5", "CDE*.json", null, null, "8INCH"); | ||||
|         result = fileShareRepository?.GetArchiveData(characterizationParameters); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public async Task ArchiveDataApi() | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/file-share/archive-data/?area=FQA&equipment-id=FQA-8INCH&search-pattern=*.wc&wafer-size=8INCH"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public void EquipmentIds() | ||||
|     { | ||||
| @ -143,22 +127,19 @@ public class UnitTestFileShareController : BaseTestClass | ||||
|         IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>(); | ||||
|         ReadOnlyCollection<ToolTypeNameId>? result = fileShareRepository?.GetEquipmentIds(); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| #if DEBUG | ||||
|     [Ignore] | ||||
| #endif | ||||
|     [TestMethod] | ||||
|     public async Task EquipmentIdsApi() | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/file-share/equipment-ids"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -6,14 +6,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestISpreadingResistanceProfileController : BaseTestClass | ||||
| public class UnitTestISpreadingResistanceProfileController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -21,6 +21,7 @@ public class UnitTestISpreadingResistanceProfileController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -34,19 +35,12 @@ public class UnitTestISpreadingResistanceProfileController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(ISpreadingResistanceProfileController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -64,11 +58,11 @@ public class UnitTestISpreadingResistanceProfileController : BaseTestClass | ||||
|             IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|             ISpreadingResistanceProfileService? spreadingResistanceProfileService = serviceProvider?.GetRequiredService<ISpreadingResistanceProfileService>(); | ||||
|             byte[]? bytes = spreadingResistanceProfileService?.GetImageBytes(json); | ||||
|             Assert.IsNotNull(bytes); | ||||
|             Assert.AreNotEqual(0, bytes.Length); | ||||
|             Assert.IsTrue(bytes is not null); | ||||
|             Assert.IsTrue(bytes.Length != 0); | ||||
|             File.WriteAllBytes(Path.Combine(directory, "srp.png"), bytes); | ||||
|         } | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestInfinityQSController : BaseTestClass | ||||
| public class UnitTestInfinityQSController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,6 +22,7 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -35,19 +36,12 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -62,7 +56,7 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>(); | ||||
|         string? result = infinityQSRepository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", ""); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -74,11 +68,11 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/commandText/?sub_group_id=1677273357&process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -92,12 +86,14 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>(); | ||||
|         Result<InfinityQSBase[]>? result = infinityQSRepository?.GetData("1677273357"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.IsNotNull(result.Results[0].PR_NAME); | ||||
|         Assert.IsNotNull(result.Results[0].TD_NAME); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].PR_NAME); | ||||
|         Assert.IsNotNull(result?.Results[0].SE_SGTM); | ||||
|         Assert.IsNotNull(result?.Results[0].SE_TSNO); | ||||
|         Assert.IsNotNull(result?.Results[0].TD_NAME); | ||||
|         Assert.IsNotNull(result?.Results[0].TD_TEST); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -109,13 +105,13 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json); | ||||
|         Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -129,12 +125,11 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>(); | ||||
|         Result<InfinityQSDescriptor[]>? result = infinityQSRepository?.GetDescriptors("1677273357"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.IsNotNull(result.Results[0].SD_SGRP); | ||||
|         Assert.IsNotNull(result.Results[0].SD_TSNO); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].SD_SGRP); | ||||
|         Assert.IsNotNull(result?.Results[0].SD_TSNO); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -146,13 +141,13 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json); | ||||
|         Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -167,7 +162,7 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>(); | ||||
|         Result<InfinityQSEvent[]>? result = infinityQSRepository?.GetEvents("1677273357"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -179,12 +174,12 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json); | ||||
|         Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -199,7 +194,7 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|         IInfinityQSRepository? infinityQSRepository = serviceProvider?.GetRequiredService<IInfinityQSRepository>(); | ||||
|         Result<InfinityQSBase[]>? result = infinityQSRepository?.GetHeader("1677273357"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -211,12 +206,12 @@ public class UnitTestInfinityQSController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json); | ||||
|         Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
| public class UnitTestInfinityQSV2Controller | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,6 +22,7 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -35,19 +36,12 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -59,7 +53,7 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>(); | ||||
|         string? result = infinityQSV2Repository?.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", ""); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -71,11 +65,11 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -89,16 +83,14 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>(); | ||||
|         Result<InfinityQSBaseV2[]>? result = infinityQSV2Repository?.GetData("1677273357"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.IsNotNull(result.Results[0].Process); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].Process); | ||||
|         Assert.IsNotNull(result?.Results[0].Variable); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].VariableNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupDateTime); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -110,13 +102,13 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/data"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/data"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json); | ||||
|         Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -130,12 +122,11 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>(); | ||||
|         Result<InfinityQSDescriptorV2[]>? result = infinityQSV2Repository?.GetDescriptors("1677273357"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupId); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -147,13 +138,13 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357 575908_2023-02-24 14-18-05.txt/descriptors"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/descriptors"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json); | ||||
|         Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -168,7 +159,7 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         IInfinityQSV2Repository? infinityQSV2Repository = serviceProvider?.GetRequiredService<IInfinityQSV2Repository>(); | ||||
|         Result<InfinityQSEventV2[]>? result = infinityQSV2Repository?.GetEvents("1677273357"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -180,12 +171,12 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/events"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEvents)}.json"), json); | ||||
|         Result<InfinityQSEventV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEventV2[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -201,7 +192,7 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|         Result<InfinityQSBaseV2[]>? result = infinityQSV2Repository?.GetHeader("1677273357"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -213,13 +204,13 @@ public class UnitTestInfinityQSV2Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1677273357/header"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json); | ||||
|         Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
| public class UnitTestInfinityQSV3Controller | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,6 +22,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -35,19 +36,12 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IInfinityQSV3Controller<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -59,7 +53,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         string? result = infinityQSV3Repository?.GetCommandText("1698497987", "61", "CDE5", "5012", "575908", ""); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -68,11 +62,11 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -83,15 +77,14 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetData("1698497987"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].Process); | ||||
|         Assert.IsNotNull(result?.Results[0].Variable); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].VariableNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupDateTime); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -100,13 +93,13 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/data"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/data"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json); | ||||
|         Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -117,12 +110,11 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         Result<InfinityQSDescriptorV3[]>? result = infinityQSV3Repository?.GetDescriptors("1698497987"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result.Results[0].SubGroupId); | ||||
|         Assert.IsNotNull(result.Results[0].SiteNumber); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupId); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -131,13 +123,13 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987 575908_2023-02-24 14-18-05.txt/descriptors"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/descriptors"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json); | ||||
|         Result<InfinityQSDescriptorV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV3[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -150,7 +142,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         Result<InfinityQSV3[]>? result = infinityQSV3Repository?.GetHeader("1698497987"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -159,13 +151,13 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1698497987/header"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json); | ||||
|         Result<InfinityQSV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV3[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -177,7 +169,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         string? result = infinityQSV3Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR"); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -186,11 +178,11 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -203,7 +195,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         List<string[]>? results = infinityQSV3Repository?.GetEpiProTempVerificationRows(night); | ||||
|         Assert.IsNotNull(results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -212,11 +204,11 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification-rows/?night=44&night=46&night=52&night=54"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerificationRows)}.json"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -229,7 +221,7 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|         IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>(); | ||||
|         string? result = infinityQSV3Repository?.GetEpiProTempVerification(night); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -238,11 +230,11 @@ public class UnitTestInfinityQSV3Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification/?night=44&night=46&night=52&night=54"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -8,14 +8,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
| public class UnitTestInfinityQSV4Controller | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static string _ControllerVersion; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| @ -24,6 +24,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -38,20 +39,13 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteName(), _ControllerName); | ||||
|         Assert.AreEqual(IInfinityQSV4Controller<string>.GetRouteVersion(), _ControllerVersion); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -63,7 +57,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         string? result = infinityQSV4Repository?.GetCommandText("1718539249", "61", "CDE5", "5012", "575908", ""); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -72,11 +66,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/commandText/?process=61&job=CDE5&part=5012&lot=575908&date_time=2023-02-24 15:15:00"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json); | ||||
|         Assert.IsNotNull(json); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -87,15 +81,14 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         Result<InfinityQSV4[]>? result = infinityQSV4Repository?.GetData("1718539249"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].Process); | ||||
|         Assert.IsNotNull(result?.Results[0].Variable); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].VariableNumber); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupDateTime); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -104,13 +97,13 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249 575908_2023-02-24 14-18-05.txt/data"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/data"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json); | ||||
|         Result<InfinityQSV4[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV4[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -121,12 +114,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         Result<InfinityQSDescriptorV4[]>? result = infinityQSV4Repository?.GetDescriptors("1718539249"); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         Assert.IsNotNull(result?.Results[0].SubGroupId); | ||||
|         Assert.IsNotNull(result?.Results[0].SiteNumber); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -135,13 +127,13 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         //string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249 575908_2023-02-24 14-18-05.txt/descriptors"); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/descriptors"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetDescriptors)}.json"), json); | ||||
|         Result<InfinityQSDescriptorV3[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV3[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -154,7 +146,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         Result<InfinityQSV4[]>? result = infinityQSV4Repository?.GetHeader("1718539249"); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -163,13 +155,13 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/1718539249/header"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeader)}.json"), json); | ||||
|         Result<InfinityQSV4[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSV4[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result?.Results[0].Part); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -181,7 +173,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         string? result = infinityQSV4Repository?.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma("41", "8IN_THIN ROTR"); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -190,11 +182,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/41/product-data-average-sum-of-defects-process-mean-process-sigma?recipe=8IN_THIN ROTR"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProductDataAverageSumOfDefectsProcessMeanProcessSigma)}.json"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -207,7 +199,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         List<string[]>? results = infinityQSV4Repository?.GetEpiProTempVerificationRows(night); | ||||
|         Assert.IsNotNull(results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -216,11 +208,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/epi-pro-temp-verification-rows/?night=44&night=46&night=52&night=54"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerificationRows)}.json"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -233,7 +225,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         string? result = infinityQSV4Repository?.GetEpiProTempVerification(night); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -242,11 +234,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/epi-pro-temp-verification/?night=44&night=46&night=52&night=54"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerification)}.html"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -258,7 +250,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         List<Reactor>? results = infinityQSV4Repository?.GetReactors(); | ||||
|         Assert.IsNotNull(results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -274,7 +266,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|             result = infinityQSV4Repository?.GetProductionSpecification(part); | ||||
|             Assert.IsNotNull(result); | ||||
|         } | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -306,7 +298,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|             result = infinityQSV4Repository?.GetProductionSpecification(part); | ||||
|             Assert.IsNotNull(result); | ||||
|         } | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -321,7 +313,7 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>(); | ||||
|         string? result = infinityQSV4Repository?.GetLastGroupIdWithValue(process, part, test); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -333,11 +325,11 @@ public class UnitTestInfinityQSV4Controller : BaseTestClass | ||||
|         const string process = "35"; | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerVersion}/{_ControllerName}/{process}/last-group-id-with-value/?part={part}&test={test}"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLastGroupIdWithValue)}.html"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -6,14 +6,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestOpenInsightV1Controller : BaseTestClass | ||||
| public class UnitTestOpenInsightV1Controller | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -21,6 +21,7 @@ public class UnitTestOpenInsightV1Controller : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -34,19 +35,12 @@ public class UnitTestOpenInsightV1Controller : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IOpenInsightV1Controller<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -57,7 +51,7 @@ public class UnitTestOpenInsightV1Controller : BaseTestClass | ||||
|         IOpenInsightV1Repository? openInsightRepository = serviceProvider?.GetRequiredService<IOpenInsightV1Repository>(); | ||||
|         string? result = openInsightRepository?.GetTencorRun("615071", "10/30/2023 06:48:34PM", "6IN_EPP ROTR"); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -66,11 +60,11 @@ public class UnitTestOpenInsightV1Controller : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/615071/tencor-run?insert_date=10/30/2023 06:48:34PM&recipe=6IN_EPP ROTR"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetTencorRun)}.json"), result); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestPinController : BaseTestClass | ||||
| public class UnitTestPinController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,32 +22,19 @@ public class UnitTestPinController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
|         _ControllerName = nameof(Server.ApiControllers.PinController)[..^10]; | ||||
|     } | ||||
|  | ||||
|     private static void NonThrowTryCatch() | ||||
|     { | ||||
|         try | ||||
|         { throw new Exception(); } | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IPinController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -60,7 +47,7 @@ public class UnitTestPinController : BaseTestClass | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Result<Pinned[]>? result = pinRepository?.GetPinnedTable(metrologyRepository, id: 1, cde_id: null, biorad_id: null, rds: null); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -73,7 +60,7 @@ public class UnitTestPinController : BaseTestClass | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetPinnedTable)}.json"), json); | ||||
|         Result<Pinned[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<Pinned[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.ViewModels; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestServiceShopOrderController : BaseTestClass | ||||
| public class UnitTestServiceShopOrderController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,32 +22,19 @@ public class UnitTestServiceShopOrderController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
|         _ControllerName = nameof(Server.ApiControllers.ServiceShopOrderController)[..^10]; | ||||
|     } | ||||
|  | ||||
|     private static void NonThrowTryCatch() | ||||
|     { | ||||
|         try | ||||
|         { throw new Exception(); } | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IServiceShopOrderController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -55,9 +42,9 @@ public class UnitTestServiceShopOrderController : BaseTestClass | ||||
|     { | ||||
|         if (_Logger is null) | ||||
|             throw new NullReferenceException(nameof(_Logger)); | ||||
|         ServiceShopOrder[]? serviceShopOrders = IServiceShopOrder.GetServiceShopOrders(null); | ||||
|         ServiceShopOrder[] serviceShopOrders = IServiceShopOrder.GetServiceShopOrders(null); | ||||
|         Assert.IsNotNull(serviceShopOrders); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -67,13 +54,13 @@ public class UnitTestServiceShopOrderController : BaseTestClass | ||||
|         ServiceShopOrder[]? serviceShopOrders; | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IServiceShopOrderRepository? serviceShopOrderRepository = serviceProvider?.GetRequiredService<IServiceShopOrderRepository>(); | ||||
|         Assert.IsNotNull(serviceShopOrderRepository); | ||||
|         Assert.IsTrue(serviceShopOrderRepository is not null); | ||||
|         serviceShopOrders = await serviceShopOrderRepository.GetAllServiceShopOrders(); | ||||
|         Assert.IsNotNull(serviceShopOrders); | ||||
|         Assert.IsTrue(serviceShopOrders is not null); | ||||
|         serviceShopOrders = await serviceShopOrderRepository.GetServiceShopOrders("23188d3d-9b75-ed11-ab8b-0050568f2fc3"); | ||||
|         Assert.IsTrue(serviceShopOrders is not null && serviceShopOrders.Length != 0); | ||||
|         Assert.IsNotNull(serviceShopOrders[0].ToString()); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -81,14 +68,14 @@ public class UnitTestServiceShopOrderController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string actionName = nameof(IServiceShopOrderController<object>.Action.All); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/{actionName}"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetAllServiceShopOrders)}.json"), json); | ||||
|         ServiceShopOrder[]? serviceShopOrders = System.Text.Json.JsonSerializer.Deserialize<ServiceShopOrder[]>(json); | ||||
|         Assert.IsNotNull(serviceShopOrders); | ||||
|         Assert.AreNotEqual(0, serviceShopOrders.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(serviceShopOrders.Length != 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -10,14 +10,14 @@ using System.Net.Http.Json; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestToolTypesController : BaseTestClass | ||||
| public class UnitTestToolTypesController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Server.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -25,6 +25,7 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Server.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>(); | ||||
| @ -38,19 +39,12 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IToolTypesController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -60,12 +54,12 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<ToolTypeNameId[]>? result = toolTypesRepository?.Index(metrologyRepository); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsTrue(result.Results.Length != 0); | ||||
|         Assert.IsFalse(result.Results.All(l => l.ID == 0)); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -73,14 +67,14 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(Index)}.json"), json); | ||||
|         Result<ToolTypeNameId[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeNameId[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         Assert.IsTrue(result.Results.Length != 0); | ||||
|         Assert.IsFalse(result.Results.All(l => l.ID == 0)); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -90,13 +84,13 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<ToolTypeMetadataResult>? result = toolTypesRepository?.GetToolTypeMetadata(metrologyRepository, id: 1, sortby: string.Empty); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Metadata); | ||||
|         Assert.AreNotEqual(0, result.Results.Metadata.Length); | ||||
|         Assert.IsTrue(result.Results.Metadata.Length != 0); | ||||
|         Assert.IsFalse(result.Results.Metadata.All(l => l.ToolTypeID == 0)); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -104,15 +98,15 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetToolTypeMetadata)}.json"), json); | ||||
|         Result<ToolTypeMetadataResult>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeMetadataResult>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Metadata); | ||||
|         Assert.AreNotEqual(0, result.Results.Metadata.Length); | ||||
|         Assert.IsTrue(result.Results.Metadata.Length != 0); | ||||
|         Assert.IsFalse(result.Results.Metadata.All(l => l.ToolTypeID == 0)); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -122,11 +116,11 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<DataTable>? result = toolTypesRepository?.GetHeaders(metrologyRepository, id: 1, datebegin: null, dateend: null, page: null, pagesize: null, headerid: null); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -134,13 +128,13 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaders)}.json"), json); | ||||
|         Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -150,12 +144,11 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<HeaderCommon[]>? result = toolTypesRepository?.GetHeaderTitles(metrologyRepository, id: -1, page: null, pagesize: null); | ||||
|         Assert.IsNotNull(result); | ||||
|         Assert.IsNotNull(result.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsTrue(result?.Results.Length != 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -163,13 +156,13 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/-1/headertitles"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaderTitles)}.json"), json); | ||||
|         Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(result.Results.Length != 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -179,11 +172,11 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<ColumnValue[]>? result = toolTypesRepository?.GetHeaderFields(metrologyRepository, id: 1, headerid: 1); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(result.Results.Length != 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -191,13 +184,13 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/fields"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetHeaderFields)}.json"), json); | ||||
|         Result<ColumnValue[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ColumnValue[]>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.AreNotEqual(0, result.Results.Length); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(result.Results.Length != 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -207,11 +200,11 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Result<DataTable>? result = toolTypesRepository?.GetData(metrologyRepository, id: 1, headerid: 1); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
| @ -219,13 +212,13 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/data"); | ||||
|         File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetData)}.json"), json); | ||||
|         Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json); | ||||
|         Assert.IsNotNull(result?.Results); | ||||
|         Assert.IsNotNull(result.Results.Rows.Count > 0); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -234,19 +227,19 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         int toolTypeId = 1; | ||||
|         string tableType = "data"; | ||||
|         string tabletype = "data"; | ||||
|         string filename = "data.txt"; | ||||
|         string attachmentId = "ffdf5410-ca19-4097-bfa4-b398e236d07e"; | ||||
|         IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider; | ||||
|         IAttachmentsService? attachmentsService = serviceProvider?.GetRequiredService<IAttachmentsService>(); | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Assert.IsNotNull(attachmentsService); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsNotNull(toolTypesRepository); | ||||
|         (string? message, string? _, Stream? _) = toolTypesRepository.GetAttachment(metrologyRepository, attachmentsService, toolTypeId, tableType, attachmentId, filename); | ||||
|         Assert.IsNull(message); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(attachmentsService is not null); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         Assert.IsTrue(toolTypesRepository is not null); | ||||
|         (string? message, string? _, Stream? _) = toolTypesRepository.GetAttachment(metrologyRepository, attachmentsService, toolTypeId, tabletype, attachmentId, filename); | ||||
|         Assert.IsTrue(message is null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -255,9 +248,9 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/1/data/files/ffdf5410-ca19-4097-bfa4-b398e236d07e/data.txt"); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -270,12 +263,12 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|         IMetrologyRepository? metrologyRepository = serviceProvider?.GetRequiredService<IMetrologyRepository>(); | ||||
|         IToolTypesRepository? toolTypesRepository = serviceProvider?.GetRequiredService<IToolTypesRepository>(); | ||||
|         Server.Models.AppSettings? appSettings = serviceProvider?.GetRequiredService<Server.Models.AppSettings>(); | ||||
|         Assert.IsNotNull(appSettings); | ||||
|         Assert.IsNotNull(attachmentsService); | ||||
|         Assert.IsNotNull(metrologyRepository); | ||||
|         Assert.IsTrue(appSettings is not null); | ||||
|         Assert.IsTrue(attachmentsService is not null); | ||||
|         Assert.IsTrue(metrologyRepository is not null); | ||||
|         string? message = toolTypesRepository?.OIExport(metrologyRepository, attachmentsService, toolTypeId: 1, headerid: 1); | ||||
|         Assert.IsNull(message); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.IsTrue(message is null); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
|     [Ignore] | ||||
| @ -284,9 +277,9 @@ public class UnitTestToolTypesController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         _ = await httpClient.GetFromJsonAsync<object>($"api/{_ControllerName}/1/headers/1/export"); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -7,14 +7,14 @@ using OI.Metrology.Shared.Models.Stateless; | ||||
| namespace OI.Metrology.Tests; | ||||
|  | ||||
| [TestClass] | ||||
| public class UnitTestWaferCounterController : BaseTestClass | ||||
| public class UnitTestWaferCounterController | ||||
| { | ||||
|  | ||||
| #pragma warning disable CS8618 | ||||
|  | ||||
|     private static ILogger? _Logger; | ||||
|     private static string _ControllerName; | ||||
|     public TestContext TestContext { get; set; } | ||||
|     private static string? _TestContextTestName; | ||||
|     private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory; | ||||
|  | ||||
| #pragma warning restore | ||||
| @ -22,6 +22,7 @@ public class UnitTestWaferCounterController : BaseTestClass | ||||
|     [ClassInitialize] | ||||
|     public static void ClassInitAsync(TestContext testContext) | ||||
|     { | ||||
|         _TestContextTestName = testContext.TestName; | ||||
|         _WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>(); | ||||
|         IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider; | ||||
|         _Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>(); | ||||
| @ -35,19 +36,12 @@ public class UnitTestWaferCounterController : BaseTestClass | ||||
|         catch (Exception) { } | ||||
|     } | ||||
|  | ||||
|     [TestCleanup] | ||||
|     public void TestCleanup() | ||||
|     { | ||||
|         if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed) | ||||
|             IncrementFailedTests(); | ||||
|     } | ||||
|  | ||||
|     [TestMethod] | ||||
|     public void TestControllerName() | ||||
|     { | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.AreEqual(IWaferCounterController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -60,7 +54,7 @@ public class UnitTestWaferCounterController : BaseTestClass | ||||
|         IWaferCounterRepository? waferCounterRepository = serviceProvider?.GetRequiredService<IWaferCounterRepository>(); | ||||
|         WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMap(area: "FQA", waferSize: "8INCH", text: "Test"); | ||||
|         Assert.IsNotNull(result); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
| @ -70,10 +64,10 @@ public class UnitTestWaferCounterController : BaseTestClass | ||||
|     { | ||||
|         HttpClient? httpClient = _WebApplicationFactory?.CreateClient(); | ||||
|         _Logger?.LogInformation("Starting Web Application"); | ||||
|         Assert.IsNotNull(httpClient); | ||||
|         Assert.IsTrue(httpClient is not null); | ||||
|         string? response = await httpClient.GetStringAsync($"api/v1/{_ControllerName}/FQA/last-quantity-and-slot-map/?waferSize=8INCH&text=Test"); | ||||
|         Assert.IsNotNull(response); | ||||
|         _Logger?.LogInformation("{TestName} completed", TestContext.TestName); | ||||
|         _Logger?.LogInformation("{TestName} completed", _TestContextTestName); | ||||
|         NonThrowTryCatch(); | ||||
|     } | ||||
|  | ||||
|  | ||||
							
								
								
									
										2
									
								
								Wafer-Counter/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								Wafer-Counter/.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ | ||||
|             "name": ".NET Core Launch (web)", | ||||
|             "type": "coreclr", | ||||
|             "request": "launch", | ||||
|             "preLaunchTask": "Build", | ||||
|             "preLaunchTask": "build", | ||||
|             // If you have changed target frameworks, make sure to update the program path. | ||||
|             "program": "${workspaceFolder}/bin/Debug/net8.0/OI.Metrology.Wafer.Counter.dll", | ||||
|             "args": [], | ||||
|  | ||||
							
								
								
									
										485
									
								
								Wafer-Counter/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										485
									
								
								Wafer-Counter/.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @ -1,173 +1,70 @@ | ||||
| { | ||||
|     "inputs": [ | ||||
|         { | ||||
|             "default": "Development", | ||||
|             "description": "Which ASP Net Core Environment?", | ||||
|             "id": "ASPNETCORE_ENVIRONMENT", | ||||
|             "options": [ | ||||
|                 "Development", | ||||
|                 "Production" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{AssemblyTitle}", | ||||
|             "description": "What Assembly Title?", | ||||
|             "id": "AssemblyTitle", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.BuildId}", | ||||
|             "description": "Which Build BuildId?", | ||||
|             "id": "Build.BuildId", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Reason}", | ||||
|             "description": "Which Build Reason?", | ||||
|             "id": "Build.Reason", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Id}", | ||||
|             "description": "Which Build Repository Id?", | ||||
|             "id": "Build.Repository.Id", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.Repository.Name}", | ||||
|             "description": "Which Build Repository Name?", | ||||
|             "id": "Build.Repository.Name", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{Build.SourceVersion}", | ||||
|             "description": "Which Build Source Version?", | ||||
|             "id": "Build.SourceVersion", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "Debug", | ||||
|             "description": "Which Configuration?", | ||||
|             "id": "Configuration", | ||||
|             "options": [ | ||||
|                 "Debug", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "net8.0", | ||||
|             "description": "Which Core Version?", | ||||
|             "id": "CoreVersion", | ||||
|             "options": [ | ||||
|                 "net8.0" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe", | ||||
|             "description": "Which MS Build?", | ||||
|             "id": "MSBuild", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/", | ||||
|             "description": "Which Nuget Source?", | ||||
|             "id": "NugetSource", | ||||
|             "type": "promptString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "win-x64", | ||||
|             "description": "Which Runtime?", | ||||
|             "id": "Runtime", | ||||
|             "options": [ | ||||
|                 "win-x64", | ||||
|                 "win-x32", | ||||
|                 "linux-x64", | ||||
|                 "linux-x32" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "L:/", | ||||
|             "description": "Which System DefaultWorkingDirectory?", | ||||
|             "id": "System.DefaultWorkingDirectory", | ||||
|             "options": [ | ||||
|                 "L:/", | ||||
|                 "D:/", | ||||
|                 "C:/" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "v4.8", | ||||
|             "description": "Which Core Target Framework Version?", | ||||
|             "id": "TargetFrameworkVersion", | ||||
|             "options": [ | ||||
|                 "v4.8" | ||||
|             ], | ||||
|             "type": "pickString" | ||||
|         }, | ||||
|         { | ||||
|             "default": "{UserSecretsId}", | ||||
|             "description": "Which Core User Secrets Id?", | ||||
|             "id": "UserSecretsId", | ||||
|             "type": "promptString" | ||||
|         } | ||||
|     ], | ||||
|     "version": "2.0.0", | ||||
|     "tasks": [ | ||||
|         { | ||||
|             "label": "dotnetRunDebug", | ||||
|             "command": "dotnet OI.Metrology.Wafer.Counter.dll", | ||||
|             "label": "Dotnet Run Debug", | ||||
|             "dependsOn": "build", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell", | ||||
|             "options": { | ||||
|               "cwd": "${workspaceFolder}/bin/Debug/net8.0" | ||||
|             }, | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|             } | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build" | ||||
|             ], | ||||
|             "label": "build", | ||||
|             "command": "dotnet", | ||||
|             "label": "Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj" | ||||
|                 "${workspaceFolder}/OI.Metrology.Wafer.Counter.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Build Tests", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "buildTests", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj" | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Test Debug", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "testDebug", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary" | ||||
|             ], | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "testRelease", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "-c", | ||||
|                 "Release" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Test Release", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "format", | ||||
|                 "--report", | ||||
| @ -177,24 +74,27 @@ | ||||
|                 "--severity", | ||||
|                 "warn" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Format", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Format-Whitespace", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "format", | ||||
|                 "whitespace" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Format Whitespace", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "publish", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/OI.Metrology.Wafer.Counter.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "--configuration", | ||||
|                 "Release", | ||||
|                 "--runtime", | ||||
| @ -203,14 +103,17 @@ | ||||
|                 "-o", | ||||
|                 "D:/web-sites/OI-Metrology/oo-8e5dd137-_______-OI-Metrology-Release/Wafer-Counter" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "Publish AOT", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "${workspaceFolder}/OI.Metrology.Wafer.Counter.csproj", | ||||
|                 "/property:GenerateFullPaths=true", | ||||
|                 "/consoleloggerparameters:NoSummary", | ||||
|                 "--configuration", | ||||
|                 "Release", | ||||
|                 "--runtime", | ||||
| @ -218,269 +121,53 @@ | ||||
|                 "-p:PublishAot=true", | ||||
|                 "/property:GenerateFullPaths=true" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Publish AOT", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "old-watch", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "watch", | ||||
|                 "run" | ||||
|                 "run", | ||||
|                 "--project", | ||||
|                 "${workspaceFolder}/OI.Metrology.Wafer.Counter.csproj" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Old Watch", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|             "problemMatcher": "$msCompile" | ||||
|         }, | ||||
|         { | ||||
|             "label": "watch", | ||||
|             "command": "dotnet", | ||||
|             "type": "process", | ||||
|             "args": [ | ||||
|                 "watch", | ||||
|                 "--launch-profile", | ||||
|                 "http", | ||||
|                 "run", | ||||
|                 "--project", | ||||
|                 "${workspaceFolder}/OI.Metrology.Wafer.Counter.csproj", | ||||
|                 "--verbose" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "dependsOn": [ | ||||
|                 "Build" | ||||
|             ], | ||||
|             "isBackground": true, | ||||
|             "label": "Watch", | ||||
|             "dependsOn": [ | ||||
|                 "build" | ||||
|             ], | ||||
|             "problemMatcher": { | ||||
|                 "fileLocation": "relative", | ||||
|                 "pattern": { | ||||
|                     "regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$", | ||||
|                     "file": 1, | ||||
|                     "location": 2, | ||||
|                     "severity": 3, | ||||
|                     "code": 4, | ||||
|                     "message": 5 | ||||
|                 }, | ||||
|                 "background": { | ||||
|                     "activeOnStart": true, | ||||
|                     "beginsPattern": "^.*Shutdown requested.*", | ||||
|                     "endsPattern": "^.*Application started.*" | ||||
|                 }, | ||||
|                 "fileLocation": "relative", | ||||
|                 "pattern": { | ||||
|                     "code": 4, | ||||
|                     "file": 1, | ||||
|                     "location": 2, | ||||
|                     "message": 5, | ||||
|                     "regexp": "^([^\\s].*)\\((\\d+|\\d+,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$", | ||||
|                     "severity": 3 | ||||
|                 } | ||||
|             }, | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "command": "echo Assembly Title: ${input:AssemblyTitle} & echo Build Id: ${input:Build.BuildId} & echo Build Reason: ${input:Build.Reason} & echo Repo Id: ${input:Build.Repository.Id} & echo Repo Name: ${input:Build.Repository.Name} & echo Source Version: ${input:Build.SourceVersion} & echo Configuration: ${input:Configuration} & echo Core Version: ${input:CoreVersion} & echo Nuget Source: ${input:NugetSource} & echo Runtime: ${input:Runtime}", | ||||
|             "label": "Echo Check", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "dotnet user-secrets init & dotnet user-secrets set BuildNumber ${input:Build.BuildId} & dotnet user-secrets set GitCommit ${input:Build.SourceVersion} & dotnet user-secrets list", | ||||
|             "label": "Server - Safe storage of app secrets", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--source", | ||||
|                 "${input:NugetSource}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "build", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--source", | ||||
|                 "${input:NugetSource}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Build", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "test", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Test", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--runtime", | ||||
|                 "${input:Runtime}", | ||||
|                 "--self-contained" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "publish", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}", | ||||
|                 "--runtime", | ||||
|                 "${input:Runtime}", | ||||
|                 "-p:PublishAot=true" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - AOT Publish", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /MIR \"bin/${input:Configuration}/${input:CoreVersion}/${input:Runtime}/publish\" \"D:/${input:CoreVersion}/${input:Runtime}/${input:Build.Repository.Name}/${input:Configuration}/${input:Build.BuildId}/${input:AssemblyTitle}\") ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Copy Files to: D:/", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "tool", | ||||
|                 "restore" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tool Restore", | ||||
|             "problemMatcher": [], | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "ReportGenerator", | ||||
|                 "-reports:${input:System.DefaultWorkingDirectory}/TestResults/**/coverage.cobertura.xml", | ||||
|                 "-targetDir:${input:Build.ArtifactStagingDirectory}/Coverage", | ||||
|                 "-reportTypes:Html_Dark" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Report Generator", | ||||
|             "problemMatcher": [], | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "clean", | ||||
|                 "${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "Tests - Clean", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "clean", | ||||
|                 "--configuration", | ||||
|                 "${input:Configuration}" | ||||
|             ], | ||||
|             "command": "dotnet", | ||||
|             "label": "App - Clean", | ||||
|             "problemMatcher": "$msCompile", | ||||
|             "type": "process" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe stop apppool /apppool.name:${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Stop Pool", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe stop site /site.name:${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Stop Website", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "rmdir D:/web-sites/${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Remove MKLink", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "mklink /J \"D:\\web-sites\\${input:AssemblyTitle}.${input:Configuration}\" \"D:\\$(CoreVersion)\\$(Runtime)\\$(Build.Repository.Name)\\$(Configuration)\\$(Build.BuildId)\\$(AssemblyTitle)\"", | ||||
|             "label": "Create MKLink", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "mkdir D:/web-sites/${input:AssemblyTitle}.${input:Configuration}/${input:AssemblyTitle}.${input:Configuration} & exit 0", | ||||
|             "label": "Make Directory", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /E /IS /IT /IM \"%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)\" \"D:/$(CoreVersion)/$(Runtime)/$(Build.Repository.Name)/$(Configuration)/$(Build.BuildId)/$(AssemblyTitle)\" secrets.json) ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Replace User Secrets Id File", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "(robocopy /E /IS /IT /IM \"%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)\" \"D:/$(CoreVersion)/$(Runtime)/$(Build.Repository.Name)/$(Configuration)/$(Build.BuildId)/$(AssemblyTitle)\" web.config) ^& IF %ERRORLEVEL% LEQ 7 exit 0", | ||||
|             "label": "Replace Web Configuration File", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe start apppool /apppool.name:${input:AssemblyTitle}.${input:Configuration}", | ||||
|             "label": "Start Pool", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "command": "C:/Windows/system32/inetsrv/appcmd.exe start site /site.name:${input:AssemblyTitle}.${input:Configuration}", | ||||
|             "label": "Start Website", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|         }, | ||||
|         { | ||||
|             "args": [ | ||||
|                 "App - AOT Publish", | ||||
|                 "Tool Restore", | ||||
|                 "Report Generator" | ||||
|             ], | ||||
|             "command": "echo", | ||||
|             "dependsOn": [ | ||||
|                 "Echo Check", | ||||
|                 "Server - Safe storage of app secrets", | ||||
|                 "App - Build", | ||||
|                 "Tests - Build", | ||||
|                 "Tests - Test", | ||||
|                 "App - Publish", | ||||
|                 "Copy Files to: D:/", | ||||
|                 "Tests - Clean", | ||||
|                 "App - Clean", | ||||
|                 "Stop Pool", | ||||
|                 "Stop Website", | ||||
|                 "Remove MKLink", | ||||
|                 "Create MKLink", | ||||
|                 "Make Directory", | ||||
|                 "Replace User Secrets Id File", | ||||
|                 "Replace Web Configuration File", | ||||
|                 "Start Pool", | ||||
|                 "Start Website" | ||||
|             ], | ||||
|             "dependsOrder": "sequence", | ||||
|             "label": "Pipeline", | ||||
|             "problemMatcher": [], | ||||
|             "type": "shell" | ||||
|             } | ||||
|     ], | ||||
|     "version": "2.0.0" | ||||
|         } | ||||
|     ] | ||||
| } | ||||
							
								
								
									
										26
									
								
								Wafer-Counter/ApiControllers/AzureDevOpsController.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								Wafer-Counter/ApiControllers/AzureDevOpsController.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using OI.Metrology.Shared.Models; | ||||
| using OI.Metrology.Shared.Models.Stateless; | ||||
| using OI.Metrology.Wafer.Counter.Helper; | ||||
|  | ||||
| namespace OI.Metrology.Wafer.Counter.ApiControllers; | ||||
|  | ||||
| [Route("api/v1/ado")] | ||||
| public class AzureDevOpsController : Controller, IAzureDevOpsController<IResult> | ||||
| { | ||||
|  | ||||
|     private readonly IAzureDevOpsRepository _AzureDevOpsRepository; | ||||
|  | ||||
|     public AzureDevOpsController(IAzureDevOpsRepository azureDevOpsRepository) => | ||||
|         _AzureDevOpsRepository = azureDevOpsRepository; | ||||
|  | ||||
|     [HttpPost("save")] | ||||
|     public IResult Save() | ||||
|     { | ||||
|         PollValue? pollValue = ParameterHelper.GetPollValue(Request.HttpContext.Connection?.RemoteIpAddress, Request.Body); | ||||
|         ArgumentNullException.ThrowIfNull(pollValue); | ||||
|         _AzureDevOpsRepository.Save(pollValue); | ||||
|         return Results.Ok(); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -2,7 +2,6 @@ using OI.Metrology.Shared.Models; | ||||
| using System.Collections.Specialized; | ||||
| using System.Net; | ||||
| using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
| using System.Web; | ||||
|  | ||||
| namespace OI.Metrology.Wafer.Counter.Helper; | ||||
| @ -30,9 +29,7 @@ public class ParameterHelper | ||||
|     { | ||||
|         CharacterizationParameters? result; | ||||
|         Dictionary<string, string?> keyValuePairs = GetKeyValuePairs(queryString); | ||||
| #pragma warning disable CS8620 | ||||
|         string json = JsonSerializer.Serialize(keyValuePairs, DictionaryStringStringSourceGenerationContext.Default.DictionaryStringString); | ||||
| #pragma warning restore CS8620 | ||||
|         string json = JsonSerializer.Serialize(keyValuePairs, new JsonSerializerOptions() { WriteIndented = true }); | ||||
|         result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, CharacterizationParametersSourceGenerationContext.Default.CharacterizationParameters); | ||||
|         return result; | ||||
|     } | ||||
| @ -71,9 +68,7 @@ public class ParameterHelper | ||||
|         PollValue? result; | ||||
|         string? queryString = GetQueryString(stream); | ||||
|         Dictionary<string, string?> keyValuePairs = GetKeyValuePairs(queryString); | ||||
| #pragma warning disable CS8620 | ||||
|         string json = JsonSerializer.Serialize(keyValuePairs, DictionaryStringStringSourceGenerationContext.Default.DictionaryStringString); | ||||
| #pragma warning restore CS8620 | ||||
|         string json = JsonSerializer.Serialize(keyValuePairs, new JsonSerializerOptions() { WriteIndented = true }); | ||||
|         result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, PollValueSourceGenerationContext.Default.PollValue); | ||||
|         if (result is not null) | ||||
|         { | ||||
| @ -85,9 +80,3 @@ public class ParameterHelper | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| [JsonSourceGenerationOptions(WriteIndented = true)] | ||||
| [JsonSerializable(typeof(Dictionary<string, string>))] | ||||
| public partial class DictionaryStringStringSourceGenerationContext : JsonSerializerContext | ||||
| { | ||||
| } | ||||
| @ -3,7 +3,8 @@ using System.Text.Json.Serialization; | ||||
|  | ||||
| namespace OI.Metrology.Wafer.Counter.Models; | ||||
|  | ||||
| public record AppSettings(string BuildNumber, | ||||
| public record AppSettings(string AzureDevOpsDestinationDirectory, | ||||
|                           string BuildNumber, | ||||
|                           string Company, | ||||
|                           string EcCharacterizationSi, | ||||
|                           string EcMesaFileShareCharacterizationSi, | ||||
| @ -36,7 +37,7 @@ public record AppSettings(string BuildNumber, | ||||
|     public static AppSettings Get(IConfigurationRoot configurationRoot) | ||||
|     { | ||||
|         AppSettings result; | ||||
|         AppSettings? appSettings = configurationRoot.Get<AppSettings>(); | ||||
|         AppSettings? appSettings = configurationRoot.GetSection(nameof(AppSettings)).Get<AppSettings>(); | ||||
| #pragma warning restore IL3050, IL2026 | ||||
|         if (appSettings is null | ||||
|             || appSettings?.Company is null) | ||||
| @ -52,7 +53,8 @@ public record AppSettings(string BuildNumber, | ||||
|             } | ||||
|             throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}"); | ||||
|         } | ||||
|         result = new(appSettings.BuildNumber, | ||||
|         result = new(appSettings.AzureDevOpsDestinationDirectory, | ||||
|                      appSettings.BuildNumber, | ||||
|                      appSettings.Company, | ||||
|                      appSettings.EcCharacterizationSi, | ||||
|                      appSettings.EcMesaFileShareCharacterizationSi, | ||||
|  | ||||
| @ -27,6 +27,7 @@ public class Program | ||||
|             _ = webApplicationBuilder.Services.AddHttpClient(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton(_ => appSettings); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IFileShareRepository, FileShareRepository>(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IAzureDevOpsRepository, AzureDevOpsRepository>(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IWaferCounterRepository, WaferCounterRepository>(); | ||||
|             _ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<AppSettings>>(_ => appSettingsRepository); | ||||
|  | ||||
|  | ||||
							
								
								
									
										25
									
								
								Wafer-Counter/Repositories/AzureDevOpsRepository.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Wafer-Counter/Repositories/AzureDevOpsRepository.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| using OI.Metrology.Shared.Models; | ||||
| using OI.Metrology.Shared.Models.Stateless; | ||||
| using OI.Metrology.Wafer.Counter.Models; | ||||
|  | ||||
| namespace OI.Metrology.Wafer.Counter.Repository; | ||||
|  | ||||
| public class AzureDevOpsRepository : IAzureDevOpsRepository | ||||
| { | ||||
|  | ||||
|     private readonly AppSettings _AppSettings; | ||||
|  | ||||
|     public AzureDevOpsRepository(AppSettings appSettings) => | ||||
|         _AppSettings = appSettings; | ||||
|  | ||||
|     void IAzureDevOpsRepository.Save(PollValue pollValue) | ||||
|     { | ||||
|         ArgumentNullException.ThrowIfNull(pollValue.Id); | ||||
|         ArgumentNullException.ThrowIfNull(pollValue.Page); | ||||
|         string directory = Path.Combine(_AppSettings.AzureDevOpsDestinationDirectory, pollValue.Page, pollValue.Id.Value.ToString()); | ||||
|         if (!Directory.Exists(directory)) | ||||
|             _ = Directory.CreateDirectory(directory); | ||||
|         File.WriteAllText(Path.Combine(directory, $"{pollValue.Time}.json"), pollValue.Json is null ? string.Empty : pollValue.Json); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -107,7 +107,7 @@ public class FileShareRepository : IFileShareRepository | ||||
|  | ||||
|     private static ReadOnlyCollection<string> GetValidDirectories(string equipmentDirectory, DateTime startDateTime, DateTime endDateTime) | ||||
|     { | ||||
|         List<string> results = [equipmentDirectory]; | ||||
|         List<string> results = []; | ||||
|         DateTime dateTime; | ||||
|         string weekOfYear; | ||||
|         Calendar calendar = new CultureInfo("en-US").Calendar; | ||||
|  | ||||
| @ -1,199 +0,0 @@ | ||||
| trigger: | ||||
|   branches: | ||||
|     include: | ||||
|       - master | ||||
|   paths: | ||||
|     include: | ||||
|       - Wafer-Counter | ||||
|  | ||||
| variables: | ||||
|   runtime: 'win-x64' | ||||
|   coreVersion: 'net8.0' | ||||
|   nugetSource: 'https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/' | ||||
|  | ||||
| stages: | ||||
|   - stage: Development | ||||
|     displayName: Development | ||||
|     pool: | ||||
|       name: 'OpenInsight Metrology Viewer' | ||||
|       demands: OpenInsight-Metrology-Viewer-Wafer-Counter-Development | ||||
|     variables: | ||||
|       ASPNETCORE_ENVIRONMENT: 'Development' | ||||
|       assemblyTitle: 'OI.Metrology.Wafer.Counter' | ||||
|       configuration: 'Debug' | ||||
|       userSecretsId: '2a0acd34-8f61-47a3-8818-73fa8fe04902' | ||||
|     jobs: | ||||
|       - job: DebugDotnet | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo Assembly Title: $(AssemblyTitle) | ||||
|               echo Build Id: $(Build.BuildId) | ||||
|               echo Build Reason: $(Build.Reason) | ||||
|               echo Repo Id: $(Build.Repository.Id) | ||||
|               echo Repo Name: $(Build.Repository.Name) | ||||
|               echo Source Version: $(Build.SourceVersion) | ||||
|               echo Configuration: $(Configuration) | ||||
|               echo Core Version: $(CoreVersion) | ||||
|               echo Nuget Source: $(NugetSource) | ||||
|               echo Runtime: $(Runtime) | ||||
|               echo UserSecretsId: $(UserSecretsId) | ||||
|             displayName: 'Echo Check' | ||||
|  | ||||
|           - script: | | ||||
|               dotnet user-secrets init | ||||
|               dotnet user-secrets set BuildNumber $(Build.BuildId) | ||||
|               dotnet user-secrets set GitCommit $(Build.SourceVersion) | ||||
|               dotnet user-secrets list | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Safe storage of app secrets' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Build' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Build' | ||||
|  | ||||
|           - script: dotnet test --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Test' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) --self-contained | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Publish' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) -p:PublishAot=true | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - AOT Publish' | ||||
|             enabled: false | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|             displayName: 'Copy Files to: D:\' | ||||
|             inputs: | ||||
|               Contents: '*' | ||||
|               SourceFolder: 'Wafer-Counter\bin\$(Configuration)\$(CoreVersion)\$(Runtime)\publish' | ||||
|               TargetFolder: 'D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)' | ||||
|               OverWrite: true | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Clean' | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Clean' | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe stop apppool /apppool.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Stop Pool' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe stop site /site.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Stop Website' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: rmdir "D:\web-sites\$(AssemblyTitle).$(Configuration)" | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Remove MKLink' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: mklink /J "D:\web-sites\$(AssemblyTitle).$(Configuration)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Create MKLink' | ||||
|  | ||||
|           - script: mkdir "D:\web-sites\$(AssemblyTitle).$(Configuration)\$(AssemblyTitle).$(Configuration)" | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Make Directory' | ||||
|             continueOnError: true | ||||
|  | ||||
|           - script: (robocopy /E /IS /IT /IM "%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" secrets.json) ^& IF %ERRORLEVEL% LEQ 7 exit 0 | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Replace User Secrets Id File' | ||||
|  | ||||
|           - script: (robocopy /E /IS /IT /IM "%USERPROFILE%/AppData/Roaming/Microsoft/UserSecrets/$(UserSecretsId)" "D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)" web.config) ^& IF %ERRORLEVEL% LEQ 7 exit 0 | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Replace Web Configuration File' | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe start apppool /apppool.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Start Pool' | ||||
|  | ||||
|           - script: C:/Windows/system32/inetsrv/appcmd.exe start site /site.name:$(AssemblyTitle).$(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'Start Website' | ||||
|  | ||||
|   - stage: Release | ||||
|     displayName: Release | ||||
|     pool: | ||||
|       name: 'OpenInsight Metrology Viewer' | ||||
|       demands: OpenInsight-Metrology-Viewer-Wafer-Counter | ||||
|     variables: | ||||
|       ASPNETCORE_ENVIRONMENT: 'Production' | ||||
|       assemblyTitle: 'OI.Metrology.Wafer.Counter' | ||||
|       configuration: 'Release' | ||||
|     jobs: | ||||
|       - job: ReleaseDotnet | ||||
|         steps: | ||||
|           - script: | | ||||
|               echo Assembly Title: $(AssemblyTitle) | ||||
|               echo Build Id: $(Build.BuildId) | ||||
|               echo Build Reason: $(Build.Reason) | ||||
|               echo Repo Id: $(Build.Repository.Id) | ||||
|               echo Repo Name: $(Build.Repository.Name) | ||||
|               echo Source Version: $(Build.SourceVersion) | ||||
|               echo Configuration: $(Configuration) | ||||
|               echo Core Version: $(CoreVersion) | ||||
|               echo Nuget Source: $(NugetSource) | ||||
|               echo Runtime: $(Runtime) | ||||
|             displayName: 'Echo Check' | ||||
|  | ||||
|           - script: | | ||||
|               dotnet user-secrets init | ||||
|               dotnet user-secrets set BuildNumber $(Build.BuildId) | ||||
|               dotnet user-secrets set GitCommit $(Build.SourceVersion) | ||||
|               dotnet user-secrets list | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Safe storage of app secrets' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Build' | ||||
|  | ||||
|           - script: dotnet build --configuration $(Configuration) --source $(NugetSource) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Build' | ||||
|  | ||||
|           - script: dotnet test --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Test' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) --self-contained | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Publish' | ||||
|  | ||||
|           - script: dotnet publish --configuration $(Configuration) --runtime $(Runtime) -p:PublishAot=true | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - AOT Publish' | ||||
|             enabled: false | ||||
|  | ||||
|           - task: CopyFiles@2 | ||||
|             displayName: 'Copy Files to: D:\' | ||||
|             inputs: | ||||
|               Contents: '*' | ||||
|               SourceFolder: 'Wafer-Counter\bin\$(Configuration)\$(CoreVersion)\$(Runtime)\publish' | ||||
|               TargetFolder: 'D:\$(CoreVersion)\$(Runtime)\$(Build.Repository.Name)\$(Configuration)\$(Build.BuildId)\$(AssemblyTitle)' | ||||
|               OverWrite: true | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Tests | ||||
|             displayName: 'Tests - Clean' | ||||
|  | ||||
|           - script: dotnet clean --configuration $(Configuration) | ||||
|             workingDirectory: Wafer-Counter | ||||
|             displayName: 'App - Clean' | ||||
|  | ||||
|           - script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt' | ||||
|             displayName: 'Force Fail' | ||||
|             enabled: false | ||||
		Reference in New Issue
	
	Block a user