CORS, Theme, Better flow and dotnet tools - II
This commit is contained in:
parent
978e698da5
commit
85028743ed
20
Client/.vscode/launch.json
vendored
Normal file
20
Client/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach to Edge",
|
||||
"port": 9222,
|
||||
"request": "attach",
|
||||
"type": "msedge",
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"url": "http://localhost:5055/counter",
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
|
||||
},
|
||||
{
|
||||
"name": "Launch Microsoft Edge and open the Edge DevTools",
|
||||
"request": "launch",
|
||||
"type": "vscode-edge-devtools.debug",
|
||||
"url": "http://localhost:5055"
|
||||
}
|
||||
]
|
||||
}
|
41
Client/.vscode/tasks.json
vendored
Normal file
41
Client/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/Expose.MyIT.Client.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/Expose.MyIT.Client.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/Expose.MyIT.Client.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
4
Client/App.razor.cs
Normal file
4
Client/App.razor.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace Expose.MyIT.Client;
|
||||
|
||||
public partial class App
|
||||
{ }
|
@ -9,12 +9,12 @@
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="7.0.0" />
|
||||
<PackageReference Include="MudBlazor" Version="6.0.13" />
|
||||
<PackageReference Include="Microsoft.NET.Runtime.WebAssembly.Sdk" Version="7.0.1" />
|
||||
<PackageReference Include="MudBlazor" Version="6.1.7" />
|
||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00032" />
|
||||
<PackageReference Include="Serilog.Sinks.BrowserConsole" Version="1.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.BrowserHttp" Version="1.0.0-dev-00032" />
|
||||
|
@ -7,16 +7,24 @@ namespace Expose.MyIT.Client.Pages;
|
||||
public partial class FetchData
|
||||
{
|
||||
|
||||
[Inject] protected HttpClient? Http { get; set; }
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected ILogger<FetchData>? Logger { get; set; }
|
||||
|
||||
private WeatherForecast[]? _Forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Http is null)
|
||||
throw new NullReferenceException(nameof(Http));
|
||||
string controllerName = MyIT.Shared.Models.Stateless.Methods.IWeatherForecastController.GetRouteName();
|
||||
// _SsaOrders = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
_Forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>($"api/{controllerName}");
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
string controllerName = MyIT.Shared.Models.Stateless.IWeatherForecastController<object>.GetRouteName();
|
||||
try
|
||||
{ _Forecasts = await HttpClient.GetFromJsonAsync<WeatherForecast[]>($"api/{controllerName}"); }
|
||||
catch (Exception)
|
||||
{
|
||||
string json = await HttpClient.GetStringAsync($"api/{controllerName}");
|
||||
Logger.LogInformation(message: json);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Expose.MyIT.Shared.ViewModels;
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
@ -7,7 +8,8 @@ namespace Expose.MyIT.Client.Pages;
|
||||
public partial class FetchServiceShopOrders
|
||||
{
|
||||
|
||||
[Inject] protected HttpClient? Http { get; set; }
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected ILogger<FetchServiceShopOrders>? Logger { get; set; }
|
||||
|
||||
private ServiceShopOrder[]? _ServiceShopOrders;
|
||||
|
||||
@ -24,10 +26,18 @@ public partial class FetchServiceShopOrders
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Http is null)
|
||||
throw new NullReferenceException(nameof(Http));
|
||||
string controllerName = MyIT.Shared.Models.Stateless.Methods.IServiceShopOrderController.GetRouteName();
|
||||
string actionName = nameof(MyIT.Shared.Models.Stateless.Methods.ISsaOrderController.GetAllSsaOrders).Substring(3, 3);
|
||||
_ServiceShopOrders = await Http.GetFromJsonAsync<ServiceShopOrder[]>($"api/{controllerName}/{actionName}");
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
string actionName = nameof(IServiceShopOrderController<object>.Action.All);
|
||||
string controllerName = IServiceShopOrderController<object>.GetRouteName();
|
||||
try
|
||||
{ _ServiceShopOrders = await HttpClient.GetFromJsonAsync<ServiceShopOrder[]>($"api/{controllerName}/{actionName}"); }
|
||||
catch (Exception)
|
||||
{
|
||||
string json = await HttpClient.GetStringAsync($"api/{controllerName}/{actionName}");
|
||||
Logger.LogInformation(message: json);
|
||||
}
|
||||
}
|
||||
}
|
42
Client/Pages/FetchSsaOrders.razor
Normal file
42
Client/Pages/FetchSsaOrders.razor
Normal file
@ -0,0 +1,42 @@
|
||||
@page "/fetchssaorders"
|
||||
@using Expose.MyIT.Shared.ViewModels
|
||||
|
||||
<PageTitle>SSA Orders</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3" GutterBottom="true">SSA Orders</MudText>
|
||||
@if (_SsaOrders == null)
|
||||
{
|
||||
<MudProgressCircular Color="Color.Default" Indeterminate="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTable Items="_SsaOrders" Hover="true" SortLabel="Sort By" Elevation="0">
|
||||
<HeaderContent>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.Id)">Id</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.Name)">Name</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.BookingNames)">Booking Names</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.Type)">Type</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.State)">State</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.ItemNumber)">Item Number</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel InitialDirection="SortDirection.Descending" SortBy="new Func<SsaOrder, object>(x=>x.CreatedDate)">Created Date</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.DecidedDate)">Decided Date</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.Recipient)">Recipient</MudTableSortLabel></MudTh>
|
||||
<MudTh><MudTableSortLabel SortBy="new Func<SsaOrder, object>(x=>x.Requestor)">Requestor</MudTableSortLabel></MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="Id">@context.Id</MudTd>
|
||||
<MudTd DataLabel="Name">@context.Name</MudTd>
|
||||
<MudTd DataLabel="BookingNames">@string.Join(' ', context.BookingNames)</MudTd>
|
||||
<MudTd DataLabel="Type">@context.Type</MudTd>
|
||||
<MudTd DataLabel="State">@context.State</MudTd>
|
||||
<MudTd DataLabel="ItemNumber">@context.ItemNumber</MudTd>
|
||||
<MudTd DataLabel="CreatedDate">@context.CreatedDate</MudTd>
|
||||
<MudTd DataLabel="DecidedDate">@context.DecidedDate</MudTd>
|
||||
<MudTd DataLabel="Recipient">@context.Recipient</MudTd>
|
||||
<MudTd DataLabel="Requestor">@context.Requestor</MudTd>
|
||||
</RowTemplate>
|
||||
<PagerContent>
|
||||
<MudTablePager PageSizeOptions="new int[]{50, 100}" />
|
||||
</PagerContent>
|
||||
</MudTable>
|
||||
}
|
43
Client/Pages/FetchSsaOrders.razor.cs
Normal file
43
Client/Pages/FetchSsaOrders.razor.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Expose.MyIT.Shared.Models.Stateless;
|
||||
using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
namespace Expose.MyIT.Client.Pages;
|
||||
|
||||
public partial class FetchSsaOrders
|
||||
{
|
||||
|
||||
[Inject] protected HttpClient? HttpClient { get; set; }
|
||||
[Inject] protected ILogger<Counter>? Logger { get; set; }
|
||||
|
||||
private SsaOrder[]? _SsaOrders;
|
||||
|
||||
//Id
|
||||
//Name
|
||||
//BookingNames
|
||||
//Type
|
||||
//State
|
||||
//ItemNumber
|
||||
//CreatedDate
|
||||
//DecidedDate
|
||||
//Recipient
|
||||
//Requestor
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (Logger is null)
|
||||
throw new NullReferenceException(nameof(Logger));
|
||||
if (HttpClient is null)
|
||||
throw new NullReferenceException(nameof(HttpClient));
|
||||
string actionName = nameof(ISsaOrderController<object>.Action.All);
|
||||
string controllerName = ISsaOrderController<object>.GetRouteName();
|
||||
try
|
||||
{ _SsaOrders = await HttpClient.GetFromJsonAsync<SsaOrder[]>($"api/{controllerName}/{actionName}"); }
|
||||
catch (Exception)
|
||||
{
|
||||
string json = await HttpClient.GetStringAsync($"api/{controllerName}/{actionName}");
|
||||
Logger.LogInformation(message: json);
|
||||
}
|
||||
}
|
||||
}
|
4
Client/Pages/Index.razor.cs
Normal file
4
Client/Pages/Index.razor.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace Expose.MyIT.Client.Pages;
|
||||
|
||||
public partial class Index
|
||||
{ }
|
@ -1,6 +1,5 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<MudThemeProvider />
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
|
||||
|
4
Client/Shared/NavMenu.razor.cs
Normal file
4
Client/Shared/NavMenu.razor.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace Expose.MyIT.Client.Shared;
|
||||
|
||||
public partial class NavMenu
|
||||
{ }
|
@ -7,7 +7,7 @@
|
||||
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.1" />
|
||||
<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" />
|
||||
|
@ -53,7 +53,7 @@ public class Program
|
||||
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(app);
|
||||
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(app);
|
||||
|
||||
_ = app.UseHttpsRedirection();
|
||||
// _ = app.UseHttpsRedirection();
|
||||
|
||||
_ = app.UseBlazorFrameworkFiles();
|
||||
_ = app.UseStaticFiles();
|
||||
|
@ -8,6 +8,6 @@
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -2,19 +2,20 @@ using System.Text.Json;
|
||||
|
||||
namespace Expose.MyIT.Shared.ViewModels;
|
||||
|
||||
// [JsonConstructor]
|
||||
public record ServiceShopOrder(string Id,
|
||||
string Name,
|
||||
string[] BookingNames,
|
||||
string Type,
|
||||
string State,
|
||||
string ItemNumber,
|
||||
DateTime CreatedDate,
|
||||
DateTime DecidedDate,
|
||||
string Recipient,
|
||||
string Requestor)
|
||||
string Name,
|
||||
string[] BookingNames,
|
||||
string Type,
|
||||
string State,
|
||||
string ItemNumber,
|
||||
DateTime CreatedDate,
|
||||
DateTime DecidedDate,
|
||||
string Recipient,
|
||||
string Requestor)
|
||||
{
|
||||
|
||||
public ServiceShopOrder(Models.Order order) :
|
||||
internal ServiceShopOrder(Models.Order order) :
|
||||
this(order.Id,
|
||||
order.Name,
|
||||
order.Bookings is null || !order.Bookings.Any() ? Array.Empty<string>() : order.Bookings.Select(l => l.Name).ToArray(),
|
||||
|
@ -2,19 +2,20 @@ using System.Text.Json;
|
||||
|
||||
namespace Expose.MyIT.Shared.ViewModels;
|
||||
|
||||
// [JsonConstructor]
|
||||
public record SsaOrder(string Id,
|
||||
string Name,
|
||||
string[] BookingNames,
|
||||
string Type,
|
||||
string State,
|
||||
string ItemNumber,
|
||||
DateTime CreatedDate,
|
||||
DateTime DecidedDate,
|
||||
string Recipient,
|
||||
string Requestor)
|
||||
string Name,
|
||||
string[] BookingNames,
|
||||
string Type,
|
||||
string State,
|
||||
string ItemNumber,
|
||||
DateTime CreatedDate,
|
||||
DateTime DecidedDate,
|
||||
string Recipient,
|
||||
string Requestor)
|
||||
{
|
||||
|
||||
public SsaOrder(Models.Order order) :
|
||||
internal SsaOrder(Models.Order order) :
|
||||
this(order.Id,
|
||||
order.Name,
|
||||
order.Bookings is null || !order.Bookings.Any() ? Array.Empty<string>() : order.Bookings.Select(l => l.Name).ToArray(),
|
||||
|
@ -6,9 +6,22 @@ namespace Expose.MyIT.Shared.ViewModels;
|
||||
public record WeatherForecast
|
||||
{
|
||||
|
||||
public DateOnly Date { init; get; }
|
||||
|
||||
public int TemperatureC { init; get; }
|
||||
|
||||
public string? Summary { init; get; }
|
||||
|
||||
public int TemperatureF { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public WeatherForecast(DateOnly Date, int TemperatureC, string? Summary, int TemperatureF)
|
||||
{ }
|
||||
public WeatherForecast(DateOnly date, int temperatureC, string? summary, int temperatureF)
|
||||
{
|
||||
Date = date;
|
||||
TemperatureC = temperatureC;
|
||||
Summary = summary;
|
||||
TemperatureF = temperatureF;
|
||||
}
|
||||
|
||||
public WeatherForecast(Models.WeatherForecast weatherForecast) :
|
||||
this(weatherForecast.Date,
|
||||
|
@ -12,10 +12,10 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Expose-MyIT.Shared.csproj" />
|
||||
|
@ -3,7 +3,7 @@ using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
namespace Expose.MyIT.Tests;
|
||||
|
||||
@ -68,13 +68,9 @@ public class UnitTestServiceShopOrderController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(IServiceShopOrderController<object>.Action.All);
|
||||
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());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
ServiceShopOrder[]? serviceShopOrders = await httpClient.GetFromJsonAsync<ServiceShopOrder[]>($"api/{_ControllerName}/{actionName}");
|
||||
Assert.IsNotNull(serviceShopOrders);
|
||||
Assert.IsTrue(serviceShopOrders.Any());
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ using Expose.MyIT.Shared.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
namespace Expose.MyIT.Tests;
|
||||
|
||||
@ -68,13 +68,9 @@ public class UnitTestSsaOrderController
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
string actionName = nameof(ISsaOrderController<object>.Action.All);
|
||||
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());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
httpClient.Dispose();
|
||||
Assert.IsNotNull(result);
|
||||
Assert.IsTrue(result != "[]");
|
||||
SsaOrder[]? ssaOrders = await httpClient.GetFromJsonAsync<SsaOrder[]>($"api/{_ControllerName}/{actionName}");
|
||||
Assert.IsNotNull(ssaOrders);
|
||||
Assert.IsTrue(ssaOrders.Any());
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Serilog;
|
||||
using System.Net;
|
||||
|
||||
namespace Expose.MyIT.Tests;
|
||||
|
||||
@ -39,12 +38,8 @@ public class UnitTestWeatherForecastController
|
||||
{
|
||||
HttpClient httpClient = _WebApplicationFactory.CreateClient();
|
||||
_Logger.Information("Starting Web Application");
|
||||
HttpResponseMessage httpResponseMessage = await httpClient.GetAsync($"api/{_ControllerName}");
|
||||
Assert.AreEqual(HttpStatusCode.OK, httpResponseMessage.StatusCode);
|
||||
Assert.AreEqual("application/json; charset=utf-8", httpResponseMessage.Content.Headers.ContentType?.ToString());
|
||||
string result = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
string result = await httpClient.GetStringAsync($"api/{_ControllerName}");
|
||||
Assert.IsNotNull(result);
|
||||
httpClient.Dispose();
|
||||
_Logger.Information($"{_TestContext?.TestName} completed");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user