Mock json files
This commit is contained in:
parent
c292328abe
commit
4185d159c4
@ -29,20 +29,6 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
protected DbProviderFactory GetDbProviderFactory(IDbConnection conn) =>
|
||||
DbProviderFactories.GetFactory(conn.GetType().Namespace);
|
||||
|
||||
public bool IsTestDatabase()
|
||||
{
|
||||
int c = 0;
|
||||
using (DbConnection conn = GetDbConnection())
|
||||
{
|
||||
c = conn.Query<int>(
|
||||
"SELECT COUNT(*) " +
|
||||
"FROM Configuration " +
|
||||
"WHERE KeyName = 'TestDatabase' " +
|
||||
"AND ValueString = '1'").FirstOrDefault();
|
||||
}
|
||||
return c > 0;
|
||||
}
|
||||
|
||||
public TransactionScope StartTransaction() => new();
|
||||
|
||||
protected void CacheItem(string key, object v)
|
||||
|
1
Server/Data/Tests/GetAllServiceShopOrdersApi.json
Normal file
1
Server/Data/Tests/GetAllServiceShopOrdersApi.json
Normal file
File diff suppressed because one or more lines are too long
1
Server/Data/Tests/GetAppSettingsApi.json
Normal file
1
Server/Data/Tests/GetAppSettingsApi.json
Normal file
@ -0,0 +1 @@
|
||||
["application/json","/api/inbound","D:\\Metrology\\MetrologyAPILogs","\\\\messv02ecc1.ec.local\\EC_Metrology_Si\\MetrologyAttachments","1","Infineon Technologies Americas Corp.","Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;","1234567","","True","False","OI_Metrology_Viewer_IFX","auc","Data Source=MESSAD1001\\TEST1,59583;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;","\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data","https://localhost:7130;http://localhost:5126","IFXApps"]
|
@ -0,0 +1 @@
|
||||
1-1234567
|
1
Server/Data/Tests/GetClientSettingsApi.json
Normal file
1
Server/Data/Tests/GetClientSettingsApi.json
Normal file
@ -0,0 +1 @@
|
||||
["remoteIpAddress"]
|
1
Server/Data/Tests/GetDataApi.json
Normal file
1
Server/Data/Tests/GetDataApi.json
Normal file
File diff suppressed because one or more lines are too long
89
Server/Data/Tests/GetHeaderFieldsApi.json
Normal file
89
Server/Data/Tests/GetHeaderFieldsApi.json
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"Column": "ID",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Column": "InsertDate",
|
||||
"Value": "9/12/2019 4:02:17 PM"
|
||||
},
|
||||
{
|
||||
"Column": "Title",
|
||||
"Value": "Bio-RadQS400MEPI_99-999999-9999.1_201909121559040648"
|
||||
},
|
||||
{
|
||||
"Column": "Recipe",
|
||||
"Value": "6in_thick"
|
||||
},
|
||||
{
|
||||
"Column": "Date",
|
||||
"Value": "9/12/2019 3:59:05 PM"
|
||||
},
|
||||
{
|
||||
"Column": "Operator",
|
||||
"Value": ""
|
||||
},
|
||||
{
|
||||
"Column": "Batch",
|
||||
"Value": "BIORAD #4"
|
||||
},
|
||||
{
|
||||
"Column": "Cassette",
|
||||
"Value": ""
|
||||
},
|
||||
{
|
||||
"Column": "Wafer",
|
||||
"Value": "99-999999-9999.1"
|
||||
},
|
||||
{
|
||||
"Column": "Mean Thickness",
|
||||
"Value": "114.785"
|
||||
},
|
||||
{
|
||||
"Column": "RV Thickness",
|
||||
"Value": "0.0000"
|
||||
},
|
||||
{
|
||||
"Column": "Status",
|
||||
"Value": "PASS"
|
||||
},
|
||||
{
|
||||
"Column": "Std Dev",
|
||||
"Value": "1.1047"
|
||||
},
|
||||
{
|
||||
"Column": "SentToMetrology",
|
||||
"Value": "True"
|
||||
},
|
||||
{
|
||||
"Column": "SentToSPC",
|
||||
"Value": "False"
|
||||
},
|
||||
{
|
||||
"Column": "Reactor",
|
||||
"Value": "99"
|
||||
},
|
||||
{
|
||||
"Column": "RDS",
|
||||
"Value": "999999"
|
||||
},
|
||||
{
|
||||
"Column": "PSN",
|
||||
"Value": "9999"
|
||||
},
|
||||
{
|
||||
"Column": "Path",
|
||||
"Value": ""
|
||||
},
|
||||
{
|
||||
"Column": "Layer",
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"Column": "Zone",
|
||||
"Value": ""
|
||||
}
|
||||
],
|
||||
"TotalRows": 21
|
||||
}
|
21
Server/Data/Tests/GetHeaderTitlesApi.json
Normal file
21
Server/Data/Tests/GetHeaderTitlesApi.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"ID": 2,
|
||||
"InsertDate": "2019-09-12T16:24:18.617",
|
||||
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||
"Title": "Bio-RadQS400MEPI_99-999999-9999.1_201909121623333616",
|
||||
"Recipe": null,
|
||||
"Date": "2019-09-12T16:23:43"
|
||||
},
|
||||
{
|
||||
"ID": 1,
|
||||
"InsertDate": "2019-09-12T16:02:17.253",
|
||||
"AttachmentID": "00000000-0000-0000-0000-000000000000",
|
||||
"Title": "Bio-RadQS400MEPI_99-999999-9999.1_201909121559040648",
|
||||
"Recipe": null,
|
||||
"Date": "2019-09-12T15:59:05"
|
||||
}
|
||||
],
|
||||
"TotalRows": 2
|
||||
}
|
1
Server/Data/Tests/GetHeadersApi.json
Normal file
1
Server/Data/Tests/GetHeadersApi.json
Normal file
@ -0,0 +1 @@
|
||||
{"Results":[{"Batch":"BIORAD #4","Cassette":"","Date":"2019-09-12T16:23:43","ID":2,"InsertDate":"2019-09-12T16:24:18.617","Layer":"1","Mean Thickness":"114.785","Operator":"","Path":null,"PSN":"9999","RDS":"999999","Reactor":"99","Recipe":"6in_thick","RV Thickness":"0.0000","SentToMetrology":false,"SentToSPC":false,"Status":"PASS","Std Dev":"1.1047","Title":"Bio-RadQS400MEPI_99-999999-9999.1_201909121623333616","Wafer":"99-999999-9999.1","Zone":null,"AttachmentID":null},{"Batch":"BIORAD #4","Cassette":"","Date":"2019-09-12T15:59:05","ID":1,"InsertDate":"2019-09-12T16:02:17.253","Layer":"1","Mean Thickness":"114.785","Operator":"","Path":null,"PSN":"9999","RDS":"999999","Reactor":"99","Recipe":"6in_thick","RV Thickness":"0.0000","SentToMetrology":true,"SentToSPC":false,"Status":"PASS","Std Dev":"1.1047","Title":"Bio-RadQS400MEPI_99-999999-9999.1_201909121559040648","Wafer":"99-999999-9999.1","Zone":null,"AttachmentID":null}],"TotalRows":2}
|
0
Server/Data/Tests/GetIpAddressApi.json
Normal file
0
Server/Data/Tests/GetIpAddressApi.json
Normal file
334
Server/Data/Tests/GetToolTypeMetadataApi.json
Normal file
334
Server/Data/Tests/GetToolTypeMetadataApi.json
Normal file
@ -0,0 +1,334 @@
|
||||
{
|
||||
"Results": {
|
||||
"ToolType": {
|
||||
"ID": 1,
|
||||
"ToolTypeName": "BioRad",
|
||||
"HasHeaderAttachments": false,
|
||||
"HasDataAttachments": false,
|
||||
"HeaderTableName": "BioRadRunHeader",
|
||||
"DataTableName": "BioRadRunData",
|
||||
"ExportSPName": "Export_BioRad",
|
||||
"HeaderGridAttributes": null,
|
||||
"DataGridAttributes": null,
|
||||
"DataGridSortBy": "LEN(Position), Position",
|
||||
"DataGridStatsColumn": "Thickness",
|
||||
"DataGridStatsStdDevType": " ",
|
||||
"DisplayHeaderAttachment": null,
|
||||
"DisplayDataAttachment": null,
|
||||
"OIExportSPName": "OIExport_BioRad"
|
||||
},
|
||||
"Metadata": [
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": null,
|
||||
"ColumnName": "ID",
|
||||
"DisplayTitle": "ID",
|
||||
"GridDisplayOrder": 3,
|
||||
"GridAttributes": "{ \u0022dataType\u0022: \u0022number\u0022, \u0022hidden\u0022: \u0022true\u0022 }",
|
||||
"TableDisplayOrder": 1
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": null,
|
||||
"ColumnName": "InsertDate",
|
||||
"DisplayTitle": "InsertDate",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 2
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": "Position",
|
||||
"ColumnName": "Position",
|
||||
"DisplayTitle": "Position",
|
||||
"GridDisplayOrder": 1,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 4
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": "HeaderUniqueId",
|
||||
"ColumnName": "Run Header",
|
||||
"DisplayTitle": "Run Header",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 6
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": "Thickness",
|
||||
"ColumnName": "Thickness",
|
||||
"DisplayTitle": "Thickness",
|
||||
"GridDisplayOrder": 2,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 5
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": "UniqueId",
|
||||
"ColumnName": "Title",
|
||||
"DisplayTitle": "Title",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 3
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Batch",
|
||||
"ColumnName": "Batch",
|
||||
"DisplayTitle": "Batch",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 7
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Cassette",
|
||||
"ColumnName": "Cassette",
|
||||
"DisplayTitle": "Cassette",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 8
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Date",
|
||||
"ColumnName": "Date",
|
||||
"DisplayTitle": "Date",
|
||||
"GridDisplayOrder": 1,
|
||||
"GridAttributes": "{ \u0022dataType\u0022: \u0022date\u0022, \u0022format\u0022: \u0022dateTime\u0022 }",
|
||||
"TableDisplayOrder": 5
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": null,
|
||||
"ColumnName": "ID",
|
||||
"DisplayTitle": "ID",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 1
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": null,
|
||||
"ColumnName": "InsertDate",
|
||||
"DisplayTitle": "InsertDate",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 2
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Layer",
|
||||
"ColumnName": "Layer",
|
||||
"DisplayTitle": "Layer",
|
||||
"GridDisplayOrder": 5,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 20
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "MeanThickness",
|
||||
"ColumnName": "Mean Thickness",
|
||||
"DisplayTitle": "Mean Thickness",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 10
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Op",
|
||||
"ColumnName": "Operator",
|
||||
"DisplayTitle": "Operator",
|
||||
"GridDisplayOrder": 8,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 6
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "FilePath",
|
||||
"ColumnName": "Path",
|
||||
"DisplayTitle": "Path",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 19
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "PSN",
|
||||
"ColumnName": "PSN",
|
||||
"DisplayTitle": "PSN",
|
||||
"GridDisplayOrder": 4,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 18
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "RDS",
|
||||
"ColumnName": "RDS",
|
||||
"DisplayTitle": "RDS",
|
||||
"GridDisplayOrder": 3,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 17
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Reactor",
|
||||
"ColumnName": "Reactor",
|
||||
"DisplayTitle": "Reactor",
|
||||
"GridDisplayOrder": 2,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 16
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Recipe",
|
||||
"ColumnName": "Recipe",
|
||||
"DisplayTitle": "Recipe",
|
||||
"GridDisplayOrder": 7,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 4
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "RVThickness",
|
||||
"ColumnName": "RV Thickness",
|
||||
"DisplayTitle": "RV Thickness",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 11
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "SentToMetrology",
|
||||
"ColumnName": "SentToMetrology",
|
||||
"DisplayTitle": "SentToMetrology",
|
||||
"GridDisplayOrder": 9,
|
||||
"GridAttributes": "{ \u0022dataType:\u0022: \u0022bool\u0022, \u0022formatter\u0022: \u0022boolToYesNo\u0022 }",
|
||||
"TableDisplayOrder": 14
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "SentToSPC",
|
||||
"ColumnName": "SentToSPC",
|
||||
"DisplayTitle": "SentToSPC",
|
||||
"GridDisplayOrder": 10,
|
||||
"GridAttributes": "{ \u0022dataType:\u0022: \u0022bool\u0022, \u0022formatter\u0022: \u0022boolToYesNo\u0022 }",
|
||||
"TableDisplayOrder": 15
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "PassFail",
|
||||
"ColumnName": "Status",
|
||||
"DisplayTitle": "Status",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 12
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "StdDev",
|
||||
"ColumnName": "Std Dev",
|
||||
"DisplayTitle": "Std Dev",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 13
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "UniqueId",
|
||||
"ColumnName": "Title",
|
||||
"DisplayTitle": "Title",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 3
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Wafer",
|
||||
"ColumnName": "Wafer",
|
||||
"DisplayTitle": "Wafer",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 9
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Zone",
|
||||
"ColumnName": "Zone",
|
||||
"DisplayTitle": "Zone",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 21
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": false,
|
||||
"ApiName": null,
|
||||
"ColumnName": "AttachmentID",
|
||||
"DisplayTitle": "AttachmentID",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 0
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": null,
|
||||
"ColumnName": "AttachmentID",
|
||||
"DisplayTitle": "AttachmentID",
|
||||
"GridDisplayOrder": 0,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": 0
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Id",
|
||||
"ColumnName": null,
|
||||
"DisplayTitle": "Ignore",
|
||||
"GridDisplayOrder": -1,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": -1
|
||||
},
|
||||
{
|
||||
"ToolTypeID": 1,
|
||||
"Header": true,
|
||||
"ApiName": "Title",
|
||||
"ColumnName": null,
|
||||
"DisplayTitle": "Ignore",
|
||||
"GridDisplayOrder": -1,
|
||||
"GridAttributes": null,
|
||||
"TableDisplayOrder": -1
|
||||
}
|
||||
]
|
||||
},
|
||||
"TotalRows": 31
|
||||
}
|
29
Server/Data/Tests/IndexApi.json
Normal file
29
Server/Data/Tests/IndexApi.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"Results": [
|
||||
{
|
||||
"ToolTypeName": "BioRad",
|
||||
"ID": 1
|
||||
},
|
||||
{
|
||||
"ToolTypeName": "CDE",
|
||||
"ID": 2
|
||||
},
|
||||
{
|
||||
"ToolTypeName": "Tencor",
|
||||
"ID": 3
|
||||
},
|
||||
{
|
||||
"ToolTypeName": "MercuryProbe",
|
||||
"ID": 4
|
||||
},
|
||||
{
|
||||
"ToolTypeName": "StratusBioRad",
|
||||
"ID": 5
|
||||
},
|
||||
{
|
||||
"ToolTypeName": "TencorSP1",
|
||||
"ID": 6
|
||||
}
|
||||
],
|
||||
"TotalRows": 6
|
||||
}
|
@ -13,6 +13,7 @@ public record AppSettings(string ApiLoggingContentTypes,
|
||||
string InboundApiAllowedIPList,
|
||||
bool IsDevelopment,
|
||||
bool IsStaging,
|
||||
string MockRoot,
|
||||
string MonAResource,
|
||||
string MonASite,
|
||||
string OI2SqlConnectionString,
|
||||
|
@ -19,6 +19,7 @@ public class AppSettings
|
||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||
[Display(Name = "Is Development"), Required] public bool? IsDevelopment { get; set; }
|
||||
[Display(Name = "Is Staging"), Required] public bool? IsStaging { get; set; }
|
||||
[Display(Name = "Mock Root"), Required] public string MockRoot { get; set; }
|
||||
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||
[Display(Name = "Oi 2 Sql Connection String"), Required] public string Oi2SqlConnectionString { get; set; }
|
||||
@ -61,6 +62,8 @@ public class AppSettings
|
||||
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)
|
||||
@ -85,6 +88,7 @@ public class AppSettings
|
||||
appSettings.InboundApiAllowedIPList,
|
||||
appSettings.IsDevelopment.Value,
|
||||
appSettings.IsStaging.Value,
|
||||
appSettings.MockRoot,
|
||||
appSettings.MonAResource,
|
||||
appSettings.MonASite,
|
||||
appSettings.Oi2SqlConnectionString,
|
||||
|
@ -64,5 +64,38 @@
|
||||
<None Include="Data\Mike\service-shop.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetAllServiceShopOrdersApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetDataApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetHeaderFieldsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetHeadersApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetHeaderTitlesApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetAppSettingsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\IndexApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetClientSettingsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetBuildNumberAndGitCommitSevenApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetIpAddressApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -69,11 +69,11 @@ public class Program
|
||||
|
||||
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository>(_ => appSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
||||
|
||||
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
|
||||
_ = webApplicationBuilder.Services.AddScoped<IInboundDataService, InboundDataService>();
|
||||
|
@ -28,20 +28,6 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
protected DbProviderFactory GetDbProviderFactory(IDbConnection conn) =>
|
||||
DbProviderFactories.GetFactory(conn.GetType().Namespace);
|
||||
|
||||
public bool IsTestDatabase()
|
||||
{
|
||||
int c = 0;
|
||||
using (DbConnection conn = GetDbConnection())
|
||||
{
|
||||
c = conn.Query<int>(
|
||||
"SELECT COUNT(*) " +
|
||||
"FROM Configuration " +
|
||||
"WHERE KeyName = 'TestDatabase' " +
|
||||
"AND ValueString = '1'").FirstOrDefault();
|
||||
}
|
||||
return c > 0;
|
||||
}
|
||||
|
||||
public TransactionScope StartTransaction() => new();
|
||||
|
||||
protected void CacheItem(string key, object v)
|
||||
|
@ -2,25 +2,42 @@ using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Services;
|
||||
using System.Data;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace OI.Metrology.Server.Repository;
|
||||
|
||||
public class ToolTypesRepository : IToolTypesRepository
|
||||
{
|
||||
|
||||
private readonly string _MockRoot;
|
||||
private readonly Serilog.ILogger _Log;
|
||||
|
||||
public ToolTypesRepository() => _Log = Serilog.Log.ForContext<ToolTypesRepository>();
|
||||
public ToolTypesRepository(string mockRoot)
|
||||
{
|
||||
_MockRoot = mockRoot;
|
||||
_Log = Serilog.Log.ForContext<ToolTypesRepository>();
|
||||
}
|
||||
|
||||
// Get a list of tooltypes, returns just Name and ID
|
||||
Result<ToolTypeNameId[]> IToolTypesRepository.Index(IMetrologyRepository metrologyRepository)
|
||||
{
|
||||
ToolTypeNameId[] toolTypeNameIdCollection = metrologyRepository.GetToolTypes().Select(tt => new ToolTypeNameId() { ToolTypeName = tt.ToolTypeName, ID = tt.ID }).ToArray();
|
||||
Result<ToolTypeNameId[]> r = new()
|
||||
Result<ToolTypeNameId[]>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = toolTypeNameIdCollection,
|
||||
TotalRows = toolTypeNameIdCollection.Length,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "IndexApi.json"));
|
||||
r = JsonSerializer.Deserialize<Result<ToolTypeNameId[]>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolTypeNameId[] toolTypeNameIdCollection = metrologyRepository.GetToolTypes().Select(tt => new ToolTypeNameId() { ToolTypeName = tt.ToolTypeName, ID = tt.ID }).ToArray();
|
||||
r = new()
|
||||
{
|
||||
Results = toolTypeNameIdCollection,
|
||||
TotalRows = toolTypeNameIdCollection.Length,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -28,21 +45,32 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
// This is used to setup the grid displays on the UI
|
||||
Result<ToolTypeMetadataResult> IToolTypesRepository.GetToolTypeMetadata(IMetrologyRepository metrologyRepository, int id, string sortby)
|
||||
{
|
||||
ToolType tt = metrologyRepository.GetToolTypeByID(id);
|
||||
IEnumerable<ToolTypeMetadata> md = metrologyRepository.GetToolTypeMetadataByToolTypeID(id);
|
||||
|
||||
if (string.Equals(sortby, "grid", StringComparison.OrdinalIgnoreCase))
|
||||
md = md.OrderBy(f => f.GridDisplayOrder).ToList();
|
||||
if (string.Equals(sortby, "table", StringComparison.OrdinalIgnoreCase))
|
||||
md = md.OrderBy(f => f.GridDisplayOrder).ToList();
|
||||
|
||||
ToolTypeMetadataResult toolTypeMetadataResult = new(tt, md.ToArray());
|
||||
int totalRows = toolTypeMetadataResult.Metadata is not null ? toolTypeMetadataResult.Metadata.Length : 0;
|
||||
Result<ToolTypeMetadataResult> r = new()
|
||||
Result<ToolTypeMetadataResult>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = toolTypeMetadataResult,
|
||||
TotalRows = totalRows,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetToolTypeMetadataApi.json"));
|
||||
r = JsonSerializer.Deserialize<Result<ToolTypeMetadataResult>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolType tt = metrologyRepository.GetToolTypeByID(id);
|
||||
IEnumerable<ToolTypeMetadata> md = metrologyRepository.GetToolTypeMetadataByToolTypeID(id);
|
||||
|
||||
if (string.Equals(sortby, "grid", StringComparison.OrdinalIgnoreCase))
|
||||
md = md.OrderBy(f => f.GridDisplayOrder).ToList();
|
||||
if (string.Equals(sortby, "table", StringComparison.OrdinalIgnoreCase))
|
||||
md = md.OrderBy(f => f.GridDisplayOrder).ToList();
|
||||
|
||||
ToolTypeMetadataResult toolTypeMetadataResult = new(tt, md.ToArray());
|
||||
int totalRows = toolTypeMetadataResult.Metadata is not null ? toolTypeMetadataResult.Metadata.Length : 0;
|
||||
r = new()
|
||||
{
|
||||
Results = toolTypeMetadataResult,
|
||||
TotalRows = totalRows,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -50,50 +78,94 @@ public class ToolTypesRepository : IToolTypesRepository
|
||||
// The headerid parameter is used for navigating directly to a header, when the button is clicked in Awaiting Dispo
|
||||
Result<DataTable> IToolTypesRepository.GetHeaders(IMetrologyRepository metrologyRepository, int id, DateTime? datebegin, DateTime? dateend, int? page, int? pagesize, long? headerid)
|
||||
{
|
||||
long totalRecs;
|
||||
DataTable dataTable = metrologyRepository.GetHeaders(id, datebegin, dateend, page, pagesize, headerid, out totalRecs);
|
||||
Result<DataTable> r = new()
|
||||
Result<DataTable>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = dataTable,
|
||||
TotalRows = totalRecs,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetHeadersApi.json"));
|
||||
r = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
long totalRecs;
|
||||
DataTable dataTable = metrologyRepository.GetHeaders(id, datebegin, dateend, page, pagesize, headerid, out totalRecs);
|
||||
r = new()
|
||||
{
|
||||
Results = dataTable,
|
||||
TotalRows = totalRecs,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// Gets header titles, used in the Run Headers UI
|
||||
Result<HeaderCommon[]> IToolTypesRepository.GetHeaderTitles(IMetrologyRepository metrologyRepository, int id, int? page, int? pagesize)
|
||||
{
|
||||
long totalRecs;
|
||||
HeaderCommon[] headerCommonCollection = metrologyRepository.GetHeaderTitles(id, page, pagesize, out totalRecs).ToArray();
|
||||
Result<HeaderCommon[]> r = new()
|
||||
Result<HeaderCommon[]>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = headerCommonCollection,
|
||||
TotalRows = totalRecs,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetHeaderTitlesApi.json"));
|
||||
r = JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
long totalRecs;
|
||||
HeaderCommon[] headerCommonCollection = metrologyRepository.GetHeaderTitles(id, page, pagesize, out totalRecs).ToArray();
|
||||
r = new()
|
||||
{
|
||||
Results = headerCommonCollection,
|
||||
TotalRows = totalRecs,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// Get all of the fields for a header, used with the Run Header UI
|
||||
Result<ColumnValue[]> IToolTypesRepository.GetHeaderFields(IMetrologyRepository metrologyRepository, int id, long headerid)
|
||||
{
|
||||
ColumnValue[] columnValueCollection = metrologyRepository.GetHeaderFields(id, headerid).Select(x => new ColumnValue() { Column = x.Key, Value = x.Value }).ToArray();
|
||||
Result<ColumnValue[]> r = new()
|
||||
Result<ColumnValue[]>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = columnValueCollection,
|
||||
TotalRows = columnValueCollection.Length,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetHeaderFieldsApi.json"));
|
||||
r = JsonSerializer.Deserialize<Result<ColumnValue[]>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnValue[] columnValueCollection = metrologyRepository.GetHeaderFields(id, headerid).Select(x => new ColumnValue() { Column = x.Key, Value = x.Value }).ToArray();
|
||||
r = new()
|
||||
{
|
||||
Results = columnValueCollection,
|
||||
TotalRows = columnValueCollection.Length,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// Get the data for a header, used with the Run Info UI
|
||||
Result<DataTable> IToolTypesRepository.GetData(IMetrologyRepository metrologyRepository, int id, long headerid)
|
||||
{
|
||||
DataTable dataTable = metrologyRepository.GetData(id, headerid);
|
||||
Result<DataTable> r = new()
|
||||
Result<DataTable>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
Results = dataTable,
|
||||
TotalRows = dataTable.Rows.Count,
|
||||
};
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetDataApi.json"));
|
||||
r = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTable dataTable = metrologyRepository.GetData(id, headerid);
|
||||
r = new()
|
||||
{
|
||||
Results = dataTable,
|
||||
TotalRows = dataTable.Rows.Count,
|
||||
};
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"ConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Integrated Security=True;Initial Catalog=Metrology;",
|
||||
"IsDevelopment": true,
|
||||
"MockRoot": "/Data/Tests",
|
||||
"MonAResource": "OI_Metrology_Viewer_IFX",
|
||||
"Oi2SqlConnectionString": "Data Source=MESSAD1001\\TEST1,59583;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
"Serilog": {
|
||||
|
@ -19,6 +19,7 @@
|
||||
"InboundApiAllowedIPList": "",
|
||||
"IsDevelopment": false,
|
||||
"IsStaging": false,
|
||||
"MockRoot": "",
|
||||
"MonAResource": "OI_Metrology_Viewer_EC",
|
||||
"MonASite": "auc",
|
||||
"Oi2SqlConnectionString": "Data Source=messv01ec.ec.local\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;",
|
||||
|
@ -8,8 +8,6 @@ namespace OI.Metrology.Shared.Models.Stateless;
|
||||
public interface IMetrologyRepository
|
||||
{
|
||||
|
||||
bool IsTestDatabase();
|
||||
|
||||
IEnumerable<ToolType> GetToolTypes();
|
||||
ToolType GetToolTypeByName(string name);
|
||||
ToolType GetToolTypeByID(int id);
|
||||
|
@ -67,10 +67,9 @@ public class UnitTestAppSettingsController
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetAppSettingsApi)}.json"), json);
|
||||
Assert.IsNotNull(json);
|
||||
Assert.IsTrue(json != "[]");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -95,9 +94,8 @@ public class UnitTestAppSettingsController
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetBuildNumberAndGitCommitSevenApi)}.json"), json);
|
||||
Assert.IsNotNull(json);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -57,10 +57,9 @@ public class UnitTestClientSettingsController
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetClientSettingsApi)}.json"), json);
|
||||
Assert.IsNotNull(json);
|
||||
Assert.IsTrue(json != "[]");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -85,9 +84,8 @@ public class UnitTestClientSettingsController
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("text/plain; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string json = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetIpAddressApi)}.json"), json);
|
||||
Assert.IsNotNull(json);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,10 @@ public class UnitTestServiceShopOrderController
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(IServiceShopOrderController<object>.Action.All);
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/{actionName}");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetAllServiceShopOrdersApi)}.json"), json);
|
||||
ServiceShopOrder[]? serviceShopOrders = System.Text.Json.JsonSerializer.Deserialize<ServiceShopOrder[]>(json);
|
||||
Assert.IsNotNull(serviceShopOrders);
|
||||
Assert.IsTrue(serviceShopOrders.Any());
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -59,11 +59,11 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(IndexApi)}.json"), json);
|
||||
Result<ToolTypeNameId[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeNameId[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result.Results.Any());
|
||||
Assert.IsFalse(result.Results.All(l => l.ID == 0));
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -88,12 +88,12 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetToolTypeMetadataApi)}.json"), json);
|
||||
Result<ToolTypeMetadataResult>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ToolTypeMetadataResult>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result.Results.Metadata);
|
||||
Assert.IsTrue(result.Results.Metadata.Any());
|
||||
Assert.IsFalse(result.Results.Metadata.All(l => l.ToolTypeID == 0));
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -116,10 +116,10 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers");
|
||||
Result<DataTable>? result = System.Text.Json.JsonSerializer.Deserialize<Result<DataTable>>(json);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeadersApi)}.json"), json);
|
||||
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result.Results.Rows.Count > 0);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -142,10 +142,10 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headertitles");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderTitlesApi)}.json"), json);
|
||||
Result<HeaderCommon[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<HeaderCommon[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result.Results.Any());
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -168,10 +168,10 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/fields");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetHeaderFieldsApi)}.json"), json);
|
||||
Result<ColumnValue[]>? result = System.Text.Json.JsonSerializer.Deserialize<Result<ColumnValue[]>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsTrue(result.Results.Any());
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
@ -194,10 +194,10 @@ public class UnitTestToolTypesController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/headers/1/data");
|
||||
Result<DataTable>? result = System.Text.Json.JsonSerializer.Deserialize<Result<DataTable>>(json);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetDataApi)}.json"), json);
|
||||
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
|
||||
Assert.IsNotNull(result?.Results);
|
||||
Assert.IsNotNull(result.Results.Rows.Count > 0);
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_TestContext.ManagedMethod}.json"), json);
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -28,20 +28,6 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
protected DbProviderFactory GetDbProviderFactory(IDbConnection conn) =>
|
||||
DbProviderFactories.GetFactory(conn.GetType().Namespace);
|
||||
|
||||
public bool IsTestDatabase()
|
||||
{
|
||||
int c = 0;
|
||||
using (DbConnection conn = GetDbConnection())
|
||||
{
|
||||
c = conn.Query<int>(
|
||||
"SELECT COUNT(*) " +
|
||||
"FROM Configuration " +
|
||||
"WHERE KeyName = 'TestDatabase' " +
|
||||
"AND ValueString = '1'").FirstOrDefault();
|
||||
}
|
||||
return c > 0;
|
||||
}
|
||||
|
||||
public TransactionScope StartTransaction() => new();
|
||||
|
||||
protected void CacheItem(string key, object v)
|
||||
|
Loading…
x
Reference in New Issue
Block a user