parent
							
								
									cc1013615a
								
							
						
					
					
						commit
						e9a89ae553
					
				| @ -1,9 +1,14 @@ | ||||
| version: '2' | ||||
| version: '3' | ||||
| 
 | ||||
| services: | ||||
|   sql.data: | ||||
|     environment: | ||||
|       - MSSQL_SA_PASSWORD=Pass@word | ||||
|       - ACCEPT_EULA=Y | ||||
|       - MSSQL_PID=Developer | ||||
|     ports: | ||||
|       - "5433:1433" | ||||
|    | ||||
|   nosql.data: | ||||
|     ports: | ||||
|       - "27017:27017" | ||||
| @ -13,3 +13,6 @@ services: | ||||
|     image: rabbitmq | ||||
|     ports: | ||||
|       - "5672:5672" | ||||
|    | ||||
|   nosql.data: | ||||
|     image: mongo | ||||
|  | ||||
| @ -28,6 +28,11 @@ namespace Ordering.API.Application.Commands | ||||
|         public async Task<bool> Handle(CancelOrderCommand command) | ||||
|         { | ||||
|             var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber); | ||||
|             if(orderToUpdate == null) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
| 
 | ||||
|             orderToUpdate.SetCancelledStatus(); | ||||
|             return await _orderRepository.UnitOfWork.SaveEntitiesAsync(); | ||||
|         } | ||||
|  | ||||
| @ -25,6 +25,11 @@ namespace Ordering.API.Application.Commands | ||||
|         public async Task<bool> Handle(ShipOrderCommand command) | ||||
|         { | ||||
|             var orderToUpdate = await _orderRepository.GetAsync(command.OrderNumber); | ||||
|             if(orderToUpdate == null) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
| 
 | ||||
|             orderToUpdate.SetShippedStatus(); | ||||
|             return await _orderRepository.UnitOfWork.SaveEntitiesAsync(); | ||||
|         } | ||||
|  | ||||
| @ -10,7 +10,8 @@ | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "ConnectionString": "127.0.0.1", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost" | ||||
|   "EventBusConnection": "localhost", | ||||
|   "SubscriptionClientName": "Basket" | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -1,13 +1,13 @@ | ||||
| using FunctionalTests.Middleware; | ||||
| using Microsoft.AspNetCore; | ||||
| using Microsoft.AspNetCore; | ||||
| using Microsoft.AspNetCore.Hosting; | ||||
| using Microsoft.AspNetCore.TestHost; | ||||
| using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | ||||
| using Microsoft.eShopOnContainers.Services.Catalog.API; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Microsoft.Extensions.Options; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
| 
 | ||||
| namespace FunctionalTests.Services.Catalog | ||||
| { | ||||
| @ -19,7 +19,22 @@ namespace FunctionalTests.Services.Catalog | ||||
|             webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Catalog"); | ||||
|             webHostBuilder.UseStartup<Startup>(); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             testServer.Host | ||||
|                 .MigrateDbContext<CatalogContext>((context, services) => | ||||
|                 { | ||||
|                     var env = services.GetService<IHostingEnvironment>(); | ||||
|                     var settings = services.GetService<IOptions<CatalogSettings>>(); | ||||
|                     var logger = services.GetService<ILogger<CatalogContextSeed>>(); | ||||
| 
 | ||||
|                     new CatalogContextSeed() | ||||
|                     .SeedAsync(context, env, settings, logger) | ||||
|                     .Wait(); | ||||
|                 }) | ||||
|                 .MigrateDbContext<IntegrationEventLogContext>((_, __) => { }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
| 
 | ||||
|         public static class Get | ||||
|  | ||||
| @ -4,5 +4,6 @@ | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/" | ||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", | ||||
|   "SubscriptionClientName": "Catalog" | ||||
| } | ||||
|  | ||||
| @ -4,5 +4,6 @@ | ||||
|   "ExternalCatalogBaseUrl": "http://localhost:5101", | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost" | ||||
|   "EventBusConnection": "localhost", | ||||
|   "SubscriptionClientName": "Location" | ||||
| } | ||||
|  | ||||
| @ -3,7 +3,9 @@ | ||||
|     using Microsoft.AspNetCore; | ||||
|     using Microsoft.AspNetCore.Hosting; | ||||
|     using Microsoft.AspNetCore.TestHost; | ||||
|     using Microsoft.Extensions.Configuration; | ||||
|     using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure; | ||||
|     using Microsoft.Extensions.DependencyInjection; | ||||
|     using Microsoft.Extensions.Logging; | ||||
|     using System.IO; | ||||
| 
 | ||||
