@ -1,78 +1,78 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | <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> | </Project> |
@ -1,66 +1,67 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | <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> | </Project> |
@ -1,128 +1,131 @@ | |||||
namespace IntegrationTests.Services.Marketing | 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; | |||||
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(); | |||||
} | |||||
} | |||||
[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_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 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 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 | |||||
var campaignResponse = await server.CreateClient() | |||||
.PostAsync(Post.AddNewCampaign, content); | |||||
if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id)) | |||||
{ | |||||
var response = await server.CreateClient() | |||||
.DeleteAsync(Delete.CampaignBy(id)); | |||||
Assert.True(response.StatusCode == HttpStatusCode.NoContent); | |||||
} | |||||
campaignResponse.EnsureSuccessStatusCode(); | |||||
} | |||||
} | |||||
[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"); | |||||
//add campaign | |||||
var campaignResponse = await server.CreateClient() | |||||
.PostAsync(Post.AddNewCampaign, content); | |||||
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); | |||||
Assert.True(response.StatusCode == HttpStatusCode.Created); | |||||
} | |||||
campaignResponse.EnsureSuccessStatusCode(); | |||||
} | |||||
} | |||||
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" | |||||
}; | |||||
} | |||||
} | |||||
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); | |||||
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_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 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 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 | |||||
var campaignResponse = await server.CreateClient() | |||||
.PostAsync(Post.AddNewCampaign, content); | |||||
if (int.TryParse(campaignResponse?.Headers.Location.Segments[4], out int id)) | |||||
{ | |||||
var response = await server.CreateClient() | |||||
.DeleteAsync(Delete.CampaignBy(id)); | |||||
Assert.True(response.StatusCode == HttpStatusCode.NoContent); | |||||
} | |||||
campaignResponse.EnsureSuccessStatusCode(); | |||||
} | |||||
} | |||||
[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"); | |||||
//add campaign | |||||
var campaignResponse = await server.CreateClient() | |||||
.PostAsync(Post.AddNewCampaign, content); | |||||
campaignResponse.EnsureSuccessStatusCode(); | |||||
Assert.Equal(HttpStatusCode.Created, campaignResponse.StatusCode); | |||||
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); | |||||
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" | |||||
}; | |||||
} | |||||
} | |||||
} | } |
@ -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" | |||||
} | } |
@ -1,36 +1,37 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | <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> | </Project> |