Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,48 +1,47 @@
|
||||
using Microsoft.eShopWeb.FunctionalTests.PublicApi;
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web.Api;
|
||||
using Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints;
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.eShopWeb.FunctionalTests.PublicApi;
|
||||
using Microsoft.eShopWeb.FunctionalTests.Web.Api;
|
||||
using Microsoft.eShopWeb.PublicApi.CatalogItemEndpoints;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers
|
||||
namespace Microsoft.eShopWeb.FunctionalTests.Web.Controllers;
|
||||
|
||||
[Collection("Sequential")]
|
||||
public class DeleteEndpoint : IClassFixture<ApiTestFixture>
|
||||
{
|
||||
[Collection("Sequential")]
|
||||
public class DeleteEndpoint : IClassFixture<ApiTestFixture>
|
||||
JsonSerializerOptions _jsonOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
||||
|
||||
public DeleteEndpoint(ApiTestFixture factory)
|
||||
{
|
||||
JsonSerializerOptions _jsonOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
||||
Client = factory.CreateClient();
|
||||
}
|
||||
|
||||
public DeleteEndpoint(ApiTestFixture factory)
|
||||
{
|
||||
Client = factory.CreateClient();
|
||||
}
|
||||
public HttpClient Client { get; }
|
||||
|
||||
public HttpClient Client { get; }
|
||||
[Fact]
|
||||
public async Task ReturnsSuccessGivenValidIdAndAdminUserToken()
|
||||
{
|
||||
var adminToken = ApiTokenHelper.GetAdminUserToken();
|
||||
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", adminToken);
|
||||
var response = await Client.DeleteAsync("api/catalog-items/12");
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stringResponse = await response.Content.ReadAsStringAsync();
|
||||
var model = stringResponse.FromJson<DeleteCatalogItemResponse>();
|
||||
|
||||
[Fact]
|
||||
public async Task ReturnsSuccessGivenValidIdAndAdminUserToken()
|
||||
{
|
||||
var adminToken = ApiTokenHelper.GetAdminUserToken();
|
||||
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", adminToken);
|
||||
var response = await Client.DeleteAsync("api/catalog-items/12");
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stringResponse = await response.Content.ReadAsStringAsync();
|
||||
var model = stringResponse.FromJson<DeleteCatalogItemResponse>();
|
||||
Assert.Equal("Deleted", model.Status);
|
||||
}
|
||||
|
||||
Assert.Equal("Deleted", model.Status);
|
||||
}
|
||||
[Fact]
|
||||
public async Task ReturnsNotFoundGivenInvalidIdAndAdminUserToken()
|
||||
{
|
||||
var adminToken = ApiTokenHelper.GetAdminUserToken();
|
||||
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", adminToken);
|
||||
var response = await Client.DeleteAsync("api/catalog-items/0");
|
||||
|
||||
[Fact]
|
||||
public async Task ReturnsNotFoundGivenInvalidIdAndAdminUserToken()
|
||||
{
|
||||
var adminToken = ApiTokenHelper.GetAdminUserToken();
|
||||
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", adminToken);
|
||||
var response = await Client.DeleteAsync("api/catalog-items/0");
|
||||
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user