|     public class MarketingScenariosBase | ||||
| @ -16,7 +18,19 @@ | ||||
|             webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Marketing"); | ||||
|             webHostBuilder.UseStartup<MarketingTestsStartup>(); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             testServer.Host | ||||
|                .MigrateDbContext<MarketingContext>((context, services) => | ||||
|                { | ||||
|                    var logger = services.GetService<ILogger<MarketingContextSeed>>(); | ||||
| 
 | ||||
|                    new MarketingContextSeed() | ||||
|                        .SeedAsync(context, logger) | ||||
|                        .Wait(); | ||||
|                }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -7,5 +7,6 @@ | ||||
|   "EventBusConnection": "localhost", | ||||
|   "AzureServiceBusEnabled": false, | ||||
|   "SubscriptionClientName": "Marketing", | ||||
|   "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/" | ||||
|   "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/", | ||||
|   "SubscriptionClientName": "Marketing" | ||||
| } | ||||
|  | ||||
| @ -1,11 +1,15 @@ | ||||
| using Microsoft.AspNetCore; | ||||
| using Microsoft.AspNetCore.Hosting; | ||||
| using Microsoft.AspNetCore.TestHost; | ||||
| using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | ||||
| using Microsoft.eShopOnContainers.Services.Ordering.API; | ||||
| using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure; | ||||
| using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Microsoft.Extensions.Options; | ||||
| using System.IO; | ||||
| using System.Text; | ||||
| 
 | ||||
| namespace FunctionalTests.Services.Ordering | ||||
| { | ||||
| @ -21,8 +25,22 @@ namespace FunctionalTests.Services.Ordering | ||||
|                  config.AddJsonFile("settings.json"); | ||||
|              }); | ||||
| 
 | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             testServer.Host | ||||
|                 .MigrateDbContext<OrderingContext>((context, services) => | ||||
|                 { | ||||
|                     var env = services.GetService<IHostingEnvironment>(); | ||||
|                     var settings = services.GetService<IOptions<OrderingSettings>>(); | ||||
|                     var logger = services.GetService<ILogger<OrderingContextSeed>>(); | ||||
| 
 | ||||
|                     new OrderingContextSeed() | ||||
|                         .SeedAsync(context, env, settings, logger) | ||||
|                         .Wait(); | ||||
|                 }) | ||||
|                 .MigrateDbContext<IntegrationEventLogContext>((_, __) => { }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
| 
 | ||||
|         public static class Get | ||||
|  | ||||
| @ -5,5 +5,6 @@ | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "CheckUpdateTime": "30000", | ||||
|   "GracePeriodTime": "1" | ||||
|   "GracePeriodTime": "1", | ||||
|   "SubscriptionClientName": "Ordering" | ||||
| } | ||||
|  | ||||
| @ -10,7 +10,8 @@ | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "ConnectionString": "127.0.0.1", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost" | ||||
|   "EventBusConnection": "localhost", | ||||
|   "SubscriptionClientName": "Basket" | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -3,7 +3,12 @@ | ||||
|     using Microsoft.AspNetCore; | ||||
|     using Microsoft.AspNetCore.Hosting; | ||||
|     using Microsoft.AspNetCore.TestHost; | ||||
|     using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | ||||
|     using Microsoft.eShopOnContainers.Services.Catalog.API; | ||||
|     using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; | ||||
|     using Microsoft.Extensions.DependencyInjection; | ||||
|     using Microsoft.Extensions.Logging; | ||||
|     using Microsoft.Extensions.Options; | ||||
|     using System.IO; | ||||
| 
 | ||||
|     public class CatalogScenarioBase | ||||
| @ -14,7 +19,22 @@ | ||||
|             webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Catalog"); | ||||
|             webHostBuilder.UseStartup<Startup>(); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             testServer.Host | ||||
|                 .MigrateDbContext<CatalogContext>((context, services) => | ||||
|                 { | ||||
|                     var env = services.GetService<IHostingEnvironment>(); | ||||
|                     var settings = services.GetService<IOptions<CatalogSettings>>(); | ||||
|                     var logger = services.GetService<ILogger<CatalogContextSeed>>(); | ||||
| 
 | ||||
|                     new CatalogContextSeed() | ||||
|                     .SeedAsync(context, env, settings, logger) | ||||
|                     .Wait(); | ||||
|                 }) | ||||
|                 .MigrateDbContext<IntegrationEventLogContext>((_, __) => { }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
| 
 | ||||
|         public static class Get | ||||
|  | ||||
| @ -4,5 +4,6 @@ | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/" | ||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", | ||||
|   "SubscriptionClientName": "Catalog" | ||||
| } | ||||
|  | ||||
| @ -4,5 +4,6 @@ | ||||
|   "ExternalCatalogBaseUrl": "http://localhost:5101", | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost" | ||||
|   "EventBusConnection": "localhost", | ||||
|   "SubscriptionClientName": "Locations" | ||||
| } | ||||
|  | ||||
| @ -3,6 +3,9 @@ | ||||
|     using Microsoft.AspNetCore; | ||||
|     using Microsoft.AspNetCore.Hosting; | ||||
|     using Microsoft.AspNetCore.TestHost; | ||||
|     using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure; | ||||
|     using Microsoft.Extensions.Logging; | ||||
|     using Microsoft.Extensions.DependencyInjection; | ||||
|     using System.IO; | ||||
| 
 | ||||
