Updated test Projects and codes and NuGetPackages
This commit is contained in:
parent
6413692cb3
commit
e6f329de48
@ -1,78 +1,78 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<!--<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>-->
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Services\Location\**" />
|
||||
<Compile Remove="Services\Marketing\**" />
|
||||
<EmbeddedResource Remove="Services\Location\**" />
|
||||
<EmbeddedResource Remove="Services\Marketing\**" />
|
||||
<None Remove="Services\Location\**" />
|
||||
<None Remove="Services\Marketing\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Services\Location\**" />
|
||||
<Compile Remove="Services\Marketing\**" />
|
||||
<EmbeddedResource Remove="Services\Location\**" />
|
||||
<EmbeddedResource Remove="Services\Marketing\**" />
|
||||
<None Remove="Services\Location\**" />
|
||||
<None Remove="Services\Marketing\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Services\Location\LocationsScenariosBase.cs" />
|
||||
<Compile Include="Services\Location\LocationsTestsStartup.cs" />
|
||||
<Compile Include="Services\Marketing\CampaignScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\UserLocationRoleScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingScenarios.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingTestsStartup.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Services\Location\LocationsScenariosBase.cs" />
|
||||
<Compile Include="Services\Location\LocationsTestsStartup.cs" />
|
||||
<Compile Include="Services\Marketing\CampaignScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\UserLocationRoleScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingScenarios.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingScenariosBase.cs" />
|
||||
<Compile Include="Services\Marketing\MarketingTestsStartup.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Services\Basket\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Catalog\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Location\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Marketing\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Services\Basket\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Catalog\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Location\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Marketing\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Location\Locations.API\Locations.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Marketing\Marketing.API\Marketing.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Location\Locations.API\Locations.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Marketing\Marketing.API\Marketing.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Services\Locations\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Services\Ordering\settings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Services\Locations\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Services\Ordering\settings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,66 +1,67 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<AssemblyName>IntegrationTests</AssemblyName>
|
||||
<PackageId>IntegrationTests</PackageId>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<AssemblyName>IntegrationTests</AssemblyName>
|
||||
<PackageId>IntegrationTests</PackageId>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Services\Locations\appsettings.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Services\Locations\appsettings.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!--<Content Include="settings.json;web.config">-->
|
||||
<Content Include="Services\Basket\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Catalog\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Marketing\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Locations\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Ordering\settings.json">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!--<Content Include="settings.json;web.config">-->
|
||||
<Content Include="Services\Basket\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Catalog\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Marketing\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Locations\appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Services\Ordering\settings.json">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Location\Locations.API\Locations.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Marketing\Marketing.API\Marketing.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Location\Locations.API\Locations.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Marketing\Marketing.API\Marketing.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
|
||||
<PackageReference Include="Moq" Version="4.8.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="StackExchange.Redis.strongname" Version="1.2.6" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.500-preview2-1-003177" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="Moq" Version="4.9.0" />
|
||||
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.6" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Services\Ordering\settings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="Services\Ordering\settings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,145 +3,150 @@ using System.Net;
|
||||
|
||||
namespace IntegrationTests.Services.Catalog
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
public class CatalogScenarios
|
||||
: CatalogScenarioBase
|
||||
{
|
||||
[Fact]
|
||||
public async Task Get_get_all_catalogitems_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Items());
|
||||
public class CatalogScenarios
|
||||
: CatalogScenarioBase
|
||||
{
|
||||
[Fact]
|
||||
public async Task Get_get_all_catalogitems_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Items());
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(1));
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(1));
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_bad_request_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(int.MinValue));
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_bad_request_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(int.MinValue));
|
||||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
}
|
||||
}
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_not_found_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(int.MaxValue));
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_id_and_response_not_found_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemById(int.MaxValue));
|
||||
|
||||
Assert.Equal( HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
}
|
||||
//Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||
Assert.True(HttpStatusCode.NotFound == response.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_name_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemByName(".NET"));
|
||||
[Fact]
|
||||
public async Task Get_get_catalogitem_by_name_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemByName(".NET"));
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_catalogitem_by_name_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemByName(".NET", paginated));
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_catalogitem_by_name_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.ItemByName(".NET", paginated));
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Items(paginated));
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_filtered_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Filtered(1, 1));
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Items(paginated));
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_filtered_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Filtered(1, 1, paginated));
|
||||
[Fact]
|
||||
public async Task Get_get_filtered_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Filtered(1, 1));
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_catalog_types_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Types);
|
||||
[Fact]
|
||||
public async Task Get_get_paginated_filtered_catalog_items_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
const bool paginated = true;
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Filtered(1, 1, paginated));
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_catalog_brands_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Brands);
|
||||
[Fact]
|
||||
public async Task Get_catalog_types_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Types);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_catalog_brands_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Brands);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,128 +1,131 @@
|
||||
namespace IntegrationTests.Services.Marketing
|
||||
{
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Dto;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Dto;
|
||||
|
||||
public class CampaignScenarios
|
||||
: CampaignScenarioBase
|
||||
{
|
||||
[Fact]
|
||||
public async Task Get_get_all_campaigns_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Campaigns);
|
||||
public class CampaignScenarios
|
||||
: CampaignScenarioBase
|
||||
{
|
||||
[Fact]
|
||||
public async Task Get_get_all_campaigns_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.Campaigns);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
response.EnsureSuccessStatusCode();
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_campaign_by_id_and_response_ok_status_code()
|
||||
{
|
||||
var campaignId = 1;
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.CampaignBy(campaignId));
|
||||
}
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
[Fact]
|
||||
public async Task Get_get_campaign_by_id_and_response_ok_status_code()
|
||||
{
|
||||
var campaignId = 1;
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.CampaignBy(campaignId));
|
||||
|
||||
[Fact]
|
||||
public async Task Get_get_campaign_by_id_and_response_not_found_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.CampaignBy(int.MaxValue));
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
Assert.True(response.StatusCode == HttpStatusCode.NotFound);
|
||||
}
|
||||
}
|
||||
[Fact]
|
||||
public async Task Get_get_campaign_by_id_and_response_not_found_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.GetAsync(Get.CampaignBy(int.MaxValue));
|
||||
|
||||
[Fact]
|
||||
public async Task Post_add_new_campaign_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
Assert.True(response.StatusCode == HttpStatusCode.NotFound);
|
||||
}
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
[Fact]
|
||||
public async Task Post_add_new_campaign_and_response_ok_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
|
||||
[Fact]
|
||||
public async Task Delete_delete_campaign_and_response_not_content_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
//add campaign
|
||||
var campaignResponse = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
[Fact]
|
||||
public async Task Delete_delete_campaign_and_response_not_content_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
|
||||
if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id))
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.DeleteAsync(Delete.CampaignBy(id));
|
||||
//add campaign
|
||||
var campaignResponse = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
|
||||
Assert.True(response.StatusCode == HttpStatusCode.NoContent);
|
||||
}
|
||||
if (int.TryParse(campaignResponse?.Headers.Location.Segments[4], out int id))
|
||||
{
|
||||
var response = await server.CreateClient()
|
||||
.DeleteAsync(Delete.CampaignBy(id));
|
||||
|
||||
campaignResponse.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
Assert.True(response.StatusCode == HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Put_update_campaign_and_response_not_content_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
campaignResponse.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
//add campaign
|
||||
var campaignResponse = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
[Fact]
|
||||
public async Task Put_update_campaign_and_response_not_content_status_code()
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var fakeCampaignDto = GetFakeCampaignDto();
|
||||
var content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
|
||||
if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id))
|
||||
{
|
||||
fakeCampaignDto.Description = "FakeCampaignUpdatedDescription";
|
||||
content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateClient()
|
||||
.PutAsync(Put.CampaignBy(id), content);
|
||||
//add campaign
|
||||
var campaignResponse = await server.CreateClient()
|
||||
.PostAsync(Post.AddNewCampaign, content);
|
||||
|
||||
Assert.True(response.StatusCode == HttpStatusCode.Created);
|
||||
}
|
||||
campaignResponse.EnsureSuccessStatusCode();
|
||||
Assert.Equal(HttpStatusCode.Created, campaignResponse.StatusCode);
|
||||
|
||||
campaignResponse.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id))
|
||||
{
|
||||
fakeCampaignDto.Description = "FakeCampaignUpdatedDescription";
|
||||
content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateClient()
|
||||
.PutAsync(Put.CampaignBy(id), content);
|
||||
|
||||
private static CampaignDTO GetFakeCampaignDto()
|
||||
{
|
||||
return new CampaignDTO()
|
||||
{
|
||||
Name = "FakeCampaignName",
|
||||
Description = "FakeCampaignDescription",
|
||||
From = DateTime.Now,
|
||||
To = DateTime.Now.AddDays(7),
|
||||
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/0/pic"
|
||||
};
|
||||
}
|
||||
}
|
||||
Assert.True(response.StatusCode == HttpStatusCode.NoContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static CampaignDTO GetFakeCampaignDto()
|
||||
{
|
||||
return new CampaignDTO()
|
||||
{
|
||||
Name = "FakeCampaignName",
|
||||
Description = "FakeCampaignDescription",
|
||||
From = DateTime.Now,
|
||||
To = DateTime.Now.AddDays(7),
|
||||
PictureUri = "http://externalcatalogbaseurltobereplaced/api/v1/campaigns/0/pic"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var content = new StringContent(BuildOrder(), UTF8Encoding.UTF8, "application/json");
|
||||
var content = new StringContent(BuildOrder(), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateIdempotentClient()
|
||||
.PutAsync(Put.CancelOrder, content);
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
{
|
||||
using (var server = CreateServer())
|
||||
{
|
||||
var content = new StringContent(BuildOrder(), UTF8Encoding.UTF8, "application/json");
|
||||
var content = new StringContent(BuildOrder(), Encoding.UTF8, "application/json");
|
||||
var response = await server.CreateIdempotentClient()
|
||||
.PutAsync(Put.ShipOrder, content);
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
|
||||
"ExternalCatalogBaseUrl": "http://localhost:5101",
|
||||
"IdentityUrl": "http://localhost:5105",
|
||||
"isTest": "true",
|
||||
"EventBusConnection": "localhost",
|
||||
"CheckUpdateTime": "30000",
|
||||
"GracePeriodTime": "1",
|
||||
"SubscriptionClientName": "Ordering"
|
||||
"CheckUpdateTime": "30000",
|
||||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;",
|
||||
"EventBusConnection": "localhost",
|
||||
"ExternalCatalogBaseUrl": "http://localhost:5101",
|
||||
"GracePeriodTime": "1",
|
||||
"IdentityUrl": "http://localhost:5105",
|
||||
"isTest": "true",
|
||||
"SubscriptionClientName": "Ordering"
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace UnitTest.Ordering.Application
|
||||
{
|
||||
//Arrange
|
||||
var fakeDynamicResult = Enumerable.Empty<OrderSummary>();
|
||||
_orderQueriesMock.Setup(x => x.GetOrdersAsync())
|
||||
_orderQueriesMock.Setup(x => x.GetOrdersFromUserAsync(Guid.NewGuid()))
|
||||
.Returns(Task.FromResult(fakeDynamicResult));
|
||||
|
||||
//Act
|
||||
|
@ -1,36 +1,37 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.Infrastructure\Ordering.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.Domain\Ordering.Domain.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Basket\Basket.API\Basket.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Catalog\Catalog.API\Catalog.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.API\Ordering.API.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.Infrastructure\Ordering.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Services\Ordering\Ordering.Domain\Ordering.Domain.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Web\WebMVC\WebMVC.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<PackageReference Include="MediatR" Version="4.0.1" />
|
||||
<PackageReference Include="Moq" Version="4.8.1" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediatR" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.500-preview2-1-003177" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="Moq" Version="4.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user