diff --git a/VirtoCommerce.OrderModule.Data/VirtoCommerce.OrderModule.Data.csproj b/VirtoCommerce.OrderModule.Data/VirtoCommerce.OrderModule.Data.csproj
index 4b387052..ff1b343e 100644
--- a/VirtoCommerce.OrderModule.Data/VirtoCommerce.OrderModule.Data.csproj
+++ b/VirtoCommerce.OrderModule.Data/VirtoCommerce.OrderModule.Data.csproj
@@ -70,16 +70,16 @@
-
- ..\packages\VirtoCommerce.Domain.2.11.0\lib\net451\VirtoCommerce.Domain.dll
+
+ ..\packages\VirtoCommerce.Domain.2.14.1\lib\net451\VirtoCommerce.Domain.dll
True
-
- ..\packages\VirtoCommerce.Platform.Core.2.11.0\lib\net451\VirtoCommerce.Platform.Core.dll
+
+ ..\packages\VirtoCommerce.Platform.Core.2.11.2\lib\net451\VirtoCommerce.Platform.Core.dll
True
-
- ..\packages\VirtoCommerce.Platform.Data.2.11.0\lib\net451\VirtoCommerce.Platform.Data.dll
+
+ ..\packages\VirtoCommerce.Platform.Data.2.11.2\lib\net451\VirtoCommerce.Platform.Data.dll
True
diff --git a/VirtoCommerce.OrderModule.Data/packages.config b/VirtoCommerce.OrderModule.Data/packages.config
index 7f650fb4..e1f4d7fd 100644
--- a/VirtoCommerce.OrderModule.Data/packages.config
+++ b/VirtoCommerce.OrderModule.Data/packages.config
@@ -6,7 +6,7 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/VirtoCommerce.OrderModule.Test/App.config b/VirtoCommerce.OrderModule.Test/App.config
index 6b194953..d626a9e2 100644
--- a/VirtoCommerce.OrderModule.Test/App.config
+++ b/VirtoCommerce.OrderModule.Test/App.config
@@ -9,13 +9,8 @@
-
-
-
-
-
-
+
diff --git a/VirtoCommerce.OrderModule.Test/MigrationScenarios.cs b/VirtoCommerce.OrderModule.Test/MigrationScenarios.cs
new file mode 100644
index 00000000..32f51ee3
--- /dev/null
+++ b/VirtoCommerce.OrderModule.Test/MigrationScenarios.cs
@@ -0,0 +1,36 @@
+using System.Linq;
+using VirtoCommerce.OrderModule.Data.Repositories;
+using VirtoCommerce.Platform.Testing.Bases;
+using VirtoCommerce.OrderModule.Data.Migrations;
+using Xunit;
+using VirtoCommerce.Platform.Data.Infrastructure;
+
+namespace VirtoCommerce.OrderModule.Test
+{
+ public class MigrationScenarios : MigrationsTestBase
+ {
+ [Fact]
+ [Trait("Category", "CI")]
+ public void Can_create_order_new_database()
+ {
+ DropDatabase();
+
+ var migrator = CreateMigrator();
+
+ using (var context = CreateContext())
+ {
+ context.Database.CreateIfNotExists();
+ new SetupDatabaseInitializer().InitializeDatabase(context);
+ Assert.Equal(0, context.CustomerOrders.Count());
+ }
+
+ // remove all migrations
+ migrator.Update("0");
+ Assert.False(TableExists("OrderLineItem"));
+ var existTables = Info.Tables.Any();
+ Assert.False(existTables);
+
+ DropDatabase();
+ }
+ }
+}
diff --git a/VirtoCommerce.OrderModule.Test/OrderControllerTest.cs b/VirtoCommerce.OrderModule.Test/OrderControllerTest.cs
index 0e032ec8..1ecf3fdd 100644
--- a/VirtoCommerce.OrderModule.Test/OrderControllerTest.cs
+++ b/VirtoCommerce.OrderModule.Test/OrderControllerTest.cs
@@ -1,376 +1,376 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web.Http.Results;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using VirtoCommerce.CartModule.Data.Repositories;
-using VirtoCommerce.CartModule.Data.Services;
-using VirtoCommerce.CoreModule.Data.Services;
-using VirtoCommerce.Domain.Cart.Events;
-using VirtoCommerce.Domain.Commerce.Model;
-using VirtoCommerce.Domain.Order.Events;
-using VirtoCommerce.Domain.Payment.Model;
-using VirtoCommerce.Domain.Payment.Services;
-using VirtoCommerce.OrderModule.Data.Repositories;
-using VirtoCommerce.OrderModule.Data.Services;
-using VirtoCommerce.OrderModule.Web.Controllers.Api;
-using VirtoCommerce.Platform.Core.Common;
-using VirtoCommerce.Platform.Core.Events;
-using VirtoCommerce.Platform.Data.DynamicProperties;
-using VirtoCommerce.Platform.Data.Infrastructure.Interceptors;
-using VirtoCommerce.Platform.Data.Repositories;
-using coreModel = VirtoCommerce.Domain.Order.Model;
-using webModel = VirtoCommerce.OrderModule.Web.Model;
-
-namespace VirtoCommerce.OrderModule.Test
-{
- [TestClass]
- public class OrderControllerTest
- {
- private OrderModuleController _controller;
- [TestInitialize]
- public void Initialize()
- {
- _controller = GetCustomerOrderController();
- //var testOrder = GetTestOrder("order1");
- //_controller.CreateOrder(testOrder);
- }
-
- [TestMethod]
- public void GetOrderById()
- {
- var orderService = GetCustomerOrderService();
- var order = orderService.GetById("863f4bdf-7c0b-4e4c-a2e7-a0984b1a4b94", coreModel.CustomerOrderResponseGroup.Full);
- }
-
-
- [TestMethod]
- public void CreateNewOrderByShoppingCart()
- {
- var result = _controller.CreateOrderFromCart("b5cf3acd-216b-41c7-b998-61f96a1608f6") as OkNegotiatedContentResult;
- Assert.IsNotNull(result.Content);
- }
-
- [TestMethod]
- public void CreateNewManualOrder()
- {
- var testOrder = GetTestOrder("order");
- var result = _controller.CreateOrder(testOrder) as OkNegotiatedContentResult;
- Assert.IsNotNull(result.Content);
- }
-
- [TestMethod]
- public void ProcessPaymentForOrder()
- {
- var result = _controller.GetById("order1") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var payment = testOrder.InPayments.FirstOrDefault();
-
- var mockPaymentManager = new Mock();
- var gateway = mockPaymentManager.Object.GetAllPaymentMethods().FirstOrDefault(x => x.Code == payment.PaymentMethod.Code);
-
- var paymentEvaluationContext = new ProcessPaymentEvaluationContext();
-
- var paymentResult = gateway.ProcessPayment(paymentEvaluationContext);
-
- payment.IsApproved = paymentResult.IsSuccess;
-
- _controller.Update(testOrder);
- }
-
-
- [TestMethod]
- public void FulfilOrderWithSingleShipmentAndPartialUpdate()
- {
- var result = _controller.GetById("order1") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var partialChangeOrder = new webModel.CustomerOrder
- {
- Id = testOrder.Id,
- Shipments = testOrder.Shipments
- };
-
- var shipment = partialChangeOrder.Shipments.FirstOrDefault();
- shipment.Items = new List();
- foreach (var item in testOrder.Items)
- {
- var shipmentItem = new webModel.ShipmentItem
- {
- LineItemId = item.Id,
- Quantity = item.Quantity,
-
- };
- item.Id = null;
- shipment.Items.Add(shipmentItem);
- }
- shipment.IsApproved = true;
-
- _controller.Update(partialChangeOrder);
- }
-
- //
- [TestMethod]
- public void CancelOrderItem()
- {
- var result = _controller.GetById("order1") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var item = testOrder.Items.FirstOrDefault();
- testOrder.Items.Remove(item);
-
- _controller.Update(testOrder);
- result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
- testOrder = result.Content;
-
- }
-
- [TestMethod]
- public void DescreaseOrderItem()
- {
- var result = _controller.GetById("order1") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var item = testOrder.Items.FirstOrDefault();
- item.Quantity -= 1;
-
- _controller.Update(testOrder);
- result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
- testOrder = result.Content;
- }
-
- [TestMethod]
- public void AddNewOrderItem()
- {
- var result = _controller.GetById("order1") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var item1 = new webModel.LineItem
- {
- BasePrice = 77,
- Price = 77,
- DisplayName = "boots",
- ProductId = "boots",
- Name = "boots",
- Quantity = 2,
- FulfilmentLocationCode = "warehouse1",
- ShippingMethodCode = "EMS"
- };
- testOrder.Items.Add(item1);
-
- _controller.Update(testOrder);
- result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
- testOrder = result.Content;
- }
-
- [TestMethod]
- public void ApplyCoupon()
- {
- }
-
-
- [TestMethod]
- public void FulfilOrderWithMultipleShipment()
- {
- var result = _controller.GetById("d2a855c7-dc88-44b3-ab4e-4dba3fc89057") as OkNegotiatedContentResult;
- var testOrder = result.Content;
-
- var newShipment = new webModel.Shipment
- {
- Id = Guid.NewGuid().ToString(),
- Currency = testOrder.Currency,
- DeliveryAddress = testOrder.Addresses.FirstOrDefault(),
- IsApproved = true,
-
- };
- testOrder.IsApproved = true;
-
- testOrder.Shipments.Add(newShipment);
- //Aprove shipment
- foreach (var shipment in testOrder.Shipments)
- {
- shipment.IsApproved = true;
- }
- _controller.Update(testOrder);
-
- result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
- testOrder = result.Content;
- }
-
- [TestMethod]
- public void FulfilOrderPartialy()
- {
- }
-
- private static webModel.CustomerOrder GetTestOrder(string id)
- {
- var order = new webModel.CustomerOrder
- {
- Id = id,
- Currency = "USD",
- CustomerId = "vasja customer",
- EmployeeId = "employe",
- StoreId = "test store",
- Addresses = new[]
- {
- new webModel.Address {
- AddressType = AddressType.Shipping,
- City = "london",
- Phone = "+68787687",
- PostalCode = "22222",
- CountryCode = "ENG",
- CountryName = "England",
- Email = "user@mail.com",
- FirstName = "first name",
- LastName = "last name",
- Line1 = "line 1",
- Organization = "org1"
- }
- }.ToList(),
- Discount = new webModel.Discount
- {
- PromotionId = "testPromotion",
- Currency = "USD",
- DiscountAmount = 12,
- Coupon = new webModel.Coupon
- {
- Code = "ssss"
- }
- }
- };
- var item1 = new webModel.LineItem
- {
- BasePrice = 10,
- Price = 9,
- DisplayName = "shoes",
- ProductId = "shoes",
- CatalogId = "catalog",
- Currency = "USD",
- CategoryId = "category",
- Name = "shoes",
- Quantity = 2,
- FulfilmentLocationCode = "warehouse1",
- ShippingMethodCode = "EMS",
- Discount = new webModel.Discount
- {
- PromotionId = "itemPromotion",
- Currency = "USD",
- DiscountAmount = 12,
- Coupon = new webModel.Coupon
- {
- Code = "ssss"
- }
- }
- };
- var item2 = new webModel.LineItem
- {
- BasePrice = 100,
- Price = 100,
- DisplayName = "t-shirt",
- ProductId = "t-shirt",
- CatalogId = "catalog",
- CategoryId = "category",
- Currency = "USD",
- Name = "t-shirt",
- Quantity = 2,
- FulfilmentLocationCode = "warehouse1",
- ShippingMethodCode = "EMS",
- Discount = new webModel.Discount
- {
- PromotionId = "testPromotion",
- Currency = "USD",
- DiscountAmount = 12,
- Coupon = new webModel.Coupon
- {
- Code = "ssss"
- }
- }
- };
- order.Items = new List();
- order.Items.Add(item1);
- order.Items.Add(item2);
-
- var shipment = new webModel.Shipment
- {
- Currency = "USD",
- DeliveryAddress = new webModel.Address
- {
- City = "london",
- CountryName = "England",
- Phone = "+68787687",
- PostalCode = "2222",
- CountryCode = "ENG",
- Email = "user@mail.com",
- FirstName = "first name",
- LastName = "last name",
- Line1 = "line 1",
- Organization = "org1"
- },
- Discount = new webModel.Discount
- {
- PromotionId = "testPromotion",
- Currency = "USD",
- DiscountAmount = 12,
- Coupon = new webModel.Coupon
- {
- Code = "ssss"
- }
- },
-
- };
-
- shipment.Items = new List();
- shipment.Items.AddRange(order.Items.Select(x => new webModel.ShipmentItem { Quantity = x.Quantity, LineItem = x }));
-
- order.Shipments = new List();
- order.Shipments.Add(shipment);
-
- var payment = new webModel.PaymentIn
- {
- Currency = "USD",
- Sum = 10,
- CustomerId = "et"
- };
- order.InPayments = new List();
- order.InPayments.Add(payment);
-
- return order;
- }
-
- private static Func GetOrderRepositoryFactory()
- {
- Func orderRepositoryFactory = () =>
- {
- return new OrderRepositoryImpl("VirtoCommerce",
- new AuditableInterceptor(null),
- new EntityPrimaryKeyGeneratorInterceptor());
- };
- return orderRepositoryFactory;
- }
-
- private static CustomerOrderServiceImpl GetCustomerOrderService()
- {
- Func platformRepositoryFactory = () => new PlatformRepository("VirtoCommerce", new EntityPrimaryKeyGeneratorInterceptor(), new AuditableInterceptor(null));
- Func repositoryFactory = () => new CartRepositoryImpl("VirtoCommerce", new AuditableInterceptor(null));
-
- var dynamicPropertyService = new DynamicPropertyService(platformRepositoryFactory);
- var orderEventPublisher = new EventPublisher(Enumerable.Empty>().ToArray());
- var cartEventPublisher = new EventPublisher(Enumerable.Empty>().ToArray());
- var cartService = new ShoppingCartServiceImpl(repositoryFactory, cartEventPublisher, null, dynamicPropertyService);
-
-
- var orderService = new CustomerOrderServiceImpl(GetOrderRepositoryFactory(), new TimeBasedNumberGeneratorImpl(), orderEventPublisher, cartService, null, dynamicPropertyService, null, null, null);
-
- return orderService;
- }
-
- private static OrderModuleController GetCustomerOrderController()
- {
- var orderService = GetCustomerOrderService();
-
- return null;
- }
- }
-}
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.Web.Http.Results;
+//using Microsoft.VisualStudio.TestTools.UnitTesting;
+//using Moq;
+//using VirtoCommerce.CartModule.Data.Repositories;
+//using VirtoCommerce.CartModule.Data.Services;
+//using VirtoCommerce.CoreModule.Data.Services;
+//using VirtoCommerce.Domain.Cart.Events;
+//using VirtoCommerce.Domain.Commerce.Model;
+//using VirtoCommerce.Domain.Order.Events;
+//using VirtoCommerce.Domain.Payment.Model;
+//using VirtoCommerce.Domain.Payment.Services;
+//using VirtoCommerce.OrderModule.Data.Repositories;
+//using VirtoCommerce.OrderModule.Data.Services;
+//using VirtoCommerce.OrderModule.Web.Controllers.Api;
+//using VirtoCommerce.Platform.Core.Common;
+//using VirtoCommerce.Platform.Core.Events;
+//using VirtoCommerce.Platform.Data.DynamicProperties;
+//using VirtoCommerce.Platform.Data.Infrastructure.Interceptors;
+//using VirtoCommerce.Platform.Data.Repositories;
+//using coreModel = VirtoCommerce.Domain.Order.Model;
+//using webModel = VirtoCommerce.OrderModule.Web.Model;
+
+//namespace VirtoCommerce.OrderModule.Test
+//{
+// [TestClass]
+// public class OrderControllerTest
+// {
+// private OrderModuleController _controller;
+// [TestInitialize]
+// public void Initialize()
+// {
+// _controller = GetCustomerOrderController();
+// //var testOrder = GetTestOrder("order1");
+// //_controller.CreateOrder(testOrder);
+// }
+
+// [TestMethod]
+// public void GetOrderById()
+// {
+// var orderService = GetCustomerOrderService();
+// var order = orderService.GetById("863f4bdf-7c0b-4e4c-a2e7-a0984b1a4b94", coreModel.CustomerOrderResponseGroup.Full);
+// }
+
+
+// [TestMethod]
+// public void CreateNewOrderByShoppingCart()
+// {
+// var result = _controller.CreateOrderFromCart("b5cf3acd-216b-41c7-b998-61f96a1608f6") as OkNegotiatedContentResult;
+// Assert.IsNotNull(result.Content);
+// }
+
+// [TestMethod]
+// public void CreateNewManualOrder()
+// {
+// var testOrder = GetTestOrder("order");
+// var result = _controller.CreateOrder(testOrder) as OkNegotiatedContentResult;
+// Assert.IsNotNull(result.Content);
+// }
+
+// [TestMethod]
+// public void ProcessPaymentForOrder()
+// {
+// var result = _controller.GetById("order1") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var payment = testOrder.InPayments.FirstOrDefault();
+
+// var mockPaymentManager = new Mock();
+// var gateway = mockPaymentManager.Object.GetAllPaymentMethods().FirstOrDefault(x => x.Code == payment.PaymentMethod.Code);
+
+// var paymentEvaluationContext = new ProcessPaymentEvaluationContext();
+
+// var paymentResult = gateway.ProcessPayment(paymentEvaluationContext);
+
+// payment.IsApproved = paymentResult.IsSuccess;
+
+// _controller.Update(testOrder);
+// }
+
+
+// [TestMethod]
+// public void FulfilOrderWithSingleShipmentAndPartialUpdate()
+// {
+// var result = _controller.GetById("order1") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var partialChangeOrder = new webModel.CustomerOrder
+// {
+// Id = testOrder.Id,
+// Shipments = testOrder.Shipments
+// };
+
+// var shipment = partialChangeOrder.Shipments.FirstOrDefault();
+// shipment.Items = new List();
+// foreach (var item in testOrder.Items)
+// {
+// var shipmentItem = new webModel.ShipmentItem
+// {
+// LineItemId = item.Id,
+// Quantity = item.Quantity,
+
+// };
+// item.Id = null;
+// shipment.Items.Add(shipmentItem);
+// }
+// shipment.IsApproved = true;
+
+// _controller.Update(partialChangeOrder);
+// }
+
+// //
+// [TestMethod]
+// public void CancelOrderItem()
+// {
+// var result = _controller.GetById("order1") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var item = testOrder.Items.FirstOrDefault();
+// testOrder.Items.Remove(item);
+
+// _controller.Update(testOrder);
+// result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
+// testOrder = result.Content;
+
+// }
+
+// [TestMethod]
+// public void DescreaseOrderItem()
+// {
+// var result = _controller.GetById("order1") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var item = testOrder.Items.FirstOrDefault();
+// item.Quantity -= 1;
+
+// _controller.Update(testOrder);
+// result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
+// testOrder = result.Content;
+// }
+
+// [TestMethod]
+// public void AddNewOrderItem()
+// {
+// var result = _controller.GetById("order1") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var item1 = new webModel.LineItem
+// {
+// BasePrice = 77,
+// Price = 77,
+// DisplayName = "boots",
+// ProductId = "boots",
+// Name = "boots",
+// Quantity = 2,
+// FulfilmentLocationCode = "warehouse1",
+// ShippingMethodCode = "EMS"
+// };
+// testOrder.Items.Add(item1);
+
+// _controller.Update(testOrder);
+// result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
+// testOrder = result.Content;
+// }
+
+// [TestMethod]
+// public void ApplyCoupon()
+// {
+// }
+
+
+// [TestMethod]
+// public void FulfilOrderWithMultipleShipment()
+// {
+// var result = _controller.GetById("d2a855c7-dc88-44b3-ab4e-4dba3fc89057") as OkNegotiatedContentResult;
+// var testOrder = result.Content;
+
+// var newShipment = new webModel.Shipment
+// {
+// Id = Guid.NewGuid().ToString(),
+// Currency = testOrder.Currency,
+// DeliveryAddress = testOrder.Addresses.FirstOrDefault(),
+// IsApproved = true,
+
+// };
+// testOrder.IsApproved = true;
+
+// testOrder.Shipments.Add(newShipment);
+// //Aprove shipment
+// foreach (var shipment in testOrder.Shipments)
+// {
+// shipment.IsApproved = true;
+// }
+// _controller.Update(testOrder);
+
+// result = _controller.GetById(testOrder.Id) as OkNegotiatedContentResult;
+// testOrder = result.Content;
+// }
+
+// [TestMethod]
+// public void FulfilOrderPartialy()
+// {
+// }
+
+// private static webModel.CustomerOrder GetTestOrder(string id)
+// {
+// var order = new webModel.CustomerOrder
+// {
+// Id = id,
+// Currency = "USD",
+// CustomerId = "vasja customer",
+// EmployeeId = "employe",
+// StoreId = "test store",
+// Addresses = new[]
+// {
+// new webModel.Address {
+// AddressType = AddressType.Shipping,
+// City = "london",
+// Phone = "+68787687",
+// PostalCode = "22222",
+// CountryCode = "ENG",
+// CountryName = "England",
+// Email = "user@mail.com",
+// FirstName = "first name",
+// LastName = "last name",
+// Line1 = "line 1",
+// Organization = "org1"
+// }
+// }.ToList(),
+// Discount = new webModel.Discount
+// {
+// PromotionId = "testPromotion",
+// Currency = "USD",
+// DiscountAmount = 12,
+// Coupon = new webModel.Coupon
+// {
+// Code = "ssss"
+// }
+// }
+// };
+// var item1 = new webModel.LineItem
+// {
+// BasePrice = 10,
+// Price = 9,
+// DisplayName = "shoes",
+// ProductId = "shoes",
+// CatalogId = "catalog",
+// Currency = "USD",
+// CategoryId = "category",
+// Name = "shoes",
+// Quantity = 2,
+// FulfilmentLocationCode = "warehouse1",
+// ShippingMethodCode = "EMS",
+// Discount = new webModel.Discount
+// {
+// PromotionId = "itemPromotion",
+// Currency = "USD",
+// DiscountAmount = 12,
+// Coupon = new webModel.Coupon
+// {
+// Code = "ssss"
+// }
+// }
+// };
+// var item2 = new webModel.LineItem
+// {
+// BasePrice = 100,
+// Price = 100,
+// DisplayName = "t-shirt",
+// ProductId = "t-shirt",
+// CatalogId = "catalog",
+// CategoryId = "category",
+// Currency = "USD",
+// Name = "t-shirt",
+// Quantity = 2,
+// FulfilmentLocationCode = "warehouse1",
+// ShippingMethodCode = "EMS",
+// Discount = new webModel.Discount
+// {
+// PromotionId = "testPromotion",
+// Currency = "USD",
+// DiscountAmount = 12,
+// Coupon = new webModel.Coupon
+// {
+// Code = "ssss"
+// }
+// }
+// };
+// order.Items = new List();
+// order.Items.Add(item1);
+// order.Items.Add(item2);
+
+// var shipment = new webModel.Shipment
+// {
+// Currency = "USD",
+// DeliveryAddress = new webModel.Address
+// {
+// City = "london",
+// CountryName = "England",
+// Phone = "+68787687",
+// PostalCode = "2222",
+// CountryCode = "ENG",
+// Email = "user@mail.com",
+// FirstName = "first name",
+// LastName = "last name",
+// Line1 = "line 1",
+// Organization = "org1"
+// },
+// Discount = new webModel.Discount
+// {
+// PromotionId = "testPromotion",
+// Currency = "USD",
+// DiscountAmount = 12,
+// Coupon = new webModel.Coupon
+// {
+// Code = "ssss"
+// }
+// },
+
+// };
+
+// shipment.Items = new List();
+// shipment.Items.AddRange(order.Items.Select(x => new webModel.ShipmentItem { Quantity = x.Quantity, LineItem = x }));
+
+// order.Shipments = new List();
+// order.Shipments.Add(shipment);
+
+// var payment = new webModel.PaymentIn
+// {
+// Currency = "USD",
+// Sum = 10,
+// CustomerId = "et"
+// };
+// order.InPayments = new List();
+// order.InPayments.Add(payment);
+
+// return order;
+// }
+
+// private static Func GetOrderRepositoryFactory()
+// {
+// Func orderRepositoryFactory = () =>
+// {
+// return new OrderRepositoryImpl("VirtoCommerce",
+// new AuditableInterceptor(null),
+// new EntityPrimaryKeyGeneratorInterceptor());
+// };
+// return orderRepositoryFactory;
+// }
+
+// private static CustomerOrderServiceImpl GetCustomerOrderService()
+// {
+// Func platformRepositoryFactory = () => new PlatformRepository("VirtoCommerce", new EntityPrimaryKeyGeneratorInterceptor(), new AuditableInterceptor(null));
+// Func repositoryFactory = () => new CartRepositoryImpl("VirtoCommerce", new AuditableInterceptor(null));
+
+// var dynamicPropertyService = new DynamicPropertyService(platformRepositoryFactory);
+// var orderEventPublisher = new EventPublisher(Enumerable.Empty>().ToArray());
+// var cartEventPublisher = new EventPublisher(Enumerable.Empty>().ToArray());
+// var cartService = new ShoppingCartServiceImpl(repositoryFactory, cartEventPublisher, null, dynamicPropertyService);
+
+
+// var orderService = new CustomerOrderServiceImpl(GetOrderRepositoryFactory(), new TimeBasedNumberGeneratorImpl(), orderEventPublisher, cartService, null, dynamicPropertyService, null, null, null);
+
+// return orderService;
+// }
+
+// private static OrderModuleController GetCustomerOrderController()
+// {
+// var orderService = GetCustomerOrderService();
+
+// return null;
+// }
+// }
+//}
diff --git a/VirtoCommerce.OrderModule.Test/SequencesScenarios.cs b/VirtoCommerce.OrderModule.Test/SequencesScenarios.cs
index 28d24867..edaeed4d 100644
--- a/VirtoCommerce.OrderModule.Test/SequencesScenarios.cs
+++ b/VirtoCommerce.OrderModule.Test/SequencesScenarios.cs
@@ -1,17 +1,23 @@
using System.Collections.Generic;
using System.Diagnostics;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using VirtoCommerce.CoreModule.Data.Repositories;
using VirtoCommerce.CoreModule.Data.Services;
+using VirtoCommerce.Platform.Testing.Bases;
+using VirtoCommerce.Platform.Data.Infrastructure.Interceptors;
+using VirtoCommerce.Platform.Data.Infrastructure;
+using VirtoCommerce.CoreModule.Data.Migrations;
+using System.Data.Entity;
+using Xunit;
namespace VirtoCommerce.OrderModule.Test
{
- [TestClass]
- public class SequencesScenarios
+ [Trait("Category", "CI")]
+ public class SequencesScenarios : FunctionalTestBase
{
public static Dictionary GlobalNumbers = new Dictionary();
public static int RunCount = 0;
+ /*
[ClassInitialize]
public static void Initialize(TestContext context)
{
@@ -33,14 +39,18 @@ public static void Cleanup()
repository.Database.ExecuteSqlCommand(sql);
}
+ */
-
+ /*
[TestMethod]
[DeploymentItem("connectionStrings.config")]
[DeploymentItem("Configs/AppConfig.config", "Configs")]
- public void RunSequencesPerformance()
+ */
+
+ [Fact]
+ public void Can_run_sequences_performance()
{
- var repository = new CommerceRepositoryImpl("VirtoCommerce");
+ var repository = GetRepository();
var sequence = new SequenceUniqueNumberGeneratorServiceImpl(() => repository);
for (var i = 1; i < SequenceUniqueNumberGeneratorServiceImpl.SequenceReservationRange; i++)
@@ -49,14 +59,44 @@ public void RunSequencesPerformance()
Debug.WriteLine(result);
//This would fail if any duplicate generated
- Assert.IsFalse(GlobalNumbers.ContainsKey(result));
+ Assert.False(GlobalNumbers.ContainsKey(result));
GlobalNumbers.Add(result, result);
+ /* don't need second checks here
const string sql = "INSERT UniqueSequence VALUES(@p0);";
+
//This would fail if any duplicate generated beause we use primary key
var sqlResult = repository.Database.ExecuteSqlCommand(sql, result);
- Assert.AreEqual(1, sqlResult);
+ Assert.Equal(1, sqlResult);
+ */
+ }
+ }
+
+ protected CommerceRepositoryImpl GetRepository()
+ {
+ var repository = new CommerceRepositoryImpl(ConnectionString, new EntityPrimaryKeyGeneratorInterceptor(), new AuditableInterceptor(null));
+ EnsureDatabaseInitialized(() => new CommerceRepositoryImpl(ConnectionString), () => Database.SetInitializer(new SetupDatabaseInitializer()));
+
+ /*
+ const string sql =
+ @"IF OBJECT_ID('dbo.UniqueSequence', 'U') IS NULL
+ CREATE TABLE [dbo].[UniqueSequence]([Sequence] [nvarchar](255) NOT NULL,CONSTRAINT [PK_UniqueSequence] PRIMARY KEY CLUSTERED ([Sequence] ASC)
+ WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON))";
+
+ repository.Database.ExecuteSqlCommand(sql);
+ */
+
+ return repository;
+ }
+
+ public override void Dispose()
+ {
+ // Ensure LocalDb databases are deleted after use so that LocalDb doesn't throw if
+ // the temp location in which they are stored is later cleaned.
+ using (var context = new CommerceRepositoryImpl(ConnectionString))
+ {
+ context.Database.Delete();
}
}
}
-}
+}
\ No newline at end of file
diff --git a/VirtoCommerce.OrderModule.Test/VirtoCommerce.OrderModule.Test.csproj b/VirtoCommerce.OrderModule.Test/VirtoCommerce.OrderModule.Test.csproj
index fb5bab7a..4492881d 100644
--- a/VirtoCommerce.OrderModule.Test/VirtoCommerce.OrderModule.Test.csproj
+++ b/VirtoCommerce.OrderModule.Test/VirtoCommerce.OrderModule.Test.csproj
@@ -1,5 +1,6 @@
+
Debug
AnyCPU
@@ -19,6 +20,8 @@
..\
true
+
+
true
@@ -87,20 +90,40 @@
..\packages\VirtoCommerce.CartModule.Data.2.11.0\lib\net451\VirtoCommerce.CartModule.Data.dll
True
-
- ..\packages\VirtoCommerce.CoreModule.Data.2.11.0\lib\net451\VirtoCommerce.CoreModule.Data.dll
+
+ ..\packages\VirtoCommerce.CoreModule.Data.2.14.1\lib\net451\VirtoCommerce.CoreModule.Data.dll
True
-
- ..\packages\VirtoCommerce.Domain.2.11.0\lib\net451\VirtoCommerce.Domain.dll
+
+ ..\packages\VirtoCommerce.Domain.2.14.1\lib\net451\VirtoCommerce.Domain.dll
True
-
- ..\packages\VirtoCommerce.Platform.Core.2.11.0\lib\net451\VirtoCommerce.Platform.Core.dll
+
+ ..\packages\VirtoCommerce.Platform.Core.2.11.2\lib\net451\VirtoCommerce.Platform.Core.dll
True
-
- ..\packages\VirtoCommerce.Platform.Data.2.11.0\lib\net451\VirtoCommerce.Platform.Data.dll
+
+ ..\packages\VirtoCommerce.Platform.Data.2.11.2\lib\net451\VirtoCommerce.Platform.Data.dll
+ True
+
+
+ ..\packages\VirtoCommerce.Platform.Testing.2.11.2\lib\net451\VirtoCommerce.Platform.Testing.dll
+ True
+
+
+ ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll
+ True
+
+
+ ..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll
+ True
+
+
+ ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll
+ True
+
+
+ ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll
True
@@ -110,16 +133,13 @@
-
-
-
-
-
+
Properties\CommonAssemblyInfo.cs
+
@@ -162,6 +182,12 @@
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+