|     public class MarketingScenarioBase | ||||
| @ -15,7 +18,20 @@ | ||||
|             webHostBuilder.UseContentRoot(Directory.GetCurrentDirectory() + "\\Services\\Marketing"); | ||||
|             webHostBuilder.UseStartup<MarketingTestsStartup>(); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             testServer.Host | ||||
|                .MigrateDbContext<MarketingContext>((context, services) => | ||||
|                { | ||||
|                    var logger = services.GetService<ILogger<MarketingContextSeed>>(); | ||||
| 
 | ||||
|                    new MarketingContextSeed() | ||||
|                        .SeedAsync(context, logger) | ||||
|                        .Wait(); | ||||
| 
 | ||||
|                }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -5,5 +5,6 @@ | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/" | ||||
|   "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/", | ||||
|   "SubscriptionClientName": "Marketing" | ||||
| } | ||||
|  | ||||
| @ -4,8 +4,14 @@ | ||||
|     using Microsoft.AspNetCore.Hosting; | ||||
|     using Microsoft.AspNetCore.TestHost; | ||||
|     using Microsoft.eShopOnContainers.Services.Ordering.API; | ||||
|     using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure; | ||||
|     using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; | ||||
|     using Microsoft.Extensions.DependencyInjection; | ||||
|     using Microsoft.Extensions.Configuration; | ||||
|     using Microsoft.Extensions.Logging; | ||||
|     using Microsoft.Extensions.Options; | ||||
|     using System.IO; | ||||
|     using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; | ||||
| 
 | ||||
|     public class OrderingScenarioBase | ||||
|     { | ||||
| @ -19,7 +25,22 @@ | ||||
|                 config.AddJsonFile("settings.json"); | ||||
|             }); | ||||
| 
 | ||||
|             return new TestServer(webHostBuilder); | ||||
|             var testServer = new TestServer(webHostBuilder); | ||||
| 
 | ||||
|             testServer.Host | ||||
|                 .MigrateDbContext<OrderingContext>((context, services) => | ||||
|                 { | ||||
|                     var env = services.GetService<IHostingEnvironment>(); | ||||
|                     var settings = services.GetService<IOptions<OrderingSettings>>(); | ||||
|                     var logger = services.GetService<ILogger<OrderingContextSeed>>(); | ||||
| 
 | ||||
|                     new OrderingContextSeed() | ||||
|                         .SeedAsync(context, env, settings, logger) | ||||
|                         .Wait(); | ||||
|                 }) | ||||
|                 .MigrateDbContext<IntegrationEventLogContext>((_, __) => { }); | ||||
| 
 | ||||
|             return testServer; | ||||
|         } | ||||
| 
 | ||||
|         public static class Get | ||||
|  | ||||
| @ -25,7 +25,7 @@ | ||||
|         } | ||||
| 
 | ||||
|         [Fact] | ||||
|         public async Task Cancel_order_no_order_created_response_500_status_code() | ||||
|         public async Task Cancel_order_no_order_created_bad_request_response() | ||||
|         { | ||||
|             using (var server = CreateServer()) | ||||
|             { | ||||
| @ -33,12 +33,12 @@ | ||||
|                 var response = await server.CreateIdempotentClient() | ||||
|                     .PutAsync(Put.CancelOrder, content); | ||||
| 
 | ||||
|                 Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); | ||||
|                 Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         [Fact] | ||||
|         public async Task Ship_order_no_order_created_response_500_status_code() | ||||
|         public async Task Ship_order_no_order_created_bad_request_response() | ||||
|         { | ||||
|             using (var server = CreateServer()) | ||||
|             { | ||||
| @ -46,7 +46,7 @@ | ||||
|                 var response = await server.CreateIdempotentClient() | ||||
|                     .PutAsync(Put.ShipOrder, content); | ||||
| 
 | ||||
|                 Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode); | ||||
|                 Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -5,5 +5,6 @@ | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "CheckUpdateTime": "30000", | ||||
|   "GracePeriodTime": "1" | ||||
|   "GracePeriodTime": "1", | ||||
|   "SubscriptionClientName": "Ordering" | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user