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