This commit is contained in:
2023-01-23 18:48:43 -07:00
parent 56ec81e080
commit 662863a11e
15 changed files with 247 additions and 52 deletions

View File

@ -201,6 +201,32 @@ public class UnitTestToolTypesController
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public void GetExportData()
{
_Logger.Information("Starting Web Application");
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
IMetrologyRepository metrologyRepository = serviceProvider.GetRequiredService<IMetrologyRepository>();
IToolTypesRepository toolTypesRepository = serviceProvider.GetRequiredService<IToolTypesRepository>();
Result<DataTable> result = toolTypesRepository.GetExportData(metrologyRepository, toolTypeId: 1, datebegin: null, dateend: null);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Rows.Count > 0);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
public async Task GetExportDataApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/1/export");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(GetExportDataApi)}.json"), json);
Result<DataTable>? result = Newtonsoft.Json.JsonConvert.DeserializeObject<Result<DataTable>>(json);
Assert.IsNotNull(result?.Results);
Assert.IsNotNull(result.Results.Rows.Count > 0);
_Logger.Information($"{_TestContext?.TestName} completed");
}
[TestMethod]
[Ignore]
public void GetAttachment()