nuget bump and userSecrets tasks and query update for event

Allow multiple ids are present
This commit is contained in:
Mike Phares 2023-04-05 13:15:24 -07:00
parent 994556d453
commit 66f38fcf33
21 changed files with 296 additions and 146 deletions

44
.vscode/tasks.json vendored
View File

@ -1,6 +1,50 @@
{
"version": "2.0.0",
"options": {
"env": {
"serverUserSecretsId": "6501aa0f-8499-4be5-96a9-e99b11323eeb"
}
},
"tasks": [
{
"label": "userSecretsInit",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsSet",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"set",
"asdf",
"123"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsMkLink",
"command": "cmd",
"type": "shell",
"args": [
"/c",
"mklink",
"/J",
".vscode\\UserSecrets",
"${userHome}\\AppData\\Roaming\\Microsoft\\UserSecrets\\$env:serverUserSecretsId"
],
"problemMatcher": "$msCompile"
},
{
"label": "buildServer",
"command": "dotnet",

View File

@ -29,8 +29,8 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.6.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="jQuery" Version="3.6.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />

View File

@ -15,7 +15,7 @@ public class PagesController : Controller
public PagesController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
{
_AppSettings=appSettings;
_AppSettings = appSettings;
_MetrologyRepository = metrologyRepository;
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
}

View File

@ -27,15 +27,15 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.6.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.3" />
<PackageReference Include="jQuery" Version="3.6.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />

View File

@ -116,9 +116,9 @@ public class InfinityQSRepository : IInfinityQSRepository
InfinityQSBase[]? results = JsonSerializer.Deserialize<InfinityQSBase[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
if (results is null)
throw new NullReferenceException(nameof(results));
if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
throw new NotSupportedException("Multiple ids are present!");
result = (from l in results orderby l.SE_TSNO, l.TD_TEST select l).First();
// if (results.Select(l => l.SE_SGRP).Distinct().Count() != 1)
// throw new NotSupportedException("Multiple ids are present!");
result = (from l in results orderby l.SE_SGRP, l.SE_TSNO, l.TD_TEST select l).First();
return result;
}
@ -177,6 +177,39 @@ public class InfinityQSRepository : IInfinityQSRepository
return result;
}
string IInfinityQSRepository.GetCommandText(InfinityQSBase infinityQSBase)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(infinityQSBase.PR_NAME))
throw new ArgumentException(nameof(infinityQSBase.PR_NAME));
if (string.IsNullOrEmpty(infinityQSBase.PD_NAME))
throw new ArgumentException(nameof(infinityQSBase.PD_NAME));
if (infinityQSBase.SE_SGTM is null)
throw new ArgumentException(nameof(infinityQSBase.SE_SGTM));
_ = result
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on ev.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on ev.f_test = td.f_test ")
.Append(" where pr.f_name = '").Append(infinityQSBase.PR_NAME).AppendLine("' ")
.Append(" and pd.f_name = '").Append(infinityQSBase.PD_NAME).AppendLine("' ")
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SE_SGTM).AppendLine(" ")
.AppendLine(" for json path ");
return result.ToString();
}
Result<InfinityQSEvent[]> IInfinityQSRepository.GetEvents(string subGroupId)
{
Result<InfinityQSEvent[]>? result;
@ -196,7 +229,7 @@ public class InfinityQSRepository : IInfinityQSRepository
results = Array.Empty<InfinityQSEvent>();
else
{
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.PR_NAME}' and ev.f_part = '{infinityQSBase.PD_NAME}' and ev.f_sgtm = {infinityQSBase.SE_SGTM} ";
string commandText = infinityQSRepository.GetCommandText(infinityQSBase);
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
results = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
if (results is null)

View File

@ -26,7 +26,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
{
StringBuilder result = new();
if (string.IsNullOrEmpty(subGroupId))
throw new ArgumentException(nameof(subGroupId));
throw new ArgumentException(null, nameof(subGroupId));
_ = result
.AppendLine(" select ")
.AppendLine(" sd.f_sgrp sd_sgrp, ")
@ -50,7 +50,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
StringBuilder result = new();
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
throw new ArgumentException(nameof(dateTime));
throw new ArgumentException(null, nameof(dateTime));
_ = result
.AppendLine(" select ")
.AppendLine(" se.f_sgrp se_sgrp, ")
@ -117,9 +117,9 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
if (collection is null)
throw new NullReferenceException(nameof(collection));
InfinityQSBaseV2[] results = InfinityQSBase.Convert(collection);
if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
throw new NotSupportedException("Multiple ids are present!");
result = (from l in results orderby l.SiteNumber, l.VariableNumber select l).First();
// if (results.Select(l => l.SubGroupId).Distinct().Count() != 1)
// throw new NotSupportedException("Multiple ids are present!");
result = (from l in results orderby l.SubGroupId, l.SiteNumber, l.VariableNumber select l).First();
return result;
}
@ -180,6 +180,39 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
return result;
}
string IInfinityQSV2Repository.GetCommandText(InfinityQSBaseV2 infinityQSBase)
{
StringBuilder result = new();
if (string.IsNullOrEmpty(infinityQSBase.Process))
throw new ArgumentException(nameof(infinityQSBase.Process));
if (string.IsNullOrEmpty(infinityQSBase.Part))
throw new ArgumentException(nameof(infinityQSBase.Part));
if (infinityQSBase.SubGroupDateTime is null)
throw new ArgumentException(nameof(infinityQSBase.SubGroupDateTime));
_ = result
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
.AppendLine(" on ev.f_part = pd.f_part ")
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
.AppendLine(" on ev.f_test = td.f_test ")
.Append(" where pr.f_name = '").Append(infinityQSBase.Process).AppendLine("' ")
.Append(" and pd.f_name = '").Append(infinityQSBase.Part).AppendLine("' ")
.Append(" and ev.f_sgtm = ").Append(infinityQSBase.SubGroupDateTime).AppendLine(" ")
.AppendLine(" for json path ");
return result.ToString();
}
Result<InfinityQSEventV2[]> IInfinityQSV2Repository.GetEvents(string subGroupId)
{
Result<InfinityQSEventV2[]>? result;
@ -199,7 +232,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
collection = Array.Empty<InfinityQSEvent>();
else
{
string commandText = $"select * from [spcepiworld].[dbo].[evnt_inf] ev where ev.f_prcs = '{infinityQSBase.Process}' and ev.f_part = '{infinityQSBase.Part}' and ev.f_sgtm = {infinityQSBase.SubGroupDateTime} ";
string commandText = infinityQSV2Repository.GetCommandText(infinityQSBase);
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
collection = JsonSerializer.Deserialize<InfinityQSEvent[]>(stringBuilder.ToString(), new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
if (collection is null)

View File

@ -1,27 +1,13 @@
namespace OI.Metrology.Shared.DataModels;
public record InfinityQSEvent(int F_EVNT,
int F_CRTM,
int F_EDTM,
int F_TYPE,
string F_NAME,
int F_EMPL,
int F_EVTM,
int F_PRCS,
int F_PART,
int F_TEST,
int F_SGTM,
int F_ACC,
int F_ACEM,
int F_ACTM,
int F_CAC,
int F_CAEM,
int F_CATM,
int F_FLAG,
int F_USER,
int F_DSBL,
int F_RFC,
int F_TRTM)
public record InfinityQSEvent(int EV_EVNT,
int EV_SGTM,
string EV_UTC7,
string PR_NAME,
string PD_NAME,
int TD_TEST,
string TD_NAME,
string EV_NAME)
{
public static InfinityQSEventV2[] Convert(InfinityQSEvent[] collection)
@ -34,53 +20,25 @@ public record InfinityQSEvent(int F_EVNT,
public static InfinityQSEventV2 Map(InfinityQSEvent item)
{
InfinityQSEventV2 result = new(item.F_EVNT,
item.F_CRTM,
item.F_EDTM,
item.F_TYPE,
item.F_NAME,
item.F_EMPL,
item.F_EVTM,
item.F_PRCS,
item.F_PART,
item.F_TEST,
item.F_SGTM,
item.F_ACC,
item.F_ACEM,
item.F_ACTM,
item.F_CAC,
item.F_CAEM,
item.F_CATM,
item.F_FLAG,
item.F_USER,
item.F_DSBL,
item.F_RFC,
item.F_TRTM);
InfinityQSEventV2 result = new(item.EV_EVNT,
item.EV_SGTM,
item.EV_UTC7,
item.PR_NAME,
item.PD_NAME,
item.TD_TEST,
item.TD_NAME,
item.EV_NAME);
return result;
}
}
public record InfinityQSEventV2(int Evnt,
int Crtm,
int Edtm,
int Type,
string Name,
int Empl,
int Evtm,
int Prcs,
int Part,
int Test,
int Sgtm,
int Acc,
int Acem,
int Actm,
int Cac,
int Caem,
int Catm,
int Flag,
int User,
int Dsbl,
int Rfc,
int Trtm)
public record InfinityQSEventV2(int EventId,
int SubGroupDateTimeId,
string SubGroupDateTime,
string Process,
string Part,
int VariableNumber,
string Variable,
string Name)
{ }

View File

@ -24,7 +24,7 @@ public class Pinned : HeaderCommon
ToolTypeName = headerCommon.ToolTypeName;
MesEntity = headerCommon.MesEntity;
Employee = headerCommon.Employee;
Layer = headerCommon.Layer;
PSN = headerCommon.PSN;

View File

@ -6,6 +6,7 @@ public interface IInfinityQSRepository
{
string GetCommandText(string subGroupId);
string GetCommandText(InfinityQSBase infinityQSBase);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
Result<InfinityQSBase[]> GetData(string subGroupId);
Result<InfinityQSDescriptor[]> GetDescriptors(string subGroupId);

View File

@ -6,6 +6,7 @@ public interface IInfinityQSV2Repository
{
string GetCommandText(string subGroupId);
string GetCommandText(InfinityQSBaseV2 infinityQSBase);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
Result<InfinityQSBaseV2[]> GetData(string subGroupId);
Result<InfinityQSDescriptorV2[]> GetDescriptors(string subGroupId);

View File

@ -31,7 +31,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -32,7 +32,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />

View File

@ -54,7 +54,7 @@ public class UnitAwaitingDispoController
public async Task IndexApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
_Logger.Information($"{_TestContext?.TestName} completed");

View File

@ -29,12 +29,20 @@ public class UnitTestAppSettingsController
_ControllerName = nameof(Server.ApiControllers.AppSettingsController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IAppSettingsController<object>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -45,6 +53,7 @@ public class UnitTestAppSettingsController
IAppSettingsRepository<Server.Models.Binder.AppSettings> appSettingsRepository = serviceProvider.GetRequiredService<IAppSettingsRepository<Server.Models.Binder.AppSettings>>();
appSettingsRepository.VerifyConnectionStrings();
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -55,6 +64,7 @@ public class UnitTestAppSettingsController
AppSettings appSettings = serviceProvider.GetRequiredService<AppSettings>();
Assert.IsNotNull(appSettings);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -66,6 +76,7 @@ public class UnitTestAppSettingsController
Server.Models.Binder.AppSettings appSettings = appSettingsRepository.GetAppSettings();
Assert.IsTrue(appSettings is not null);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -82,6 +93,7 @@ public class UnitTestAppSettingsController
Assert.IsNotNull(json);
Assert.IsTrue(json != "[]");
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -93,6 +105,7 @@ public class UnitTestAppSettingsController
string result = appSettingsRepository.GetBuildNumberAndGitCommitSeven();
Assert.IsTrue(result is not null);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -108,6 +121,7 @@ public class UnitTestAppSettingsController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetBuildNumberAndGitCommitSeven)}.json"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -54,8 +54,8 @@ public class UnitTestClientSettingsController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string actionName = nameof(IClientSettingsController<object>.Action.Client);
#if DEBUG
string actionName = nameof(IClientSettingsController<object>.Action.Client);
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}/{actionName}");
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());

View File

@ -29,12 +29,20 @@ public class UnitTestExportController
_ControllerName = nameof(Server.ApiControllers.ExportController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IExportController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
private static HeaderCommon GetHeaderCommon() =>
@ -52,6 +60,7 @@ public class UnitTestExportController
string result = exportRepository.GetExport(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -63,6 +72,7 @@ public class UnitTestExportController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetExport)}.txt"), result);
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -73,6 +83,7 @@ public class UnitTestExportController
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/export", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -84,6 +95,7 @@ public class UnitTestExportController
Result<HeaderCommon[]> result = exportRepository.GetHeaders(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -96,6 +108,7 @@ public class UnitTestExportController
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -106,6 +119,7 @@ public class UnitTestExportController
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/headers", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -117,6 +131,7 @@ public class UnitTestExportController
Result<HeaderCommon[]> result = exportRepository.GetLogistics(GetHeaderCommon());
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -129,6 +144,7 @@ public class UnitTestExportController
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -139,6 +155,7 @@ public class UnitTestExportController
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/logistics", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -150,6 +167,7 @@ public class UnitTestExportController
string result = exportRepository.GetProcessDataStandardFormat(GetHeaderCommon());
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -161,6 +179,7 @@ public class UnitTestExportController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetProcessDataStandardFormat)}.pdsf"), result);
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
[TestMethod]
@ -171,6 +190,7 @@ public class UnitTestExportController
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync($"api/{_ControllerName}/processDataStandardFormat", GetStringContent());
Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.OK);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -28,15 +28,23 @@ public class UnitTestInfinityQSController
_ControllerName = nameof(Server.ApiControllers.InfinityQSController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSController<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -48,9 +56,10 @@ public class UnitTestInfinityQSController
string result = infinityQSRepository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -62,9 +71,10 @@ public class UnitTestInfinityQSController
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -82,9 +92,10 @@ public class UnitTestInfinityQSController
Assert.IsNotNull(result?.Results[0].TD_NAME);
Assert.IsNotNull(result?.Results[0].TD_TEST);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -98,9 +109,10 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -115,9 +127,10 @@ public class UnitTestInfinityQSController
Assert.IsNotNull(result?.Results[0].SD_SGRP);
Assert.IsNotNull(result?.Results[0].SD_TSNO);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -131,9 +144,10 @@ public class UnitTestInfinityQSController
Result<InfinityQSDescriptor[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptor[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -145,9 +159,10 @@ public class UnitTestInfinityQSController
Result<InfinityQSEvent[]> result = infinityQSRepository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -160,9 +175,10 @@ public class UnitTestInfinityQSController
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -174,9 +190,10 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]> result = infinityQSRepository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -189,6 +206,7 @@ public class UnitTestInfinityQSController
Result<InfinityQSBase[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBase[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -28,17 +28,22 @@ public class UnitTestInfinityQSV2Controller
_ControllerName = nameof(Server.ApiControllers.InfinityQSV2Controller)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger.Information("Starting Web Application");
Assert.AreEqual(IInfinityQSV2Controller<string>.GetRouteName(), _ControllerName);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
[Ignore]
#endif
[TestMethod]
public void GetCommandText()
{
@ -48,9 +53,10 @@ public class UnitTestInfinityQSV2Controller
string result = infinityQSV2Repository.GetCommandText("1677273357", "61", "CDE5", "5012", "575908", "");
Assert.IsNotNull(result);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -62,9 +68,10 @@ public class UnitTestInfinityQSV2Controller
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetCommandText)}.sql"), json);
Assert.IsNotNull(json);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -82,9 +89,10 @@ public class UnitTestInfinityQSV2Controller
Assert.IsNotNull(result?.Results[0].VariableNumber);
Assert.IsNotNull(result?.Results[0].SubGroupDateTime);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -98,9 +106,10 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -115,9 +124,10 @@ public class UnitTestInfinityQSV2Controller
Assert.IsNotNull(result?.Results[0].SubGroupId);
Assert.IsNotNull(result?.Results[0].SiteNumber);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -131,9 +141,10 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSDescriptorV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSDescriptorV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -145,9 +156,10 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSEventV2[]> result = infinityQSV2Repository.GetEvents("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -160,9 +172,10 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSEvent[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSEvent[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -174,9 +187,10 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]> result = infinityQSV2Repository.GetHeader("1677273357");
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
#if true
#if !DEBUG
[Ignore]
#endif
[TestMethod]
@ -189,6 +203,7 @@ public class UnitTestInfinityQSV2Controller
Result<InfinityQSBaseV2[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<InfinityQSBaseV2[]>>(json);
Assert.IsNotNull(result?.Results);
_Logger.Information($"{_TestContext?.TestName} completed");
NonThrowTryCatch();
}
}

View File

@ -8,14 +8,14 @@
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MudBlazor" Version="6.1.9" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.3" />
<PackageReference Include="MudBlazor" Version="6.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.4" />
<PackageReference Include="IgniteUI.Blazor" Version="22.2.24" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
<PackageReference Include="Serilog.Sinks.BrowserHttp" Version="1.0.0-dev-00032" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />

View File

@ -43,7 +43,7 @@ steps:
set configuration=Debug
echo %configuration%
echo ##vso[task.setvariable variable=Configuration;]%configuration%
echo ($Configuration)
echo $(Configuration)
displayName: Configuration
- script: |
@ -61,16 +61,32 @@ steps:
echo $(GitCommitSeven)
displayName: GitCommitSeven
- script: |
set uuId=A6302662940458499454E35D28FCC9F7
echo %uuId%
echo ##vso[task.setvariable variable=UUId;]%uuId%
echo $(UUId)
displayName: UUId
- script: |
set pwEncoding=AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAtBhT01pNnUGaN/uPLxZGvAAAAAACAAAAAAADZgAAwAAAABAAAAAM4xlYguhv7jzchU8dq9pVAAAAAASAAACgAAAAEAAAANS9rIoaYfNq5TwCmTrqElsgAAAA7O4J52FqCctXlCxYB2J5b/W4T+pZCN2zwFj7XCAFW6IUAAAAhQsBDOERAUZJdtSy8AfxwOAZflo=
echo %pwEncoding%
echo ##vso[task.setvariable variable=PwEncoding;]%pwEncoding%
echo $(PwEncoding)
displayName: PwEncoding
- script: |
echo $(Build.BuildId)
echo $(Build.Reason)
echo $(Build.Repository.Id)
echo $(Build.Repository.Name)
echo $(Build.SourceVersion)
echo $(CoreVersion)
echo $(Configuration)
echo $(NugetSource)
echo $(CoreVersion)
echo $(GitCommitSeven)
echo $(NugetSource)
echo $(PwEncoding)
echo $(UUId)
REM echo $(pipelinePassword)
displayName: "Echo Check"
@ -132,6 +148,14 @@ steps:
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: PublishTestResults@2
displayName: "Publish Test Results **/coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
@ -141,16 +165,10 @@ steps:
assignedTo: "$(Build.RequestedForId)"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Server --source $(NugetSource)'
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o "D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server" --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Publish"
- task: CopyFiles@2
displayName: "Copy Files"
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)\Server'
TargetFolder: 'D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server'
- script: 'sc stop "$(Build.Repository.Name)-$(Configuration)"'
workingDirectory: Server
displayName: "Service Control - Stop"
@ -171,10 +189,10 @@ steps:
displayName: "Echo Path"
- powershell: |
$data = @('$(downloadSecureFileKDBX.secureFilePath)', '-c:GetEntryString', '-Field:Password', '-refx-UUID:A6302662940458499454E35D28FCC9F7', '-pw-enc:AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAtBhT01pNnUGaN/uPLxZGvAAAAAACAAAAAAADZgAAwAAAABAAAAAM4xlYguhv7jzchU8dq9pVAAAAAASAAACgAAAAEAAAANS9rIoaYfNq5TwCmTrqElsgAAAA7O4J52FqCctXlCxYB2J5b/W4T+pZCN2zwFj7XCAFW6IUAAAAhQsBDOERAUZJdtSy8AfxwOAZflo=')
$data = @('$(downloadSecureFileKDBX.secureFilePath)', '-c:GetEntryString', '-Field:Password', '-refx-UUID:$(UUId)', '-pw-enc:$(PwEncoding)')
$data.count
$processStartInfo = New-Object System.Diagnostics.ProcessStartInfo
$processStartInfo.FileName = "C:\Users\meseafsvc\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe"
$processStartInfo.FileName = "C:\Users\$(USERNAME)\AppData\Local\IFXApps\KeePass-2.51.1---KPScript-2.51.1\KPScript.exe"
$processStartInfo.RedirectStandardError = $true
$processStartInfo.RedirectStandardOutput = $true
$processStartInfo.UseShellExecute = $false
@ -190,7 +208,7 @@ steps:
Write-Host "##vso[task.setvariable variable=pipelinePassword;]$stdout"
displayName: pipelinePassword
- script: 'sc create "$(Build.Repository.Name)-$(Configuration)" start= delayed-auto DisplayName= "$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" binPath= D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server\$(ExeName).exe obj= INFINEON\meseafsvc password="$(pipelinePassword)"'
- script: 'sc create "$(Build.Repository.Name)-$(Configuration)" start= delayed-auto DisplayName= "$(Build.Repository.Name)-$(Configuration)-$(GitCommitSeven)-$(Build.BuildId)" binPath= D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server\$(ExeName).exe obj= INFINEON\$(USERNAME) password="$(pipelinePassword)"'
workingDirectory: Server
displayName: "Service Control - Create"
@ -210,10 +228,5 @@ steps:
workingDirectory: Server
displayName: "Core Clean - Server"
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
workingDirectory: Server
displayName: "Core Clean - Server"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\Debug\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
workingDirectory: "EAF Viewer"
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
displayName: "Force Fail"

View File

@ -21,8 +21,8 @@ pool:
variables:
# solution: '**/*.sln'
# buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
ASPNETCORE_ENVIRONMENT: 'Production'
buildConfiguration: "Release"
ASPNETCORE_ENVIRONMENT: "Production"
steps:
- script: |
@ -82,10 +82,10 @@ steps:
- script: '"C:\program files\dotnet\dotnet.exe" build --configuration $(Configuration) --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Build - Server"
- powershell: Get-ChildItem .\ -include TestResults -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
workingDirectory: "$(System.DefaultWorkingDirectory)/.vscode"
displayName: 'PowerShell Script'
displayName: "PowerShell Script"
- script: "dotnet test --configuration $(Configuration)"
workingDirectory: Tests
@ -110,6 +110,14 @@ steps:
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: PublishTestResults@2
displayName: "Publish Test Results **/coverage.cobertura.xml"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/coverage.cobertura.xml"
testRunTitle: "$(GitCommitSeven)-$(Build.BuildId)-$(CoreVersion)-$(Configuration)-$(Build.Repository.Name)"
searchFolder: "$(System.DefaultWorkingDirectory)/.vscode"
- task: mspremier.CreateWorkItem.CreateWorkItem-task.CreateWorkItem@1
displayName: "Create work item"
inputs:
@ -119,26 +127,18 @@ steps:
assignedTo: "$(Build.RequestedForId)"
enabled: false
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o $(Build.ArtifactStagingDirectory)\Server --source $(NugetSource)'
- script: '"C:\program files\dotnet\dotnet.exe" publish --configuration $(Configuration) --runtime win-x64 --self-contained -o "D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server" --source $(NugetSource)'
workingDirectory: Server
displayName: "Core Publish"
- task: CopyFiles@2
displayName: "Copy Files"
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)\Server'
TargetFolder: 'D:\$(CoreVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)\Server'
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: drop"
enabled: false
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
workingDirectory: Tests
displayName: "Core Clean - Tests"
- script: |
"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)
- script: '"C:\program files\dotnet\dotnet.exe" clean --configuration $(Configuration)'
workingDirectory: Server
displayName: "Core Clean - Server"