Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Minor improvements
support4946830db046
diff --git a/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs b/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.csindex db95ec2a8..334a1ccd0 100644--- a/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs+++ b/src/API/Grand.Api/ApiExplorer/MetadataApiDescriptionProvider.cs@@ -105,7 +105,7 @@ public class MetadataApiDescriptionProvider : IApiDescriptionProviderRelativePath = path};- var templateParameters = parsedTemplate?.Parameters.ToList() ?? new List<TemplatePart>();+ var templateParameters = parsedTemplate?.Parameters.ToList() ?? [];var parameterContext = new ApiParameterContext(_modelMetadataProvider, action, templateParameters);foreach (var parameter in GetParameters(parameterContext,@@ -401,9 +401,7 @@ public class MetadataApiDescriptionProvider : IApiDescriptionProvider{if (contentTypes.Count == 0){- contentTypes = new MediaTypeCollection {- "application/json"- };+ contentTypes = ["application/json"];}var results = new List<ApiRequestFormat>();diff --git a/src/API/Grand.Api/Filters/AuthorizeApiAdminAttribute.cs b/src/API/Grand.Api/Filters/AuthorizeApiAdminAttribute.csindex c7532bfc0..ea69068b2 100644--- a/src/API/Grand.Api/Filters/AuthorizeApiAdminAttribute.cs+++ b/src/API/Grand.Api/Filters/AuthorizeApiAdminAttribute.cs@@ -22,7 +22,7 @@ namespace Grand.Api.Filterspublic AuthorizeApiAdminAttribute(bool ignore = false) : base(typeof(AuthorizeApiAdminFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Business/Grand.Business.Catalog/Queries/Handlers/GetSearchProductsQueryHandler.cs b/src/Business/Grand.Business.Catalog/Queries/Handlers/GetSearchProductsQueryHandler.csindex 026bded7f..f53922c48 100644--- a/src/Business/Grand.Business.Catalog/Queries/Handlers/GetSearchProductsQueryHandler.cs+++ b/src/Business/Grand.Business.Catalog/Queries/Handlers/GetSearchProductsQueryHandler.cs@@ -104,7 +104,7 @@ namespace Grand.Business.Catalog.Queries.Handlersselect item;var groupQuerySpec = spec.Where(x => x.AllowFiltering).GroupBy(x =>- new { SpecificationAttributeOptionId = x.SpecificationAttributeOptionId }).ToList();+ new { x.SpecificationAttributeOptionId }).ToList();IList<string> specification =groupQuerySpec.Select(item => item.Key.SpecificationAttributeOptionId).ToList();diff --git a/src/Business/Grand.Business.Catalog/Services/Discounts/DiscountService.cs b/src/Business/Grand.Business.Catalog/Services/Discounts/DiscountService.csindex 41380100e..57da598f5 100644--- a/src/Business/Grand.Business.Catalog/Services/Discounts/DiscountService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Discounts/DiscountService.cs@@ -387,7 +387,9 @@ namespace Grand.Business.Catalog.Services.Discounts/// <returns>Discount validation result</returns>public virtual Task<DiscountValidationResult> ValidateDiscount(Discount discount, Customer customer, Currency currency, string couponCodeToValidate){- var couponCodes = string.IsNullOrWhiteSpace(couponCodeToValidate) ? Array.Empty<string>() : new[] { couponCodeToValidate };+ var couponCodes = string.IsNullOrWhiteSpace(couponCodeToValidate) ? Array.Empty<string>() : [+ couponCodeToValidate+ ];return ValidateDiscount(discount, customer, currency, couponCodes);}diff --git a/src/Business/Grand.Business.Catalog/Services/ExportImport/ProductSchemaProperty.cs b/src/Business/Grand.Business.Catalog/Services/ExportImport/ProductSchemaProperty.csindex f35981736..cdcff395d 100644--- a/src/Business/Grand.Business.Catalog/Services/ExportImport/ProductSchemaProperty.cs+++ b/src/Business/Grand.Business.Catalog/Services/ExportImport/ProductSchemaProperty.cs@@ -149,7 +149,7 @@ namespace Grand.Business.Catalog.Services.ExportImporti++;}- return new[] { picture1, picture2, picture3 };+ return [picture1, picture2, picture3];}}}diff --git a/src/Business/Grand.Business.Catalog/Services/Products/AuctionService.cs b/src/Business/Grand.Business.Catalog/Services/Products/AuctionService.csindex cf7de9e9d..92dafdcb2 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/AuctionService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/AuctionService.cs@@ -150,8 +150,7 @@ namespace Grand.Business.Catalog.Services.Products{if (latest.CustomerId != customer.Id){- await _mediator.Send(new SendOutBidCustomerCommand()- {+ await _mediator.Send(new SendOutBidCustomerCommand {Product = product,Bid = latest,Language = languagediff --git a/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs b/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.csindex 93dd27db9..613090535 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/InventoryManageService.cs@@ -119,7 +119,7 @@ namespace Grand.Business.Catalog.Services.Productsvar p1 = await _productRepository.GetByIdAsync(item.ProductId);if (p1 == null || p1.Id == product.Id ||p1.ManageInventoryMethodId == ManageInventoryMethod.DontManageStock) continue;- var shipmentItem1 = new ShipmentItem() {+ var shipmentItem1 = new ShipmentItem {Id = shipmentItem.Id,Attributes = shipmentItem.Attributes,OrderItemId = shipmentItem.OrderItemId,@@ -145,7 +145,7 @@ namespace Grand.Business.Catalog.Services.Products|| associatedProduct.Id == product.Id|| associatedProduct.ManageInventoryMethodId == ManageInventoryMethod.DontManageStock) continue;if (await CheckExistsInventoryJournal(associatedProduct, shipmentItem)) continue;- var item = new ShipmentItem() {+ var item = new ShipmentItem {Id = shipmentItem.Id,Attributes = shipmentItem.Attributes,OrderItemId = shipmentItem.OrderItemId,@@ -383,7 +383,7 @@ namespace Grand.Business.Catalog.Services.Products//send email notificationif (quantityToChange < 0 && _stockQuantityService.GetTotalStockQuantity(product, warehouseId: warehouseId) < product.NotifyAdminForQuantityBelow){- await _mediator.Send(new SendQuantityBelowStoreOwnerCommand() {+ await _mediator.Send(new SendQuantityBelowStoreOwnerCommand {Product = product});}@@ -402,7 +402,7 @@ namespace Grand.Business.Catalog.Services.Products//send email notificationif (quantityToChange < 0 && combination.StockQuantity < combination.NotifyAdminForQuantityBelow){- await _mediator.Send(new SendQuantityBelowStoreOwnerCommand() {+ await _mediator.Send(new SendQuantityBelowStoreOwnerCommand {Product = product,ProductAttributeCombination = combination});diff --git a/src/Business/Grand.Business.Catalog/Services/Products/OutOfStockSubscriptionService.cs b/src/Business/Grand.Business.Catalog/Services/Products/OutOfStockSubscriptionService.csindex 6424108c7..9013f0106 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/OutOfStockSubscriptionService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/OutOfStockSubscriptionService.cs@@ -156,8 +156,7 @@ namespace Grand.Business.Catalog.Services.Productsif (product == null)throw new ArgumentNullException(nameof(product));- var subscriptions = await _mediator.Send(new SendNotificationsToSubscribersCommand()- {+ var subscriptions = await _mediator.Send(new SendNotificationsToSubscribersCommand {Product = product,Warehouse = warehouse});@@ -178,8 +177,7 @@ namespace Grand.Business.Catalog.Services.Productsif (product == null)throw new ArgumentNullException(nameof(product));- var subscriptions = await _mediator.Send(new SendNotificationsToSubscribersCommand()- {+ var subscriptions = await _mediator.Send(new SendNotificationsToSubscribersCommand {Product = product,Warehouse = warehouse,Attributes = attributesdiff --git a/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs b/src/Business/Grand.Business.Catalog/Services/Products/ProductService.csindex d549d0cb0..41af576bf 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/ProductService.cs@@ -110,7 +110,7 @@ namespace Grand.Business.Catalog.Services.Products{if (string.IsNullOrEmpty(productId))return null;- var product = await GetProductById(productId) ?? await _mediator.Send(new GetProductArchByIdQuery() { Id = productId });+ var product = await GetProductById(productId) ?? await _mediator.Send(new GetProductArchByIdQuery { Id = productId });return product;}/// <summary>diff --git a/src/Business/Grand.Business.Catalog/Services/Products/RecentlyViewedProductsService.cs b/src/Business/Grand.Business.Catalog/Services/Products/RecentlyViewedProductsService.csindex c4dc4fa6a..db77815e0 100644--- a/src/Business/Grand.Business.Catalog/Services/Products/RecentlyViewedProductsService.cs+++ b/src/Business/Grand.Business.Catalog/Services/Products/RecentlyViewedProductsService.cs@@ -105,7 +105,7 @@ namespace Grand.Business.Catalog.Services.Productsvar recentlyViewedProduct = recentlyViewedProducts.FirstOrDefault(x => x.ProductId == productId);if (recentlyViewedProduct == null){- await _recentlyViewedProducts.InsertAsync(new RecentlyViewedProduct() { CustomerId = customerId, ProductId = productId });+ await _recentlyViewedProducts.InsertAsync(new RecentlyViewedProduct { CustomerId = customerId, ProductId = productId });}else{diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/MaxOrderNumberCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/MaxOrderNumberCommandHandler.csindex 5044ff03c..96aa3d757 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/MaxOrderNumberCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/MaxOrderNumberCommandHandler.cs@@ -23,7 +23,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersvar max = count > 0 ? _orderRepository.Table.Max(x => x.OrderNumber) : 0;if (!request.OrderNumber.HasValue) return max;if (request.OrderNumber.Value <= max) return max;- await _orderRepository.InsertAsync(new Order() { OrderNumber = request.OrderNumber.Value, Deleted = true });+ await _orderRepository.InsertAsync(new Order { OrderNumber = request.OrderNumber.Value, Deleted = true });max = request.OrderNumber.Value;return max;}diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/OrderStatusCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/OrderStatusCommandHandler.csindex 92e3da37b..d1baf4f81 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/OrderStatusCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/OrderStatusCommandHandler.cs@@ -72,8 +72,10 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersvar orderCompletedAttachmentFileName = _orderSettings.AttachPdfInvoiceToOrderCompletedEmail ?"order.pdf" : null;- var orderCompletedAttachments = _orderSettings.AttachPdfInvoiceToOrderCompletedEmail && _orderSettings.AttachPdfInvoiceToBinary ?- new List<string> { await _pdfService.SaveOrderToBinary(request.Order, "") } : new List<string>();+ var orderCompletedAttachments = _orderSettings.AttachPdfInvoiceToOrderCompletedEmail && _orderSettings.AttachPdfInvoiceToBinary ? [+ await _pdfService.SaveOrderToBinary(request.Order, "")+ ]+ : new List<string>();await _messageProviderService.SendOrderCompletedCustomerMessage(request.Order, customer, request.Order.CustomerLanguageId, orderCompletedAttachmentFilePath,diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.csindex 7020c4298..71b520856 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs@@ -818,7 +818,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersawait _auctionService.UpdateAuctionEnded(product, true, true);await _auctionService.UpdateHighestBid(product, product.Price, order.CustomerId);await _messageProviderService.SendAuctionEndedBinCustomerMessage(product, order.CustomerId, order.CustomerLanguageId, order.StoreId);- await _auctionService.InsertBid(new Bid() {+ await _auctionService.InsertBid(new Bid {CustomerId = order.CustomerId,OrderId = order.Id,Amount = product.Price,@@ -1076,8 +1076,10 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersawait pdfService.PrintOrderToPdf(order, order.CustomerLanguageId) : null;orderPlacedAttachmentFileName = orderSettings.AttachPdfInvoiceToOrderPlacedEmail && !orderSettings.AttachPdfInvoiceToBinary ?"order.pdf" : null;- orderPlacedAttachments = orderSettings.AttachPdfInvoiceToOrderPlacedEmail && orderSettings.AttachPdfInvoiceToBinary ?- new List<string> { await pdfService.SaveOrderToBinary(order, order.CustomerLanguageId) } : new List<string>();+ orderPlacedAttachments = orderSettings.AttachPdfInvoiceToOrderPlacedEmail && orderSettings.AttachPdfInvoiceToBinary ? [+ await pdfService.SaveOrderToBinary(order, order.CustomerLanguageId)+ ]+ : [];}catch (Exception ex){@@ -1089,7 +1091,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersif (order.OrderItems.Any(x => !string.IsNullOrEmpty(x.VendorId))){- var vendors = await mediator.Send(new GetVendorsInOrderQuery() { Order = order });+ var vendors = await mediator.Send(new GetVendorsInOrderQuery { Order = order });foreach (var vendor in vendors){await messageProviderService.SendOrderPlacedVendorMessage(order, customer, vendor, languageSettings.DefaultAdminLanguageId);diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ProcessOrderPaidCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ProcessOrderPaidCommandHandler.csindex 712a6f380..45102c536 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ProcessOrderPaidCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ProcessOrderPaidCommandHandler.cs@@ -64,8 +64,10 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersvar orderPaidAttachmentFileName = _orderSettings.AttachPdfInvoiceToOrderPaidEmail && !_orderSettings.AttachPdfInvoiceToBinary ?"order.pdf" : null;- var orderPaidAttachments = _orderSettings.AttachPdfInvoiceToOrderPaidEmail && _orderSettings.AttachPdfInvoiceToBinary ?- new List<string> { await _pdfService.SaveOrderToBinary(order, "") } : new List<string>();+ var orderPaidAttachments = _orderSettings.AttachPdfInvoiceToOrderPaidEmail && _orderSettings.AttachPdfInvoiceToBinary ? [+ await _pdfService.SaveOrderToBinary(order, "")+ ]+ : new List<string>();await _messageProviderService.SendOrderPaidCustomerMessage(order, customer, order.CustomerLanguageId,orderPaidAttachmentFilePath, orderPaidAttachmentFileName, orderPaidAttachments);diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandler.csindex 2ab87df7a..26549c1c7 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandler.cs@@ -43,7 +43,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersvar amount = await _currencyService.ConvertToPrimaryStoreCurrency(request.Order.OrderTotal - request.Order.OrderShippingInclTax, currency);- var points = await _mediator.Send(new CalculateLoyaltyPointsCommand() { Customer = customer, Amount = amount }, cancellationToken);+ var points = await _mediator.Send(new CalculateLoyaltyPointsCommand { Customer = customer, Amount = amount }, cancellationToken);if (points <= 0)return false;diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.csindex 60ecc5a70..117fde479 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/UpdateOrderItemCommandHandler.cs@@ -73,7 +73,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders}await _orderService.UpdateOrder(request.Order);//check order status- await _mediator.Send(new CheckOrderStatusCommand() { Order = request.Order }, cancellationToken);+ await _mediator.Send(new CheckOrderStatusCommand { Order = request.Order }, cancellationToken);//add a noteawait _orderService.InsertOrderNote(new OrderNote {diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidCommandHandler.csindex 4ad05e96d..55f331dd7 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidCommandHandler.cs@@ -65,7 +65,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersawait _orderService.UpdateOrder(order);//check order status- await _mediator.Send(new CheckOrderStatusCommand() { Order = order }, cancellationToken);+ await _mediator.Send(new CheckOrderStatusCommand { Order = order }, cancellationToken);}}}diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidOfflineCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidOfflineCommandHandler.csindex 9ad1e85fe..497a1c104 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidOfflineCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/VoidOfflineCommandHandler.cs@@ -38,7 +38,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersif (order == null)throw new ArgumentNullException(nameof(order));- if (!await _mediator.Send(new CanVoidOfflineQuery() { PaymentTransaction = paymentTransaction }, cancellationToken))+ if (!await _mediator.Send(new CanVoidOfflineQuery { PaymentTransaction = paymentTransaction }, cancellationToken))throw new GrandException("You can't void this order");order.PaymentStatusId = PaymentStatus.Voided;@@ -48,7 +48,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Ordersawait _mediator.Publish(new PaymentTransactionVoidOfflineEvent(paymentTransaction), cancellationToken);//check order status- await _mediator.Send(new CheckOrderStatusCommand() { Order = order }, cancellationToken);+ await _mediator.Send(new CheckOrderStatusCommand { Order = order }, cancellationToken);return true;}}diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Shipping/ShipCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Shipping/ShipCommandHandler.csindex 8c2063154..fe0fbaf9a 100644--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Shipping/ShipCommandHandler.cs+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Shipping/ShipCommandHandler.cs@@ -67,7 +67,7 @@ namespace Grand.Business.Checkout.Commands.Handlers.Shippingawait _messageProviderService.SendShipmentSentCustomerMessage(request.Shipment, order);}//check order status- await _mediator.Send(new CheckOrderStatusCommand() { Order = order }, cancellationToken);+ await _mediator.Send(new CheckOrderStatusCommand { Order = order }, cancellationToken);//eventawait _mediator.PublishShipmentSent(request.Shipment);diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.csindex c3346d59b..530bb5aec 100644--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs@@ -250,7 +250,7 @@ namespace Grand.Business.Checkout.Services.Orderselse shoppingCartItem = await InsertNewItem(customer, product, shoppingCartItem, automaticallyAddRequiredProductsIfEnabled);if (product.ProductTypeId == ProductType.Reservation)- await _mediator.Send(new AddCustomerReservationCommand() {+ await _mediator.Send(new AddCustomerReservationCommand {Customer = customer,Product = product,ShoppingCartItem = shoppingCartItem,@@ -286,7 +286,7 @@ namespace Grand.Business.Checkout.Services.Ordersawait _mediator.Publish(new AddToCartEvent(customer, shoppingCartItem, product));if (automaticallyAddRequiredProductsIfEnabled){- await _mediator.Send(new AddRequiredProductsCommand() {+ await _mediator.Send(new AddRequiredProductsCommand {Customer = customer,Product = product,ShoppingCartType = shoppingCartItem.ShoppingCartTypeId,diff --git a/src/Business/Grand.Business.Checkout/Validators/ShoppingCartItemAttributeValidator.cs b/src/Business/Grand.Business.Checkout/Validators/ShoppingCartItemAttributeValidator.csindex cb91a7c35..3d6b863d8 100644--- a/src/Business/Grand.Business.Checkout/Validators/ShoppingCartItemAttributeValidator.cs+++ b/src/Business/Grand.Business.Checkout/Validators/ShoppingCartItemAttributeValidator.cs@@ -50,7 +50,7 @@ namespace Grand.Business.Checkout.Validators{var totalQty = value.ShoppingCartItem.Quantity * attributeValue.Quantity;var associatedProductWarnings = await GetShoppingCartItemWarnings(- value with { Product = associatedProduct, ShoppingCartItem = new ShoppingCartItem() {+ value with { Product = associatedProduct, ShoppingCartItem = new ShoppingCartItem {ShoppingCartTypeId = value.ShoppingCartItem.ShoppingCartTypeId,StoreId = value.ShoppingCartItem.Id,Quantity = totalQty,diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidObjectBuilder.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidObjectBuilder.csindex 5be1ff4ab..0c65bafdc 100644--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidObjectBuilder.cs+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidObjectBuilder.cs@@ -39,7 +39,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidStore = await _mediator.Send(new GetStoreTokensCommand() { Store = store, Language = language, EmailAccount = emailAccount });+ var liquidStore = await _mediator.Send(new GetStoreTokensCommand { Store = store, Language = language, EmailAccount = emailAccount });liquidObject.Store = liquidStore;await _mediator.EntityTokensAdded(store, liquidStore, liquidObject);});@@ -50,7 +50,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidOrder = await _mediator.Send(new GetOrderTokensCommand() {+ var liquidOrder = await _mediator.Send(new GetOrderTokensCommand {Order = order,Customer = customer,Vendor = vendor,@@ -70,7 +70,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops_chain.Add(async liquidObject =>{- var liquidShipment = await _mediator.Send(new GetShipmentTokensCommand() { Shipment = shipment, Order = order, Store = store, Host = host, Language = language });+ var liquidShipment = await _mediator.Send(new GetShipmentTokensCommand { Shipment = shipment, Order = order, Store = store, Host = host, Language = language });liquidObject.Shipment = liquidShipment;await _mediator.EntityTokensAdded(shipment, liquidShipment, liquidObject);});@@ -81,7 +81,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidMerchandiseReturn = await _mediator.Send(new GetMerchandiseReturnTokensCommand() { Order = order, Language = language, MerchandiseReturn = merchandiseReturn, MerchandiseReturnNote = merchandiseReturnNote, Store = store, Host = host });+ var liquidMerchandiseReturn = await _mediator.Send(new GetMerchandiseReturnTokensCommand { Order = order, Language = language, MerchandiseReturn = merchandiseReturn, MerchandiseReturnNote = merchandiseReturnNote, Store = store, Host = host });liquidObject.MerchandiseReturn = liquidMerchandiseReturn;await _mediator.EntityTokensAdded(merchandiseReturn, liquidMerchandiseReturn, liquidObject);});@@ -92,7 +92,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidGiftCart = await _mediator.Send(new GetGiftVoucherTokensCommand() { GiftVoucher = giftVoucher, Language = language });+ var liquidGiftCart = await _mediator.Send(new GetGiftVoucherTokensCommand { GiftVoucher = giftVoucher, Language = language });liquidObject.GiftVoucher = liquidGiftCart;await _mediator.EntityTokensAdded(giftVoucher, liquidGiftCart, liquidObject);});@@ -117,7 +117,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidShoppingCart = await _mediator.Send(new GetShoppingCartTokensCommand() {+ var liquidShoppingCart = await _mediator.Send(new GetShoppingCartTokensCommand {Customer = customer,Language = language,Store = store@@ -133,7 +133,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidVendor = await _mediator.Send(new GetVendorTokensCommand() { Vendor = vendor, Language = language });+ var liquidVendor = await _mediator.Send(new GetVendorTokensCommand { Vendor = vendor, Language = language });liquidObject.Vendor = liquidVendor;await _mediator.EntityTokensAdded(vendor, liquidVendor, liquidObject);});@@ -222,7 +222,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops_chain.Add(async liquidObject =>{- var liquidAttributeCombination = await _mediator.Send(new GetAttributeCombinationTokensCommand() { Product = product, Combination = combination });+ var liquidAttributeCombination = await _mediator.Send(new GetAttributeCombinationTokensCommand { Product = product, Combination = combination });liquidObject.AttributeCombination = liquidAttributeCombination;await _mediator.EntityTokensAdded(combination, liquidAttributeCombination, liquidObject);});@@ -244,7 +244,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops{_chain.Add(async liquidObject =>{- var liquidAuctions = await _mediator.Send(new GetAuctionTokensCommand() { Product = product, Bid = bid });+ var liquidAuctions = await _mediator.Send(new GetAuctionTokensCommand { Product = product, Bid = bid });liquidObject.Auctions = liquidAuctions;await _mediator.EntityTokensAdded(bid, liquidAuctions, liquidObject);});diff --git a/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs b/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.csindex 47c1004fb..07122936b 100644--- a/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs+++ b/src/Business/Grand.Business.Core/Utilities/System/StandardAdminSiteMap.cs@@ -5,1147 +5,1186 @@ namespace Grand.Business.Core.Utilities.System{public static class StandardAdminSiteMap{- public static readonly List<AdminSiteMap> SiteMap =- new List<AdminSiteMap> {- new () {- SystemName = "Dashboard",- ResourceName = "Admin.Dashboard",- ControllerName = "Home",- ActionName = "Index",- IconClass = "icon-home",- DisplayOrder = 0,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Dashboard",- ResourceName = "Admin.Dashboard",- ControllerName = "Home",- ActionName = "Index",- DisplayOrder = 0,- IconClass = "icon-bar-chart"- },- new () {- SystemName = "Dashboard",- ResourceName = "Admin.Dashboard.Statistics",- ControllerName = "Home",- ActionName = "Statistics",- DisplayOrder = 1,- PermissionNames = new List<string> { PermissionSystemName.Reports },- IconClass = "icon-bulb"- },- new () {- SystemName = "Shopping carts and wishlists",- ResourceName = "Admin.Dashboards.CurrentCartWishlists",- PermissionNames = new List<string> { PermissionSystemName.CurrentCarts },- ControllerName = "ShoppingCart",- ActionName = "CurrentCarts",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Online customers",- ResourceName = "Admin.Dashboards.OnlineCustomers",- PermissionNames = new List<string> { PermissionSystemName.Customers },- ControllerName = "OnlineCustomer",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- }+ public static readonly List<AdminSiteMap> SiteMap = [+ new() {+ SystemName = "Dashboard",+ ResourceName = "Admin.Dashboard",+ ControllerName = "Home",+ ActionName = "Index",+ IconClass = "icon-home",+ DisplayOrder = 0,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Dashboard",+ ResourceName = "Admin.Dashboard",+ ControllerName = "Home",+ ActionName = "Index",+ DisplayOrder = 0,+ IconClass = "icon-bar-chart"+ },+ new() {+ SystemName = "Dashboard",+ ResourceName = "Admin.Dashboard.Statistics",+ ControllerName = "Home",+ ActionName = "Statistics",+ DisplayOrder = 1,+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ IconClass = "icon-bulb"+ },+ new() {+ SystemName = "Shopping carts and wishlists",+ ResourceName = "Admin.Dashboards.CurrentCartWishlists",+ PermissionNames = new List<string> { PermissionSystemName.CurrentCarts },+ ControllerName = "ShoppingCart",+ ActionName = "CurrentCarts",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Online customers",+ ResourceName = "Admin.Dashboards.OnlineCustomers",+ PermissionNames = new List<string> { PermissionSystemName.Customers },+ ControllerName = "OnlineCustomer",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Catalog",+ ResourceName = "Admin.Catalog",+ PermissionNames = new List<string> {+ PermissionSystemName.Products, PermissionSystemName.Categories, PermissionSystemName.Brands,+ PermissionSystemName.Collections, PermissionSystemName.ProductReviews,+ PermissionSystemName.ProductTags,+ PermissionSystemName.ProductAttributes, PermissionSystemName.SpecificationAttributes},- new () {- SystemName = "Catalog",- ResourceName = "Admin.Catalog",- PermissionNames = new List<string> { PermissionSystemName.Products, PermissionSystemName.Categories, PermissionSystemName.Brands, PermissionSystemName.Collections, PermissionSystemName.ProductReviews, PermissionSystemName.ProductTags,- PermissionSystemName.ProductAttributes, PermissionSystemName.SpecificationAttributes },- IconClass = "fa fa-sitemap",- DisplayOrder = 1,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Products",- ResourceName = "Admin.Catalog.Products.Manage",- PermissionNames = new List<string> { PermissionSystemName.Products },- ControllerName = "Product",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Categories",- ResourceName = "Admin.Catalog.Categories",- ControllerName = "Category",- PermissionNames = new List<string> { PermissionSystemName.Categories },- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Brands",- ResourceName = "Admin.Catalog.Brands",- ControllerName = "Brand",- PermissionNames = new List<string> { PermissionSystemName.Brands },- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Collections",- ResourceName = "Admin.Catalog.Collections",- PermissionNames = new List<string> { PermissionSystemName.Collections },- ControllerName = "Collection",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Product tags",- ResourceName = "Admin.Catalog.ProductTags",- PermissionNames = new List<string> { PermissionSystemName.ProductTags },- ControllerName = "ProductTags",- ActionName = "List",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Bulk edit products",- ResourceName = "Admin.Catalog.BulkEdit",- PermissionNames = new List<string> { PermissionSystemName.Products },- ControllerName = "Product",- ActionName = "BulkEdit",- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Product reviews",- ResourceName = "Admin.Catalog.ProductReviews",- PermissionNames = new List<string> { PermissionSystemName.ProductReviews },- ControllerName = "ProductReview",- ActionName = "List",- DisplayOrder = 6,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Products attributes",- ResourceName = "Admin.Catalog.Attributes.ProductAttributes",- ControllerName = "ProductAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.ProductAttributes },- DisplayOrder = 7,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Specification attributes",- ResourceName = "Admin.Catalog.Attributes.SpecificationAttributes",- ControllerName = "SpecificationAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.SpecificationAttributes },- DisplayOrder = 8,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "fa fa-sitemap",+ DisplayOrder = 1,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Products",+ ResourceName = "Admin.Catalog.Products.Manage",+ PermissionNames = new List<string> { PermissionSystemName.Products },+ ControllerName = "Product",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Categories",+ ResourceName = "Admin.Catalog.Categories",+ ControllerName = "Category",+ PermissionNames = new List<string> { PermissionSystemName.Categories },+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Brands",+ ResourceName = "Admin.Catalog.Brands",+ ControllerName = "Brand",+ PermissionNames = new List<string> { PermissionSystemName.Brands },+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Collections",+ ResourceName = "Admin.Catalog.Collections",+ PermissionNames = new List<string> { PermissionSystemName.Collections },+ ControllerName = "Collection",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Product tags",+ ResourceName = "Admin.Catalog.ProductTags",+ PermissionNames = new List<string> { PermissionSystemName.ProductTags },+ ControllerName = "ProductTags",+ ActionName = "List",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Bulk edit products",+ ResourceName = "Admin.Catalog.BulkEdit",+ PermissionNames = new List<string> { PermissionSystemName.Products },+ ControllerName = "Product",+ ActionName = "BulkEdit",+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Product reviews",+ ResourceName = "Admin.Catalog.ProductReviews",+ PermissionNames = new List<string> { PermissionSystemName.ProductReviews },+ ControllerName = "ProductReview",+ ActionName = "List",+ DisplayOrder = 6,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Products attributes",+ ResourceName = "Admin.Catalog.Attributes.ProductAttributes",+ ControllerName = "ProductAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.ProductAttributes },+ DisplayOrder = 7,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Specification attributes",+ ResourceName = "Admin.Catalog.Attributes.SpecificationAttributes",+ ControllerName = "SpecificationAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.SpecificationAttributes },+ DisplayOrder = 8,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Sales",+ ResourceName = "Admin.Sales",+ PermissionNames = new List<string> {+ PermissionSystemName.Orders, PermissionSystemName.Shipments,+ PermissionSystemName.MerchandiseReturns, PermissionSystemName.PaymentTransactions,+ PermissionSystemName.OrderTags,+ PermissionSystemName.OrderStatus, PermissionSystemName.CheckoutAttributes},- new () {- SystemName = "Sales",- ResourceName = "Admin.Sales",- PermissionNames = new List<string> { PermissionSystemName.Orders, PermissionSystemName.Shipments,- PermissionSystemName.MerchandiseReturns, PermissionSystemName.PaymentTransactions, PermissionSystemName.OrderTags,- PermissionSystemName.OrderStatus, PermissionSystemName.CheckoutAttributes },- IconClass = "icon-basket",- DisplayOrder = 2,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Orders",- ResourceName = "Admin.Orders",- PermissionNames = new List<string> { PermissionSystemName.Orders },- ControllerName = "Order",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Shipments",- ResourceName = "Admin.Orders.Shipments.List",- PermissionNames = new List<string> { PermissionSystemName.Shipments },- ControllerName = "Shipment",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Merchandise returns",- ResourceName = "Admin.Orders.MerchandiseReturns",- PermissionNames = new List<string> { PermissionSystemName.MerchandiseReturns },- ControllerName = "MerchandiseReturn",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Payment transaction",- ResourceName = "Admin.Orders.PaymentTransaction",- PermissionNames = new List<string> { PermissionSystemName.PaymentTransactions },- ControllerName = "PaymentTransaction",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "OrderTags",- ResourceName = "Admin.Orders.OrderTags",- PermissionNames = new List<string> { PermissionSystemName.OrderTags },- ControllerName = "OrderTags",- ActionName = "List",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Checkout attributes",- ResourceName = "Admin.Orders.CheckoutAttributes",- ControllerName = "CheckoutAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.CheckoutAttributes },- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Order status",- ResourceName = "Admin.Orders.OrderStatus",- ControllerName = "OrderStatus",- PermissionNames = new List<string> { PermissionSystemName.OrderStatus },- ActionName = "Index",- DisplayOrder = 6,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-basket",+ DisplayOrder = 2,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Orders",+ ResourceName = "Admin.Orders",+ PermissionNames = new List<string> { PermissionSystemName.Orders },+ ControllerName = "Order",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Shipments",+ ResourceName = "Admin.Orders.Shipments.List",+ PermissionNames = new List<string> { PermissionSystemName.Shipments },+ ControllerName = "Shipment",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Merchandise returns",+ ResourceName = "Admin.Orders.MerchandiseReturns",+ PermissionNames = new List<string> { PermissionSystemName.MerchandiseReturns },+ ControllerName = "MerchandiseReturn",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Payment transaction",+ ResourceName = "Admin.Orders.PaymentTransaction",+ PermissionNames = new List<string> { PermissionSystemName.PaymentTransactions },+ ControllerName = "PaymentTransaction",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "OrderTags",+ ResourceName = "Admin.Orders.OrderTags",+ PermissionNames = new List<string> { PermissionSystemName.OrderTags },+ ControllerName = "OrderTags",+ ActionName = "List",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Checkout attributes",+ ResourceName = "Admin.Orders.CheckoutAttributes",+ ControllerName = "CheckoutAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.CheckoutAttributes },+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Order status",+ ResourceName = "Admin.Orders.OrderStatus",+ ControllerName = "OrderStatus",+ PermissionNames = new List<string> { PermissionSystemName.OrderStatus },+ ActionName = "Index",+ DisplayOrder = 6,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Customers",+ ResourceName = "Admin.Customers",+ PermissionNames = new List<string> {+ PermissionSystemName.Customers, PermissionSystemName.Vendors, PermissionSystemName.VendorReviews,+ PermissionSystemName.CustomerTags, PermissionSystemName.CustomerGroups,+ PermissionSystemName.SalesEmployees},- new () {- SystemName = "Customers",- ResourceName = "Admin.Customers",- PermissionNames = new List<string> { PermissionSystemName.Customers, PermissionSystemName.Vendors, PermissionSystemName.VendorReviews,- PermissionSystemName.CustomerTags, PermissionSystemName.CustomerGroups, PermissionSystemName.SalesEmployees },- IconClass = "icon-users",- DisplayOrder = 3,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Customers",- ResourceName = "Admin.Customers.Customers",- PermissionNames = new List<string> { PermissionSystemName.Customers },- ControllerName = "Customer",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Customer groups",- ResourceName = "Admin.Customers.CustomerGroups",- PermissionNames = new List<string> { PermissionSystemName.CustomerGroups },- ControllerName = "CustomerGroup",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Customer tags",- ResourceName = "Admin.Customers.CustomerTags",- PermissionNames = new List<string> { PermissionSystemName.CustomerTags },- ControllerName = "CustomerTag",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Vendors",- ResourceName = "Admin.Vendors",- PermissionNames = new List<string> { PermissionSystemName.Vendors },- ControllerName = "Vendor",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Vendor reviews",- ResourceName = "Admin.VendorReviews",- PermissionNames = new List<string> { PermissionSystemName.VendorReviews },- ControllerName = "VendorReview",- ActionName = "List",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Sales employee",- ResourceName = "Admin.Customers.SalesEmployees",- PermissionNames = new List<string> { PermissionSystemName.SalesEmployees },- ControllerName = "SalesEmployee",- ActionName = "Index",- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Customer attributes",- ResourceName = "Admin.Customers.Attributes.Customer",- ControllerName = "CustomerAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.CustomerAttributes },- DisplayOrder = 6,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Address attributes",- ResourceName = "Admin.Customers.Attributes.Address",- ControllerName = "AddressAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.AddressAttributes },- DisplayOrder = 7,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-users",+ DisplayOrder = 3,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Customers",+ ResourceName = "Admin.Customers.Customers",+ PermissionNames = new List<string> { PermissionSystemName.Customers },+ ControllerName = "Customer",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Customer groups",+ ResourceName = "Admin.Customers.CustomerGroups",+ PermissionNames = new List<string> { PermissionSystemName.CustomerGroups },+ ControllerName = "CustomerGroup",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Customer tags",+ ResourceName = "Admin.Customers.CustomerTags",+ PermissionNames = new List<string> { PermissionSystemName.CustomerTags },+ ControllerName = "CustomerTag",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Vendors",+ ResourceName = "Admin.Vendors",+ PermissionNames = new List<string> { PermissionSystemName.Vendors },+ ControllerName = "Vendor",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Vendor reviews",+ ResourceName = "Admin.VendorReviews",+ PermissionNames = new List<string> { PermissionSystemName.VendorReviews },+ ControllerName = "VendorReview",+ ActionName = "List",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Sales employee",+ ResourceName = "Admin.Customers.SalesEmployees",+ PermissionNames = new List<string> { PermissionSystemName.SalesEmployees },+ ControllerName = "SalesEmployee",+ ActionName = "Index",+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Customer attributes",+ ResourceName = "Admin.Customers.Attributes.Customer",+ ControllerName = "CustomerAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.CustomerAttributes },+ DisplayOrder = 6,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Address attributes",+ ResourceName = "Admin.Customers.Attributes.Address",+ ControllerName = "AddressAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.AddressAttributes },+ DisplayOrder = 7,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Marketing",+ ResourceName = "Admin.Marketing",+ PermissionNames = new List<string> {+ PermissionSystemName.Affiliates, PermissionSystemName.NewsletterCategories,+ PermissionSystemName.NewsletterSubscribers,+ PermissionSystemName.Campaigns, PermissionSystemName.Discounts,+ PermissionSystemName.PushNotifications,+ PermissionSystemName.Affiliates, PermissionSystemName.Documents, PermissionSystemName.GiftVouchers,+ PermissionSystemName.ContactAttributes},- new () {- SystemName = "Marketing",- ResourceName = "Admin.Marketing",- PermissionNames = new List<string> { PermissionSystemName.Affiliates, PermissionSystemName.NewsletterCategories, PermissionSystemName.NewsletterSubscribers,- PermissionSystemName.Campaigns, PermissionSystemName.Discounts, PermissionSystemName.PushNotifications,- PermissionSystemName.Affiliates, PermissionSystemName.Documents, PermissionSystemName.GiftVouchers,- PermissionSystemName.ContactAttributes},- IconClass = "icon-bulb",- DisplayOrder = 4,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Discounts",- ResourceName = "Admin.Marketing.Discounts",- PermissionNames = new List<string> { PermissionSystemName.Discounts },- ControllerName = "Discount",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Gift vouchers",- ResourceName = "Admin.GiftVouchers",- PermissionNames = new List<string> { PermissionSystemName.GiftVouchers },- ControllerName = "GiftVoucher",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Affiliates",- ResourceName = "Admin.Affiliates",- PermissionNames = new List<string> { PermissionSystemName.Affiliates },- ControllerName = "Affiliate",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Contact attributes",- ResourceName = "Admin.Catalog.Attributes.ContactAttributes",- ControllerName = "ContactAttribute",- ActionName = "List",- PermissionNames = new List<string> { PermissionSystemName.ContactAttributes },- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Newsletter",- ResourceName = "Admin.Marketing.Newsletter",- PermissionNames = new List<string> { PermissionSystemName.Campaigns, PermissionSystemName.NewsletterSubscribers },- IconClass = "fa fa-dot-circle-o",- DisplayOrder = 5,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Campaigns",- ResourceName = "Admin.Marketing.Campaigns",- PermissionNames = new List<string> { PermissionSystemName.Campaigns },- ControllerName = "Campaign",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Newsletter categories",- ResourceName = "Admin.Marketing.NewsletterCategory",- PermissionNames = new List<string> { PermissionSystemName.NewsletterCategories },- ControllerName = "NewsletterCategory",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Newsletter subscriptions",- ResourceName = "Admin.Marketing.NewsletterSubscriptions",- PermissionNames = new List<string> { PermissionSystemName.NewsletterSubscribers },- ControllerName = "NewsLetterSubscription",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-bulb",+ DisplayOrder = 4,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Discounts",+ ResourceName = "Admin.Marketing.Discounts",+ PermissionNames = new List<string> { PermissionSystemName.Discounts },+ ControllerName = "Discount",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Gift vouchers",+ ResourceName = "Admin.GiftVouchers",+ PermissionNames = new List<string> { PermissionSystemName.GiftVouchers },+ ControllerName = "GiftVoucher",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Affiliates",+ ResourceName = "Admin.Affiliates",+ PermissionNames = new List<string> { PermissionSystemName.Affiliates },+ ControllerName = "Affiliate",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Contact attributes",+ ResourceName = "Admin.Catalog.Attributes.ContactAttributes",+ ControllerName = "ContactAttribute",+ ActionName = "List",+ PermissionNames = new List<string> { PermissionSystemName.ContactAttributes },+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Newsletter",+ ResourceName = "Admin.Marketing.Newsletter",+ PermissionNames = new List<string>+ { PermissionSystemName.Campaigns, PermissionSystemName.NewsletterSubscribers },+ IconClass = "fa fa-dot-circle-o",+ DisplayOrder = 5,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Campaigns",+ ResourceName = "Admin.Marketing.Campaigns",+ PermissionNames = new List<string> { PermissionSystemName.Campaigns },+ ControllerName = "Campaign",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Newsletter categories",+ ResourceName = "Admin.Marketing.NewsletterCategory",+ PermissionNames = new List<string> { PermissionSystemName.NewsletterCategories },+ ControllerName = "NewsletterCategory",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Newsletter subscriptions",+ ResourceName = "Admin.Marketing.NewsletterSubscriptions",+ PermissionNames = new List<string> { PermissionSystemName.NewsletterSubscribers },+ ControllerName = "NewsLetterSubscription",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "PushNotifications",- ResourceName = "Admin.PushNotifications",- PermissionNames = new List<string> { PermissionSystemName.PushNotifications },- ControllerName = "PushNotifications",- IconClass = "fa fa-dot-circle-o",- DisplayOrder = 7,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "PushNotifications",- ResourceName = "Admin.PushNotifications.Send",- PermissionNames = new List<string> { PermissionSystemName.PushNotifications },- ControllerName = "PushNotifications",- ActionName = "Send",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "PushNotifications",- ResourceName = "Admin.PushNotifications.Messages",- PermissionNames = new List<string> { PermissionSystemName.PushNotifications },- ControllerName = "PushNotifications",- ActionName = "Messages",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "PushNotifications",- ResourceName = "Admin.PushNotifications.Receivers",- PermissionNames = new List<string> { PermissionSystemName.PushNotifications },- ControllerName = "PushNotifications",- ActionName = "Receivers",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "PushNotifications",+ ResourceName = "Admin.PushNotifications",+ PermissionNames = new List<string> { PermissionSystemName.PushNotifications },+ ControllerName = "PushNotifications",+ IconClass = "fa fa-dot-circle-o",+ DisplayOrder = 7,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "PushNotifications",+ ResourceName = "Admin.PushNotifications.Send",+ PermissionNames = new List<string> { PermissionSystemName.PushNotifications },+ ControllerName = "PushNotifications",+ ActionName = "Send",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "PushNotifications",+ ResourceName = "Admin.PushNotifications.Messages",+ PermissionNames = new List<string> { PermissionSystemName.PushNotifications },+ ControllerName = "PushNotifications",+ ActionName = "Messages",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "PushNotifications",+ ResourceName = "Admin.PushNotifications.Receivers",+ PermissionNames = new List<string> { PermissionSystemName.PushNotifications },+ ControllerName = "PushNotifications",+ ActionName = "Receivers",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "Documents",- ResourceName = "Admin.Marketing.Documents",- PermissionNames = new List<string> { PermissionSystemName.Documents },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 8,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Document types",- ResourceName = "Admin.Marketing.Document.Type",- ControllerName = "Document",- ActionName = "Types",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Document list",- ResourceName = "Admin.Marketing.Document.List",- ControllerName = "Document",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "Documents",+ ResourceName = "Admin.Marketing.Documents",+ PermissionNames = new List<string> { PermissionSystemName.Documents },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 8,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Document types",+ ResourceName = "Admin.Marketing.Document.Type",+ ControllerName = "Document",+ ActionName = "Types",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Document list",+ ResourceName = "Admin.Marketing.Document.List",+ ControllerName = "Document",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"}}}+ }+ },++ new() {+ SystemName = "Content",+ ResourceName = "Admin.Content",+ PermissionNames = new List<string> {+ PermissionSystemName.News, PermissionSystemName.Blog,+ PermissionSystemName.Pages, PermissionSystemName.MessageTemplates,+ PermissionSystemName.Knowledgebase, PermissionSystemName.Courses},- new () {- SystemName = "Content",- ResourceName = "Admin.Content",- PermissionNames = new List<string> { PermissionSystemName.News, PermissionSystemName.Blog,- PermissionSystemName.Pages, PermissionSystemName.MessageTemplates,- PermissionSystemName.Knowledgebase, PermissionSystemName.Courses },- IconClass = "icon-layers",- DisplayOrder = 5,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Pages",- ResourceName = "Admin.Content.Pages",- PermissionNames = new List<string> { PermissionSystemName.Pages },- ControllerName = "Page",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Message templates",- ResourceName = "Admin.Content.MessageTemplates",- PermissionNames = new List<string> { PermissionSystemName.MessageTemplates },- ControllerName = "MessageTemplate",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Knowledgebase",- ResourceName = "Admin.Content.Knowledgebase",- PermissionNames = new List<string> { PermissionSystemName.Knowledgebase },- ControllerName = "Knowledgebase",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "News",- ResourceName = "Admin.Content.News",- PermissionNames = new List<string> { PermissionSystemName.News },- ControllerName = "News",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Blog",- ResourceName = "Admin.Content.Blog",- PermissionNames = new List<string> { PermissionSystemName.Blog },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 4,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Blog categories",- ResourceName = "Admin.Content.Blog.BlogCategories",- ControllerName = "Blog",- ActionName = "CategoryList",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Blog posts",- ResourceName = "Admin.Content.Blog.BlogPosts",- ControllerName = "Blog",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Blog comments",- ResourceName = "Admin.Content.Blog.Comments",- ControllerName = "Blog",- ActionName = "Comments",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-layers",+ DisplayOrder = 5,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Pages",+ ResourceName = "Admin.Content.Pages",+ PermissionNames = new List<string> { PermissionSystemName.Pages },+ ControllerName = "Page",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Message templates",+ ResourceName = "Admin.Content.MessageTemplates",+ PermissionNames = new List<string> { PermissionSystemName.MessageTemplates },+ ControllerName = "MessageTemplate",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Knowledgebase",+ ResourceName = "Admin.Content.Knowledgebase",+ PermissionNames = new List<string> { PermissionSystemName.Knowledgebase },+ ControllerName = "Knowledgebase",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "News",+ ResourceName = "Admin.Content.News",+ PermissionNames = new List<string> { PermissionSystemName.News },+ ControllerName = "News",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Blog",+ ResourceName = "Admin.Content.Blog",+ PermissionNames = new List<string> { PermissionSystemName.Blog },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 4,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Blog categories",+ ResourceName = "Admin.Content.Blog.BlogCategories",+ ControllerName = "Blog",+ ActionName = "CategoryList",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Blog posts",+ ResourceName = "Admin.Content.Blog.BlogPosts",+ ControllerName = "Blog",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Blog comments",+ ResourceName = "Admin.Content.Blog.Comments",+ ControllerName = "Blog",+ ActionName = "Comments",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "Course",- ResourceName = "Admin.Content.Course",- PermissionNames = new List<string> { PermissionSystemName.Courses },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 5,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Course level",- ResourceName = "Admin.Content.Course.Level",- ControllerName = "Course",- ActionName = "Level",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Manage courses",- ResourceName = "Admin.Content.Course.Manage",- ControllerName = "Course",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "Course",+ ResourceName = "Admin.Content.Course",+ PermissionNames = new List<string> { PermissionSystemName.Courses },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 5,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Course level",+ ResourceName = "Admin.Content.Course.Level",+ ControllerName = "Course",+ ActionName = "Level",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Manage courses",+ ResourceName = "Admin.Content.Course.Manage",+ ControllerName = "Course",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"}}}- },- new () {- SystemName = "Reports",- ResourceName = "Admin.Reports",- PermissionNames = new List<string> { PermissionSystemName.Reports },- IconClass = "icon-bar-chart",- DisplayOrder = 6,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Low stock report",- ResourceName = "Admin.Reports.LowStockReport",- PermissionNames = new List<string> { PermissionSystemName.Reports },- ControllerName = "Reports",- ActionName = "LowStockReport",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Bestsellers",- ResourceName = "Admin.Reports.Bestsellers",- PermissionNames = new List<string> { PermissionSystemName.Reports },- ControllerName = "Reports",- ActionName = "BestsellersReport",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Products never purchased",- ResourceName = "Admin.Reports.NeverSold",- PermissionNames = new List<string> { PermissionSystemName.Reports },- ControllerName = "Reports",- ActionName = "NeverSoldReport",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Country report",- ResourceName = "Admin.Reports.Country",- PermissionNames = new List<string> { PermissionSystemName.Reports },- AllPermissions = true,- ControllerName = "Reports",- ActionName = "CountryReport",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Customer reports",- ResourceName = "Admin.Reports.Customers",- PermissionNames = new List<string> { PermissionSystemName.Reports },- AllPermissions = true,- ControllerName = "Reports",- ActionName = "Customer",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- }+ }+ },++ new() {+ SystemName = "Reports",+ ResourceName = "Admin.Reports",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ IconClass = "icon-bar-chart",+ DisplayOrder = 6,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Low stock report",+ ResourceName = "Admin.Reports.LowStockReport",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ ControllerName = "Reports",+ ActionName = "LowStockReport",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Bestsellers",+ ResourceName = "Admin.Reports.Bestsellers",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ ControllerName = "Reports",+ ActionName = "BestsellersReport",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Products never purchased",+ ResourceName = "Admin.Reports.NeverSold",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ ControllerName = "Reports",+ ActionName = "NeverSoldReport",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Country report",+ ResourceName = "Admin.Reports.Country",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ AllPermissions = true,+ ControllerName = "Reports",+ ActionName = "CountryReport",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Customer reports",+ ResourceName = "Admin.Reports.Customers",+ PermissionNames = new List<string> { PermissionSystemName.Reports },+ AllPermissions = true,+ ControllerName = "Reports",+ ActionName = "Customer",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Configuration",+ ResourceName = "Admin.Configuration",+ PermissionNames = new List<string> {+ PermissionSystemName.Countries, PermissionSystemName.Languages, PermissionSystemName.Settings,+ PermissionSystemName.PaymentMethods, PermissionSystemName.ExternalAuthenticationMethods,+ PermissionSystemName.TaxSettings, PermissionSystemName.ShippingSettings,+ PermissionSystemName.Currencies, PermissionSystemName.Measures,+ PermissionSystemName.Acl, PermissionSystemName.EmailAccounts, PermissionSystemName.Plugins,+ PermissionSystemName.Widgets, PermissionSystemName.Stores, PermissionSystemName.Maintenance},- new () {- SystemName = "Configuration",- ResourceName = "Admin.Configuration",- PermissionNames = new List<string> { PermissionSystemName.Countries, PermissionSystemName.Languages, PermissionSystemName.Settings,- PermissionSystemName.PaymentMethods, PermissionSystemName.ExternalAuthenticationMethods,- PermissionSystemName.TaxSettings, PermissionSystemName.ShippingSettings, PermissionSystemName.Currencies, PermissionSystemName.Measures,- PermissionSystemName.Acl, PermissionSystemName.EmailAccounts, PermissionSystemName.Plugins, PermissionSystemName.Widgets, PermissionSystemName.Stores, PermissionSystemName.Maintenance },- IconClass = "icon-settings",- DisplayOrder = 7,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Stores",- ResourceName = "Admin.Configuration.Stores",- PermissionNames = new List<string> { PermissionSystemName.Stores },- ControllerName = "Store",- ActionName = "List",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Permissions",- ResourceName = "Admin.Configuration.Permissions",- PermissionNames = new List<string> { PermissionSystemName.Acl },- ControllerName = "Permission",- ActionName = "Index",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "EmailAccounts",- ResourceName = "Admin.Configuration.EmailAccounts",- PermissionNames = new List<string> { PermissionSystemName.EmailAccounts },- ControllerName = "EmailAccount",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Languages",- ResourceName = "Admin.Configuration.Languages",- PermissionNames = new List<string> { PermissionSystemName.Languages },- ControllerName = "Language",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Currencies",- ResourceName = "Admin.Configuration.Currencies",- PermissionNames = new List<string> { PermissionSystemName.Currencies },- ControllerName = "Currency",- ActionName = "List",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Countries",- ResourceName = "Admin.Configuration.Countries",- PermissionNames = new List<string> { PermissionSystemName.Countries },- ControllerName = "Country",- ActionName = "List",- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Search engine friendly names",- ResourceName = "Admin.Configuration.SeNames",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Maintenance",- ActionName = "SeNames",- DisplayOrder = 6,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Admin menu",- ResourceName = "Admin.Configuration.Menu",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Menu",- ActionName = "Index",- DisplayOrder = 7,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Payment",- ResourceName = "Admin.Configuration.Payment",- PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 8,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Payment methods",- ResourceName = "Admin.Configuration.Payment.Methods",- PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },- ControllerName = "Payment",- ActionName = "Index",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Payment settings",- ResourceName = "Admin.Configuration.Payment.Settings",- PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },- ControllerName = "Payment",- ActionName = "Settings",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Payment method restrictions",- ResourceName = "Admin.Configuration.Payment.MethodRestrictions",- PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },- ControllerName = "Payment",- ActionName = "MethodRestrictions",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-settings",+ DisplayOrder = 7,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Stores",+ ResourceName = "Admin.Configuration.Stores",+ PermissionNames = new List<string> { PermissionSystemName.Stores },+ ControllerName = "Store",+ ActionName = "List",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Permissions",+ ResourceName = "Admin.Configuration.Permissions",+ PermissionNames = new List<string> { PermissionSystemName.Acl },+ ControllerName = "Permission",+ ActionName = "Index",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "EmailAccounts",+ ResourceName = "Admin.Configuration.EmailAccounts",+ PermissionNames = new List<string> { PermissionSystemName.EmailAccounts },+ ControllerName = "EmailAccount",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Languages",+ ResourceName = "Admin.Configuration.Languages",+ PermissionNames = new List<string> { PermissionSystemName.Languages },+ ControllerName = "Language",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Currencies",+ ResourceName = "Admin.Configuration.Currencies",+ PermissionNames = new List<string> { PermissionSystemName.Currencies },+ ControllerName = "Currency",+ ActionName = "List",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Countries",+ ResourceName = "Admin.Configuration.Countries",+ PermissionNames = new List<string> { PermissionSystemName.Countries },+ ControllerName = "Country",+ ActionName = "List",+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Search engine friendly names",+ ResourceName = "Admin.Configuration.SeNames",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Maintenance",+ ActionName = "SeNames",+ DisplayOrder = 6,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Admin menu",+ ResourceName = "Admin.Configuration.Menu",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Menu",+ ActionName = "Index",+ DisplayOrder = 7,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Payment",+ ResourceName = "Admin.Configuration.Payment",+ PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 8,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Payment methods",+ ResourceName = "Admin.Configuration.Payment.Methods",+ PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },+ ControllerName = "Payment",+ ActionName = "Index",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Payment settings",+ ResourceName = "Admin.Configuration.Payment.Settings",+ PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },+ ControllerName = "Payment",+ ActionName = "Settings",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Payment method restrictions",+ ResourceName = "Admin.Configuration.Payment.MethodRestrictions",+ PermissionNames = new List<string> { PermissionSystemName.PaymentMethods },+ ControllerName = "Payment",+ ActionName = "MethodRestrictions",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "Shipping",- ResourceName = "Admin.Configuration.Shipping",- PermissionNames = new List<string> { PermissionSystemName.ShippingSettings },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 9,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Shipping providers",- ResourceName = "Admin.Configuration.Shipping.Providers",- ControllerName = "Shipping",- ActionName = "Providers",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Shipping methods",- ResourceName = "Admin.Configuration.Shipping.Methods",- ControllerName = "Shipping",- ActionName = "Methods",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Shipping method restrictions",- ResourceName = "Admin.Configuration.Shipping.Restrictions",- ControllerName = "Shipping",- ActionName = "Restrictions",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Shipping settings",- ResourceName = "Admin.Configuration.Shipping.Settings",- ControllerName = "Shipping",- ActionName = "Settings",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Measures",- ResourceName = "Admin.Configuration.Measures",- PermissionNames = new List<string> { PermissionSystemName.Measures },- ControllerName = "Measure",- DisplayOrder = 4,- ActionName = "Index",- IconClass = "fa fa-arrow-circle-o-right"- },- new () {- SystemName = "Delivery dates",- ResourceName = "Admin.Configuration.Shipping.DeliveryDates",- ControllerName = "Shipping",- DisplayOrder = 5,- ActionName = "DeliveryDates",- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Warehouses",- ResourceName = "Admin.Configuration.Shipping.Warehouses",- ControllerName = "Shipping",- DisplayOrder = 6,- ActionName = "Warehouses",- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "PickupPoints",- ResourceName = "Admin.Configuration.Shipping.PickupPoints",- ControllerName = "Shipping",- DisplayOrder = 7,- ActionName = "PickupPoints",- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "Shipping",+ ResourceName = "Admin.Configuration.Shipping",+ PermissionNames = new List<string> { PermissionSystemName.ShippingSettings },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 9,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Shipping providers",+ ResourceName = "Admin.Configuration.Shipping.Providers",+ ControllerName = "Shipping",+ ActionName = "Providers",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Shipping methods",+ ResourceName = "Admin.Configuration.Shipping.Methods",+ ControllerName = "Shipping",+ ActionName = "Methods",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Shipping method restrictions",+ ResourceName = "Admin.Configuration.Shipping.Restrictions",+ ControllerName = "Shipping",+ ActionName = "Restrictions",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Shipping settings",+ ResourceName = "Admin.Configuration.Shipping.Settings",+ ControllerName = "Shipping",+ ActionName = "Settings",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Measures",+ ResourceName = "Admin.Configuration.Measures",+ PermissionNames = new List<string> { PermissionSystemName.Measures },+ ControllerName = "Measure",+ DisplayOrder = 4,+ ActionName = "Index",+ IconClass = "fa fa-arrow-circle-o-right"+ },+ new() {+ SystemName = "Delivery dates",+ ResourceName = "Admin.Configuration.Shipping.DeliveryDates",+ ControllerName = "Shipping",+ DisplayOrder = 5,+ ActionName = "DeliveryDates",+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Warehouses",+ ResourceName = "Admin.Configuration.Shipping.Warehouses",+ ControllerName = "Shipping",+ DisplayOrder = 6,+ ActionName = "Warehouses",+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "PickupPoints",+ ResourceName = "Admin.Configuration.Shipping.PickupPoints",+ ControllerName = "Shipping",+ DisplayOrder = 7,+ ActionName = "PickupPoints",+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "Tax",- ResourceName = "Admin.Configuration.Tax",- PermissionNames = new List<string> { PermissionSystemName.TaxSettings },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 10,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Tax providers",- ResourceName = "Admin.Configuration.Tax.Providers",- ControllerName = "Tax",- ActionName = "Providers",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Tax categories",- ResourceName = "Admin.Configuration.Tax.Categories",- ControllerName = "Tax",- ActionName = "Categories",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Tax settings",- ResourceName = "Admin.Configuration.Tax.Settings",- ControllerName = "Tax",- ActionName = "Settings",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "Tax",+ ResourceName = "Admin.Configuration.Tax",+ PermissionNames = new List<string> { PermissionSystemName.TaxSettings },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 10,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Tax providers",+ ResourceName = "Admin.Configuration.Tax.Providers",+ ControllerName = "Tax",+ ActionName = "Providers",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Tax categories",+ ResourceName = "Admin.Configuration.Tax.Categories",+ ControllerName = "Tax",+ ActionName = "Categories",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Tax settings",+ ResourceName = "Admin.Configuration.Tax.Settings",+ ControllerName = "Tax",+ ActionName = "Settings",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}- },- new () {- SystemName = "Templates",- ResourceName = "Admin.Configuration.Layouts",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- IconClass = "fa fa-arrow-circle-o-right",- DisplayOrder = 11,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Category layouts",- ResourceName = "Admin.Configuration.Layouts.Category",- ControllerName = "Layout",- ActionName = "CategoryLayouts",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Brand layouts",- ResourceName = "Admin.Configuration.Layouts.Brand",- ControllerName = "Layout",- ActionName = "BrandLayouts",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Collection layouts",- ResourceName = "Admin.Configuration.Layouts.Collection",- ControllerName = "Layout",- ActionName = "CollectionLayouts",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Product layouts",- ResourceName = "Admin.Configuration.Layouts.Product",- ControllerName = "Layout",- ActionName = "ProductLayouts",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Page layouts",- ResourceName = "Admin.Configuration.Layouts.Page",- ControllerName = "Layout",- ActionName = "PageLayouts",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- }+ }+ },+ new() {+ SystemName = "Templates",+ ResourceName = "Admin.Configuration.Layouts",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ IconClass = "fa fa-arrow-circle-o-right",+ DisplayOrder = 11,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Category layouts",+ ResourceName = "Admin.Configuration.Layouts.Category",+ ControllerName = "Layout",+ ActionName = "CategoryLayouts",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Brand layouts",+ ResourceName = "Admin.Configuration.Layouts.Brand",+ ControllerName = "Layout",+ ActionName = "BrandLayouts",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Collection layouts",+ ResourceName = "Admin.Configuration.Layouts.Collection",+ ControllerName = "Layout",+ ActionName = "CollectionLayouts",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Product layouts",+ ResourceName = "Admin.Configuration.Layouts.Product",+ ControllerName = "Layout",+ ActionName = "ProductLayouts",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Page layouts",+ ResourceName = "Admin.Configuration.Layouts.Page",+ ControllerName = "Layout",+ ActionName = "PageLayouts",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"}}}- },- new () {- SystemName = "Settings",- PermissionNames = new List<string> { PermissionSystemName.Settings },- ResourceName = "Admin.Settings",- IconClass = "icon-wrench",- DisplayOrder = 8,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "General and common settings",- ResourceName = "Admin.Settings.GeneralCommon",- ControllerName = "Setting",- ActionName = "GeneralCommon",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Catalog settings",- ResourceName = "Admin.Settings.Catalog",- ControllerName = "Setting",- ActionName = "Catalog",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Customer settings",- ResourceName = "Admin.Settings.Customer",- ControllerName = "Setting",- ActionName = "Customer",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Sales settings",- ResourceName = "Admin.Settings.Sales",- ControllerName = "Setting",- ActionName = "Sales",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Media settings",- ResourceName = "Admin.Settings.Media",- ControllerName = "Setting",- ActionName = "Media",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Content settings",- ResourceName = "Admin.Settings.Content",- ControllerName = "Setting",- ActionName = "Content",- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Vendor settings",- ResourceName = "Admin.Settings.Vendor",- ControllerName = "Setting",- ActionName = "Vendor",- DisplayOrder = 6,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Push notifications settings",- ResourceName = "Admin.Settings.PushNotifications",- ControllerName = "Setting",- ActionName = "PushNotifications",- DisplayOrder = 7,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Admin search settings",- ResourceName = "Admin.Settings.AdminSearch",- ControllerName = "Setting",- ActionName = "AdminSearch",- DisplayOrder = 8,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "System settings",- ResourceName = "Admin.Settings.System",- ControllerName = "Setting",- ActionName = "SystemSetting",- DisplayOrder = 9,- IconClass = "fa fa-dot-circle-o"- }+ }+ },++ new() {+ SystemName = "Settings",+ PermissionNames = new List<string> { PermissionSystemName.Settings },+ ResourceName = "Admin.Settings",+ IconClass = "icon-wrench",+ DisplayOrder = 8,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "General and common settings",+ ResourceName = "Admin.Settings.GeneralCommon",+ ControllerName = "Setting",+ ActionName = "GeneralCommon",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Catalog settings",+ ResourceName = "Admin.Settings.Catalog",+ ControllerName = "Setting",+ ActionName = "Catalog",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Customer settings",+ ResourceName = "Admin.Settings.Customer",+ ControllerName = "Setting",+ ActionName = "Customer",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Sales settings",+ ResourceName = "Admin.Settings.Sales",+ ControllerName = "Setting",+ ActionName = "Sales",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Media settings",+ ResourceName = "Admin.Settings.Media",+ ControllerName = "Setting",+ ActionName = "Media",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Content settings",+ ResourceName = "Admin.Settings.Content",+ ControllerName = "Setting",+ ActionName = "Content",+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Vendor settings",+ ResourceName = "Admin.Settings.Vendor",+ ControllerName = "Setting",+ ActionName = "Vendor",+ DisplayOrder = 6,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Push notifications settings",+ ResourceName = "Admin.Settings.PushNotifications",+ ControllerName = "Setting",+ ActionName = "PushNotifications",+ DisplayOrder = 7,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Admin search settings",+ ResourceName = "Admin.Settings.AdminSearch",+ ControllerName = "Setting",+ ActionName = "AdminSearch",+ DisplayOrder = 8,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "System settings",+ ResourceName = "Admin.Settings.System",+ ControllerName = "Setting",+ ActionName = "SystemSetting",+ DisplayOrder = 9,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "Plugins",+ ResourceName = "Admin.Plugins",+ PermissionNames = new List<string> {+ PermissionSystemName.Plugins, PermissionSystemName.Widgets,+ PermissionSystemName.ExternalAuthenticationMethods},- new () {- SystemName = "Plugins",- ResourceName = "Admin.Plugins",- PermissionNames = new List<string> { PermissionSystemName.Plugins, PermissionSystemName.Widgets, PermissionSystemName.ExternalAuthenticationMethods},- IconClass = "icon-puzzle",- DisplayOrder = 9,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "External authentication methods",- ResourceName = "Admin.Plugins.ExternalAuthenticationMethods",- PermissionNames = new List<string> { PermissionSystemName.ExternalAuthenticationMethods },- ControllerName = "ExternalAuthentication",- ActionName = "Methods",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Widgets",- ResourceName = "Admin.Plugins.Widgets",- PermissionNames = new List<string> { PermissionSystemName.Widgets },- ControllerName = "Widget",- ActionName = "List",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Local plugins",- ResourceName = "Admin.Plugins.Local",- PermissionNames = new List<string> { PermissionSystemName.Plugins },- ControllerName = "Plugin",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-puzzle",+ DisplayOrder = 9,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "External authentication methods",+ ResourceName = "Admin.Plugins.ExternalAuthenticationMethods",+ PermissionNames = new List<string> { PermissionSystemName.ExternalAuthenticationMethods },+ ControllerName = "ExternalAuthentication",+ ActionName = "Methods",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Widgets",+ ResourceName = "Admin.Plugins.Widgets",+ PermissionNames = new List<string> { PermissionSystemName.Widgets },+ ControllerName = "Widget",+ ActionName = "List",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Local plugins",+ ResourceName = "Admin.Plugins.Local",+ PermissionNames = new List<string> { PermissionSystemName.Plugins },+ ControllerName = "Plugin",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"}+ }+ },++ new() {+ SystemName = "System",+ ResourceName = "Admin.System",+ PermissionNames = new List<string> {+ PermissionSystemName.MessageQueue, PermissionSystemName.MessageContactForm,+ PermissionSystemName.Maintenance, PermissionSystemName.ScheduleTasks, PermissionSystemName.System},- new () {- SystemName = "System",- ResourceName = "Admin.System",- PermissionNames = new List<string> { PermissionSystemName.MessageQueue, PermissionSystemName.MessageContactForm,- PermissionSystemName.Maintenance, PermissionSystemName.ScheduleTasks, PermissionSystemName.System },- IconClass = "icon-info",- DisplayOrder = 10,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "System information",- ResourceName = "Admin.System.SystemInfo",- PermissionNames = new List<string> { PermissionSystemName.System },- ControllerName = "System",- ActionName = "SystemInfo",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Queued emails",- ResourceName = "Admin.System.QueuedEmails",- PermissionNames = new List<string> { PermissionSystemName.MessageQueue },- ControllerName = "QueuedEmail",- ActionName = "List",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Contact Us form",- ResourceName = "Admin.System.ContactForm",- PermissionNames = new List<string> { PermissionSystemName.MessageContactForm },- ControllerName = "ContactForm",- ActionName = "List",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Maintenance",- ResourceName = "Admin.System.Maintenance",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Maintenance",- ActionName = "Maintenance",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Schedule tasks",- ResourceName = "Admin.System.ScheduleTasks",- PermissionNames = new List<string> { PermissionSystemName.ScheduleTasks },- ControllerName = "ScheduleTask",- ActionName = "List",- DisplayOrder = 5,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Developer tools",- ResourceName = "Admin.System.DeveloperTools",- PermissionNames = new List<string> { PermissionSystemName.Maintenance, PermissionSystemName.System },- IconClass = "fa fa-dot-circle-o",- DisplayOrder = 6,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Manage API Users",- ResourceName = "Admin.System.APIUsers",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "ApiUser",- ActionName = "Index",- DisplayOrder = 0,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Roslyn compiler",- ResourceName = "Admin.System.Roslyn",- PermissionNames = new List<string> { PermissionSystemName.System },- ControllerName = "System",- ActionName = "Roslyn",- DisplayOrder = 1,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Custom css",- ResourceName = "Admin.System.CustomCss",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Maintenance",- ActionName = "CustomCss",- DisplayOrder = 2,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Custom JS",- ResourceName = "Admin.System.CustomJs",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Maintenance",- ActionName = "CustomJs",- DisplayOrder = 3,- IconClass = "fa fa-dot-circle-o"- },- new () {- SystemName = "Robot.txt",- ResourceName = "Admin.System.RobotsTxt",- PermissionNames = new List<string> { PermissionSystemName.Maintenance },- ControllerName = "Maintenance",- ActionName = "RobotsTxt",- DisplayOrder = 4,- IconClass = "fa fa-dot-circle-o"- }+ IconClass = "icon-info",+ DisplayOrder = 10,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "System information",+ ResourceName = "Admin.System.SystemInfo",+ PermissionNames = new List<string> { PermissionSystemName.System },+ ControllerName = "System",+ ActionName = "SystemInfo",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Queued emails",+ ResourceName = "Admin.System.QueuedEmails",+ PermissionNames = new List<string> { PermissionSystemName.MessageQueue },+ ControllerName = "QueuedEmail",+ ActionName = "List",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Contact Us form",+ ResourceName = "Admin.System.ContactForm",+ PermissionNames = new List<string> { PermissionSystemName.MessageContactForm },+ ControllerName = "ContactForm",+ ActionName = "List",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Maintenance",+ ResourceName = "Admin.System.Maintenance",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Maintenance",+ ActionName = "Maintenance",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Schedule tasks",+ ResourceName = "Admin.System.ScheduleTasks",+ PermissionNames = new List<string> { PermissionSystemName.ScheduleTasks },+ ControllerName = "ScheduleTask",+ ActionName = "List",+ DisplayOrder = 5,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Developer tools",+ ResourceName = "Admin.System.DeveloperTools",+ PermissionNames = new List<string>+ { PermissionSystemName.Maintenance, PermissionSystemName.System },+ IconClass = "fa fa-dot-circle-o",+ DisplayOrder = 6,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Manage API Users",+ ResourceName = "Admin.System.APIUsers",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "ApiUser",+ ActionName = "Index",+ DisplayOrder = 0,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Roslyn compiler",+ ResourceName = "Admin.System.Roslyn",+ PermissionNames = new List<string> { PermissionSystemName.System },+ ControllerName = "System",+ ActionName = "Roslyn",+ DisplayOrder = 1,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Custom css",+ ResourceName = "Admin.System.CustomCss",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Maintenance",+ ActionName = "CustomCss",+ DisplayOrder = 2,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Custom JS",+ ResourceName = "Admin.System.CustomJs",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Maintenance",+ ActionName = "CustomJs",+ DisplayOrder = 3,+ IconClass = "fa fa-dot-circle-o"+ },+ new() {+ SystemName = "Robot.txt",+ ResourceName = "Admin.System.RobotsTxt",+ PermissionNames = new List<string> { PermissionSystemName.Maintenance },+ ControllerName = "Maintenance",+ ActionName = "RobotsTxt",+ DisplayOrder = 4,+ IconClass = "fa fa-dot-circle-o"}}}- },- new () {- SystemName = "Help",- ResourceName = "Admin.Help",- IconClass = "icon-question",- DisplayOrder = 11,- ChildNodes = new List<AdminSiteMap> {- new () {- SystemName = "Community forums",- ResourceName = "Admin.Help.Forums",- Url = "https://grandnode.com/boards?utm_source=web&utm_medium=admin&utm_term=web&utm_campaign=Community",- IconClass = "fa fa-dot-circle-o",- DisplayOrder = 0,- OpenUrlInNewTab = true- },- new () {- SystemName = "Premium support services",- ResourceName = "Admin.Help.SupportServices",- Url = "https://grandnode.com/premium-support-packages?utm_source=web&utm_medium=admin&utm_term=web&utm_campaign=Support",- IconClass = "fa fa-dot-circle-o",- DisplayOrder = 1,- OpenUrlInNewTab = true- }+ }+ },++ new() {+ SystemName = "Help",+ ResourceName = "Admin.Help",+ IconClass = "icon-question",+ DisplayOrder = 11,+ ChildNodes = new List<AdminSiteMap> {+ new() {+ SystemName = "Community forums",+ ResourceName = "Admin.Help.Forums",+ Url =+ "https://grandnode.com/boards?utm_source=web&utm_medium=admin&utm_term=web&utm_campaign=Community",+ IconClass = "fa fa-dot-circle-o",+ DisplayOrder = 0,+ OpenUrlInNewTab = true+ },+ new() {+ SystemName = "Premium support services",+ ResourceName = "Admin.Help.SupportServices",+ Url =+ "https://grandnode.com/premium-support-packages?utm_source=web&utm_medium=admin&utm_term=web&utm_campaign=Support",+ IconClass = "fa fa-dot-circle-o",+ DisplayOrder = 1,+ OpenUrlInNewTab = true}- },- new () {- SystemName = "Third party plugins",- ResourceName = "Admin.Plugins",- DisplayOrder = 12}+ },- };+ new() {+ SystemName = "Third party plugins",+ ResourceName = "Admin.Plugins",+ DisplayOrder = 12+ }+ ];}}\ No newline at end of filediff --git a/src/Business/Grand.Business.Customers/Queries/Handlers/GetCustomerQueryHandler.cs b/src/Business/Grand.Business.Customers/Queries/Handlers/GetCustomerQueryHandler.csindex 0448be5a2..31e746a7c 100644--- a/src/Business/Grand.Business.Customers/Queries/Handlers/GetCustomerQueryHandler.cs+++ b/src/Business/Grand.Business.Customers/Queries/Handlers/GetCustomerQueryHandler.cs@@ -110,7 +110,7 @@ namespace Grand.Business.Customers.Queries.HandlersMethodCallExpression call = Expression.Call(typeof(Queryable),"OrderByDescending",- new[] { typeof(T), property.Type },+ [typeof(T), property.Type],source.Expression,Expression.Quote(sort));diff --git a/src/Business/Grand.Business.Marketing/Services/Contacts/ContactAttributeParser.cs b/src/Business/Grand.Business.Marketing/Services/Contacts/ContactAttributeParser.csindex c9a7551af..17449997a 100644--- a/src/Business/Grand.Business.Marketing/Services/Contacts/ContactAttributeParser.cs+++ b/src/Business/Grand.Business.Marketing/Services/Contacts/ContactAttributeParser.cs@@ -93,7 +93,7 @@ namespace Grand.Business.Marketing.Services.ContactsContactAttribute ca, string value){customAttributes ??= new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = ca.Id, Value = value });+ customAttributes.Add(new CustomAttribute { Key = ca.Id, Value = value });return customAttributes;}diff --git a/src/Business/Grand.Business.Marketing/Services/PushNotifications/PushNotificationsService.cs b/src/Business/Grand.Business.Marketing/Services/PushNotifications/PushNotificationsService.csindex 977134f76..c55e5da0f 100644--- a/src/Business/Grand.Business.Marketing/Services/PushNotifications/PushNotificationsService.cs+++ b/src/Business/Grand.Business.Marketing/Services/PushNotifications/PushNotificationsService.cs@@ -172,7 +172,7 @@ namespace Grand.Business.Marketing.Services.PushNotificationsnotification = new{body = text,- title = title,+ title,icon = pictureUrl,click_action = clickUrl}@@ -225,7 +225,8 @@ namespace Grand.Business.Marketing.Services.PushNotifications/// <returns>Bool indicating whether message was sent successfully and string result to display</returns>public virtual async Task<(bool, string)> SendPushNotification(string title, string text, string pictureUrl, string customerId, string clickUrl){- return await SendPushNotification(title, text, pictureUrl, clickUrl, new List<string> { GetPushReceiverByCustomerId(customerId).Id.ToString() });+ return await SendPushNotification(title, text, pictureUrl, clickUrl,+ [GetPushReceiverByCustomerId(customerId).Id.ToString()]);}/// <summary>diff --git a/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs b/src/Business/Grand.Business.Messages/Services/MessageProviderService.csindex 221a1bb5d..cbdb18d7d 100644--- a/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs+++ b/src/Business/Grand.Business.Messages/Services/MessageProviderService.cs@@ -827,7 +827,7 @@ namespace Grand.Business.Messages.Servicesvar subjectReplaced = LiquidExtensions.Render(liquidObject, subject);var bodyReplaced = LiquidExtensions.Render(liquidObject, body);- await _mediator.Send(new InsertContactUsCommand() {+ await _mediator.Send(new InsertContactUsCommand {CustomerId = customer.Id,StoreId = store.Id,VendorId = product.VendorId,@@ -845,7 +845,7 @@ namespace Grand.Business.Messages.Servicesif (!string.IsNullOrEmpty(product?.VendorId)){- var vendor = await _mediator.Send(new GetVendorByIdQuery() { Id = product.VendorId });+ var vendor = await _mediator.Send(new GetVendorByIdQuery { Id = product.VendorId });if (vendor != null){toEmail = vendor.Email;@@ -900,7 +900,7 @@ namespace Grand.Business.Messages.Servicesif (!string.IsNullOrEmpty(merchandiseReturn.VendorId)){- var vendor = await _mediator.Send(new GetVendorByIdQuery() { Id = merchandiseReturn.VendorId });+ var vendor = await _mediator.Send(new GetVendorByIdQuery { Id = merchandiseReturn.VendorId });if (vendor != null){var vendorEmail = vendor.Email;@@ -1239,7 +1239,7 @@ namespace Grand.Business.Messages.Services//customervar customer = await _mediator.Send(new GetCustomerByIdQuery { Id = vendorReview.CustomerId });//vendor- var vendor = await _mediator.Send(new GetVendorByIdQuery() { Id = vendorReview.VendorId });+ var vendor = await _mediator.Send(new GetVendorByIdQuery { Id = vendorReview.VendorId });var builder = new LiquidObjectBuilder(_mediator);builder.AddStoreTokens(store, language, emailAccount)@@ -1579,7 +1579,7 @@ namespace Grand.Business.Messages.Services//store in databaseif (_commonSettings.StoreInDatabaseContactUsForm){- await _mediator.Send(new InsertContactUsCommand() {+ await _mediator.Send(new InsertContactUsCommand {CustomerId = customer.Id,StoreId = store.Id,VendorId = "",@@ -1660,7 +1660,7 @@ namespace Grand.Business.Messages.Services//store in databaseif (_commonSettings.StoreInDatabaseContactUsForm){- await _mediator.Send(new InsertContactUsCommand() {+ await _mediator.Send(new InsertContactUsCommand {CustomerId = customer.Id,StoreId = store.Id,VendorId = vendor.Id,@@ -1747,7 +1747,7 @@ namespace Grand.Business.Messages.Services.AddStoreTokens(store, language, emailAccount);LiquidObject liquidObject = await builder.BuildAsync();- var bids = (await _mediator.Send(new GetBidsByProductIdQuery() { ProductId = bid.ProductId })).Where(x => x.CustomerId != bid.CustomerId).GroupBy(x => x.CustomerId);+ var bids = (await _mediator.Send(new GetBidsByProductIdQuery { ProductId = bid.ProductId })).Where(x => x.CustomerId != bid.CustomerId).GroupBy(x => x.CustomerId);foreach (var item in bids){var builder2 = new LiquidObjectBuilder(_mediator, liquidObject);@@ -1791,7 +1791,7 @@ namespace Grand.Business.Messages.Services.AddStoreTokens(store, language, emailAccount);LiquidObject liquidObject = await builder.BuildAsync();- var bids = (await _mediator.Send(new GetBidsByProductIdQuery() { ProductId = product.Id })).Where(x => x.CustomerId != customerId).GroupBy(x => x.CustomerId);+ var bids = (await _mediator.Send(new GetBidsByProductIdQuery { ProductId = product.Id })).Where(x => x.CustomerId != customerId).GroupBy(x => x.CustomerId);foreach (var item in bids){var builder2 = new LiquidObjectBuilder(_mediator, liquidObject);@@ -1968,7 +1968,7 @@ namespace Grand.Business.Messages.Servicesemail.AttachedDownloads = attachments;email.EmailAccountId = emailAccount.Id;email.DontSendBeforeDateUtc = !messageTemplate.DelayBeforeSend.HasValue ? null- : (DateTime.UtcNow + TimeSpan.FromHours(messageTemplate.DelayPeriodId.ToHours(messageTemplate.DelayBeforeSend.Value)));+ : DateTime.UtcNow + TimeSpan.FromHours(messageTemplate.DelayPeriodId.ToHours(messageTemplate.DelayBeforeSend.Value));email.Reference = reference;email.ObjectId = objectId;diff --git a/src/Business/Grand.Business.Storage/Services/AmazonPictureService.cs b/src/Business/Grand.Business.Storage/Services/AmazonPictureService.csindex 306709ff2..1002798cd 100644--- a/src/Business/Grand.Business.Storage/Services/AmazonPictureService.cs+++ b/src/Business/Grand.Business.Storage/Services/AmazonPictureService.cs@@ -126,7 +126,7 @@ namespace Grand.Business.Storage.Services{await CheckBucketExists();- var listObjectsRequest = new ListObjectsV2Request() {+ var listObjectsRequest = new ListObjectsV2Request {BucketName = _bucketName,Prefix = picture.Id};@@ -196,7 +196,7 @@ namespace Grand.Business.Storage.Servicesusing (Stream stream = new MemoryStream(binary)){- var putObjectRequest = new PutObjectRequest() {+ var putObjectRequest = new PutObjectRequest {BucketName = _bucketName,InputStream = stream,Key = thumbFileName,@@ -215,7 +215,7 @@ namespace Grand.Business.Storage.Services{await CheckBucketExists();- var listObjectsRequest = new ListObjectsV2Request() {+ var listObjectsRequest = new ListObjectsV2Request {BucketName = _bucketName};var listObjectsResponse = await _s3Client.ListObjectsV2Async(listObjectsRequest);diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/EndAuctionsTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/EndAuctionsTask.csindex 4471ea37d..7e7979754 100644--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/EndAuctionsTask.cs+++ b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/EndAuctionsTask.cs@@ -51,7 +51,7 @@ namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasksvar warnings = (await _shoppingCartService.AddToCart(await _customerService.GetCustomerById(bid.CustomerId), bid.ProductId, Domain.Orders.ShoppingCartType.Auctions,bid.StoreId, bid.WarehouseId, customerEnteredPrice: bid.Amount,- validator: new ShoppingCartValidatorOptions() { GetRequiredProductWarnings = false })).warnings;+ validator: new ShoppingCartValidatorOptions { GetRequiredProductWarnings = false })).warnings;if (!warnings.Any()){diff --git a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/GenerateSitemapXmlTask.cs b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/GenerateSitemapXmlTask.csindex 451c4a3ac..d7ab00bb6 100644--- a/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/GenerateSitemapXmlTask.cs+++ b/src/Business/Grand.Business.System/Services/BackgroundServices/ScheduleTasks/GenerateSitemapXmlTask.cs@@ -43,8 +43,7 @@ namespace Grand.Business.System.Services.BackgroundServices.ScheduleTasksvar storeLanguages = await _languageService.GetAllLanguages(storeId: store.Id);foreach (var lang in storeLanguages){- var siteMap = await _mediator.Send(new GetSitemapXmlCommand()- {+ var siteMap = await _mediator.Send(new GetSitemapXmlCommand {Language = lang,Store = store});diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomersAndUsers.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomersAndUsers.csindex b9ed7e173..97753db68 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomersAndUsers.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataCustomersAndUsers.cs@@ -95,8 +95,8 @@ namespace Grand.Business.System.Services.InstallationadminUser.ShippingAddress = defaultAdminUserAddress;adminUser.Groups.Add(crAdministrators.Id);adminUser.Groups.Add(crRegistered.Id);- adminUser.UserFields.Add(new UserField() { Key = SystemCustomerFieldNames.FirstName, Value = "John", StoreId = "" });- adminUser.UserFields.Add(new UserField() { Key = SystemCustomerFieldNames.LastName, Value = "Smith", StoreId = "" });+ adminUser.UserFields.Add(new UserField { Key = SystemCustomerFieldNames.FirstName, Value = "John", StoreId = "" });+ adminUser.UserFields.Add(new UserField { Key = SystemCustomerFieldNames.LastName, Value = "Smith", StoreId = "" });await _customerRepository.InsertAsync(adminUser);//Anonymous userdiff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataPickupPoints.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataPickupPoints.csindex 31c8ec4c8..f340abbf5 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataPickupPoints.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataPickupPoints.cs@@ -17,8 +17,7 @@ namespace Grand.Business.System.Services.InstallationZipPostalCode = "10021"};- var point = new PickupPoint()- {+ var point = new PickupPoint {Address = addresspoint,Name = "My Store - New York"};diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.csindex eec93b81b..3ef75afc6 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs@@ -3655,7 +3655,7 @@ namespace Grand.Business.System.Services.Installationproduct.ApprovedTotalReviews += 1;product.AvgRating = rating / product.ApprovedTotalReviews;}- allProducts.ForEach((x=>_productRepository.Update(x)));+ allProducts.ForEach(x=>_productRepository.Update(x));}private async Task AddProductTag(Product product, string tag){diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.csindex a1bbbbbdf..82232b69b 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataRobotsTxt.cs@@ -10,7 +10,7 @@ namespace Grand.Business.System.Services.Installation{var url = store.SslEnabled ? store.SecureUrl : store.Url;- var robotsTxt = new RobotsTxt() {+ var robotsTxt = new RobotsTxt {Name = "RobotsTXT",StoreId = store.Id,Text = @$"User-agent: *diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.csindex 88ce2fdda..c14de45c2 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs@@ -107,59 +107,58 @@ namespace Grand.Business.System.Services.InstallationCanonicalUrlsEnabled = false,TwitterMetaTags = true,OpenGraphMetaTags = true,- ReservedEntityUrlSlugs = new List<string>- {- "admin",- "install",- "recentlyviewedproducts",- "newproducts",- "compareproducts",- "clearcomparelist",- "setproductreviewhelpfulness",- "login",- "register",- "logout",- "cart",- "wishlist",- "emailwishlist",- "checkout",- "onepagecheckout",- "contactus",- "passwordrecovery",- "subscribenewsletter",- "blog",- "knowledgebase",- "news",- "sitemap",- "search",- "config",- "cookieaccept",- "access-denied",- "page-not-found",- "home",- "con",- "lpt1",- "lpt2",- "lpt3",- "lpt4",- "lpt5",- "lpt6",- "lpt7",- "lpt8",- "lpt9",- "com1",- "com2",- "com3",- "com4",- "com5",- "com6",- "com7",- "com8",- "com9",- "null",- "prn",- "aux"- }+ ReservedEntityUrlSlugs = [+ "admin",+ "install",+ "recentlyviewedproducts",+ "newproducts",+ "compareproducts",+ "clearcomparelist",+ "setproductreviewhelpfulness",+ "login",+ "register",+ "logout",+ "cart",+ "wishlist",+ "emailwishlist",+ "checkout",+ "onepagecheckout",+ "contactus",+ "passwordrecovery",+ "subscribenewsletter",+ "blog",+ "knowledgebase",+ "news",+ "sitemap",+ "search",+ "config",+ "cookieaccept",+ "access-denied",+ "page-not-found",+ "home",+ "con",+ "lpt1",+ "lpt2",+ "lpt3",+ "lpt4",+ "lpt5",+ "lpt6",+ "lpt7",+ "lpt8",+ "lpt9",+ "com1",+ "com2",+ "com3",+ "com4",+ "com5",+ "com6",+ "com7",+ "com8",+ "com9",+ "null",+ "prn",+ "aux"+ ]});await _settingService.SaveSetting(new AdminAreaSettings {@@ -422,16 +421,15 @@ namespace Grand.Business.System.Services.Installation});await _settingService.SaveSetting(new ShippingProviderSettings {- ActiveSystemNames = new List<string> { "Shipping.FixedRate" }+ ActiveSystemNames = ["Shipping.FixedRate"]});await _settingService.SaveSetting(new PaymentSettings {- ActivePaymentProviderSystemNames = new List<string>- {- "Payments.CashOnDelivery",- "Payments.PayPalStandard",- "Payments.BrainTree"- },+ ActivePaymentProviderSystemNames = [+ "Payments.CashOnDelivery",+ "Payments.PayPalStandard",+ "Payments.BrainTree"+ ],AllowRePostingPayments = true,SkipPaymentIfOnlyOne = true,ShowPaymentDescriptions = true,@@ -552,7 +550,7 @@ namespace Grand.Business.System.Services.Installation});await _settingService.SaveSetting(new WidgetSettings {- ActiveWidgetSystemNames = new List<string> { "Widgets.Slider" }+ ActiveWidgetSystemNames = ["Widgets.Slider"]});}}diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataStores.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataStores.csindex 62bc9d11a..ed25e5b18 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataStores.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataStores.cs@@ -24,7 +24,7 @@ namespace Grand.Business.System.Services.InstallationCompanyVat = null,CompanyEmail = companyEmail,CompanyHours = "Monday - Sunday / 8:00AM - 6:00PM",- Domains = new List<DomainHost>() { new DomainHost() { HostName = host.Value, Url = $"{httpscheme}://{host}/", Primary = true } }+ Domains = new List<DomainHost> { new DomainHost { HostName = host.Value, Url = $"{httpscheme}://{host}/", Primary = true } }};store = await _storeRepository.InsertAsync(store);diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.csindex 8d04d56e8..48103fd4e 100644--- a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs+++ b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs@@ -172,7 +172,7 @@ namespace Grand.Business.System.Services.Installationvar resourceName = resNameAttribute!.Value.Trim();var resourceValue = resValueNode!.InnerText.Trim();- _availableCollation.Add(new InstallationCollation() {+ _availableCollation.Add(new InstallationCollation {Name = resourceName,Value = resourceValue});diff --git a/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateMediaSettings.cs b/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateMediaSettings.csindex bd081b6cf..bcc260691 100644--- a/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateMediaSettings.cs+++ b/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateMediaSettings.cs@@ -37,7 +37,7 @@ namespace Grand.Business.System.Services.Migrations._1._1var settingsLogo = JsonSerializer.Deserialize<SettingsMedia>(metadata);if (settingsLogo != null){- settingService.SaveSetting<StorageSettings>(new StorageSettings() { PictureStoreInDb = settingsLogo.StoreInDb }, "").GetAwaiter().GetResult();+ settingService.SaveSetting<StorageSettings>(new StorageSettings { PictureStoreInDb = settingsLogo.StoreInDb }, "").GetAwaiter().GetResult();}}}diff --git a/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateStore.cs b/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateStore.csindex 93a42f4b0..9a2122141 100644--- a/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateStore.cs+++ b/src/Business/Grand.Business.System/Services/Migrations/1.1/MigrationUpdateStore.cs@@ -31,7 +31,7 @@ namespace Grand.Business.System.Services.Migrations._1._1{var storeUri = new Uri(store.Url);var httpscheme = store.SslEnabled ? "https" : "http";- var domain = new DomainHost() {+ var domain = new DomainHost {HostName = storeUri.Authority,Url = $"{httpscheme}://{storeUri.Authority}",Primary = truediff --git a/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateAdminSiteMap.cs b/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateAdminSiteMap.csindex d3fe61543..7e70752ef 100644--- a/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateAdminSiteMap.cs+++ b/src/Business/Grand.Business.System/Services/Migrations/2.2/MigrationUpdateAdminSiteMap.cs@@ -32,7 +32,7 @@ namespace Grand.Business.System.Services.Migrations._2._2{if (sitemapConfiguration.ChildNodes.FirstOrDefault(x => x.SystemName == "Admin menu") == null){- sitemapConfiguration.ChildNodes.Add(new AdminSiteMap() {+ sitemapConfiguration.ChildNodes.Add(new AdminSiteMap {SystemName = "Admin menu",ResourceName = "Admin.Configuration.Menu",PermissionNames = new List<string> { PermissionSystemName.Maintenance },diff --git a/src/Business/Grand.Business.System/Services/Migrations/MigrationProcess.cs b/src/Business/Grand.Business.System/Services/Migrations/MigrationProcess.csindex dbc4d063f..3db3dd0bf 100644--- a/src/Business/Grand.Business.System/Services/Migrations/MigrationProcess.cs+++ b/src/Business/Grand.Business.System/Services/Migrations/MigrationProcess.cs@@ -53,7 +53,7 @@ namespace Grand.Business.System.Services.Migrationsprivate void SaveMigration(MigrationResult migrationResult, bool install = false){- _repositoryMigration.Insert(new MigrationDb() {+ _repositoryMigration.Insert(new MigrationDb {Identity = migrationResult.Migration.Identity,Name = migrationResult.Migration.Name,Version = migrationResult.Migration.Version.ToString(),@@ -84,7 +84,7 @@ namespace Grand.Business.System.Services.Migrationsvar migrationManager = new MigrationManager();foreach (var item in migrationManager.GetCurrentMigrations()){- SaveMigration(new MigrationResult() {+ SaveMigration(new MigrationResult {Migration = item,Success = true}, true);diff --git a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.csindex f91ddd770..ec095252a 100644--- a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs+++ b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs@@ -110,7 +110,12 @@ namespace Grand.Business.System.Services.Reportsvar vendorQuery = from p in queryfrom item in p.OrderItems- select new { VendorId = item.VendorId, CustomerId = p.CustomerId, OrderCode = p.Code, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };+ select new {+ item.VendorId,+ p.CustomerId, OrderCode = p.Code,+ item.Quantity,+ item.PriceInclTax,+ p.Rate };vendorQuery = vendorQuery.Where(x => x.VendorId == vendorId);@@ -194,7 +199,9 @@ namespace Grand.Business.System.Services.Reportsif (daydiff > 31){var query = builderquery.GroupBy(x => new- { Year = x.CreatedOnUtc.Year, Month = x.CreatedOnUtc.Month })+ {+ x.CreatedOnUtc.Year,+ x.CreatedOnUtc.Month }).Select(g => new CustomerStats {Year = g.Key.Year,Month = g.Key.Month,@@ -202,7 +209,7 @@ namespace Grand.Business.System.Services.Reports}).ToList();foreach (var item in query){- report.Add(new CustomerByTimeReportLine() {+ report.Add(new CustomerByTimeReportLine {Time = item.Year + "-" + item.Month.ToString().PadLeft(2, '0'),Registered = item.Count});@@ -211,7 +218,7 @@ namespace Grand.Business.System.Services.Reportselse{var query = builderquery.GroupBy(x =>- new { Year = x.CreatedOnUtc.Year, Month = x.CreatedOnUtc.Month, Day = x.CreatedOnUtc.Day })+ new { x.CreatedOnUtc.Year, x.CreatedOnUtc.Month, x.CreatedOnUtc.Day }).Select(g => new CustomerStats {Year = g.Key.Year,Month = g.Key.Month,@@ -220,7 +227,7 @@ namespace Grand.Business.System.Services.Reports}).ToList();foreach (var item in query){- report.Add(new CustomerByTimeReportLine() {+ report.Add(new CustomerByTimeReportLine {Time = item.Year + "-" + item.Month.ToString().PadLeft(2, '0') + "-" + item.Day.ToString().PadLeft(2, '0'),Registered = item.Count});diff --git a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.csindex d878823f4..082673176 100644--- a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs+++ b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs@@ -110,7 +110,12 @@ namespace Grand.Business.System.Services.Reportsvar vendorQuery = from p in queryfrom item in p.OrderItems- select new { VendorId = item.VendorId, OrderCode = p.Code, CountryId = p.BillingAddress.CountryId, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };+ select new {+ item.VendorId, OrderCode = p.Code,+ p.BillingAddress.CountryId,+ item.Quantity,+ item.PriceInclTax,+ p.Rate };vendorQuery = vendorQuery.Where(x => x.VendorId == vendorId);@@ -163,7 +168,7 @@ namespace Grand.Business.System.Services.Reportsif (daydiff > 31){var query = builderquery.GroupBy(x =>- new { Year = x.CreatedOnUtc.Year, Month = x.CreatedOnUtc.Month })+ new { x.CreatedOnUtc.Year, x.CreatedOnUtc.Month }).Select(g => new OrderStats {Year = g.Key.Year,Month = g.Key.Month,@@ -173,7 +178,7 @@ namespace Grand.Business.System.Services.Reportsforeach (var item in query){- report.Add(new OrderByTimeReportLine() {+ report.Add(new OrderByTimeReportLine {Time = item.Year.ToString().PadLeft(2, '0') + "-" + item.Month.ToString().PadLeft(2, '0'),SumOrders = Math.Round(item.Amount, 2),TotalOrders = item.Count@@ -183,7 +188,7 @@ namespace Grand.Business.System.Services.Reportselse{var query = builderquery.GroupBy(x =>- new { Year = x.CreatedOnUtc.Year, Month = x.CreatedOnUtc.Month, Day = x.CreatedOnUtc.Day })+ new { x.CreatedOnUtc.Year, x.CreatedOnUtc.Month, x.CreatedOnUtc.Day }).Select(g => new OrderStats {Year = g.Key.Year,Month = g.Key.Month,@@ -194,7 +199,7 @@ namespace Grand.Business.System.Services.Reportsforeach (var item in query){- report.Add(new OrderByTimeReportLine() {+ report.Add(new OrderByTimeReportLine {Time = item.Year.ToString().PadLeft(2, '0') + "-" + item.Month.ToString().PadLeft(2, '0') + "-" + item.Day.ToString().PadLeft(2, '0'),SumOrders = Math.Round(item.Amount, 2),TotalOrders = item.Count@@ -431,14 +436,19 @@ namespace Grand.Business.System.Services.Reportsvar query = from p in builderqueryfrom item in p.OrderItems- select new {VendorId = item.VendorId, ProductId = item.ProductId, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };+ select new {+ item.VendorId,+ item.ProductId,+ item.Quantity,+ item.PriceInclTax,+ p.Rate };if (!string.IsNullOrEmpty(vendorId)){query = query.Where(x => x.VendorId == vendorId);}- var queryItem = query.GroupBy(x => new { ProductId = x.ProductId }).Select(x => new BestsellersReportLine() {+ var queryItem = query.GroupBy(x => new { x.ProductId }).Select(x => new BestsellersReportLine {ProductId = x.Key.ProductId,TotalAmount = x.Sum(y => y.PriceInclTax / y.Rate),TotalQuantity = x.Sum(y => y.Quantity)@@ -471,7 +481,7 @@ namespace Grand.Business.System.Services.Reports&& (string.IsNullOrEmpty(storeId) || o.StoreId == storeId)&& (string.IsNullOrEmpty(salesEmployeeId) || o.SeId == salesEmployeeId)group o by 1 into g- select new ReportPeriodOrder() { Amount = g.Sum(x => x.OrderTotal / x.CurrencyRate), Count = g.Count() };+ select new ReportPeriodOrder { Amount = g.Sum(x => x.OrderTotal / x.CurrencyRate), Count = g.Count() };var report = query.ToList()?.FirstOrDefault();if (report == null)report = new ReportPeriodOrder();diff --git a/src/Business/Grand.Business.System/Services/Reports/ProductsReportService.cs b/src/Business/Grand.Business.System/Services/Reports/ProductsReportService.csindex 584f9ae7d..b1644fc4c 100644--- a/src/Business/Grand.Business.System/Services/Reports/ProductsReportService.cs+++ b/src/Business/Grand.Business.System/Services/Reports/ProductsReportService.cs@@ -56,8 +56,7 @@ namespace Grand.Business.System.Services.Reports(vendorId == "" || p.VendorId == vendorId) &&(storeId == "" || p.Stores.Contains(storeId))from c in p.ProductAttributeCombinations- select new ProductsAttributeCombination()- {+ select new ProductsAttributeCombination {ProductId = p.Id,StockQuantity = c.StockQuantity,Attributes = c.Attributes,diff --git a/src/Core/Grand.Data/DataSettingsManager.cs b/src/Core/Grand.Data/DataSettingsManager.csindex 67b9e2da0..ace6dff90 100644--- a/src/Core/Grand.Data/DataSettingsManager.cs+++ b/src/Core/Grand.Data/DataSettingsManager.cs@@ -33,7 +33,7 @@ namespace Grand.Data{//Try to read filevar connectionString = File.ReadLines(CommonPath.SettingsPath).FirstOrDefault();- _dataSettings = new DataSettings() { ConnectionString = connectionString, DbProvider = DbProvider.MongoDB };+ _dataSettings = new DataSettings { ConnectionString = connectionString, DbProvider = DbProvider.MongoDB };}return _dataSettings;diff --git a/src/Core/Grand.Data/Mongo/MongoDBContext.cs b/src/Core/Grand.Data/Mongo/MongoDBContext.csindex 1a51df8b8..98e46e801 100644--- a/src/Core/Grand.Data/Mongo/MongoDBContext.cs+++ b/src/Core/Grand.Data/Mongo/MongoDBContext.cs@@ -138,7 +138,7 @@ namespace Grand.Data.Mongotry{await ((MongoRepository<T>)repository).Collection.Indexes.CreateOneAsync(new CreateIndexModel<T>(Builders<T>.IndexKeys.Combine(keys),- new CreateIndexOptions() { Name = indexName, Unique = unique }));+ new CreateIndexOptions { Name = indexName, Unique = unique }));}catch { }}diff --git a/src/Core/Grand.Data/Mongo/MongoRepository.cs b/src/Core/Grand.Data/Mongo/MongoRepository.csindex 66ef75256..3e0b14cb3 100644--- a/src/Core/Grand.Data/Mongo/MongoRepository.cs+++ b/src/Core/Grand.Data/Mongo/MongoRepository.cs@@ -140,7 +140,7 @@ namespace Grand.Data.Mongo{entity.UpdatedOnUtc = _auditInfoProvider.GetCurrentDateTime();entity.UpdatedBy = _auditInfoProvider?.GetCurrentUser();- _collection.ReplaceOne(x => x.Id == entity.Id, entity, new ReplaceOptions() { IsUpsert = false });+ _collection.ReplaceOne(x => x.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = false });return entity;}@@ -153,7 +153,7 @@ namespace Grand.Data.Mongoentity.UpdatedOnUtc = _auditInfoProvider.GetCurrentDateTime();entity.UpdatedBy = _auditInfoProvider.GetCurrentUser();await _collection.ReplaceOneAsync(x => x.Id == entity.Id, entity,- new ReplaceOptions() { IsUpsert = false });+ new ReplaceOptions { IsUpsert = false });return entity;}diff --git a/src/Core/Grand.Data/Mongo/MongoStoreFilesContext.cs b/src/Core/Grand.Data/Mongo/MongoStoreFilesContext.csindex cdc529252..5a46e7fe1 100644--- a/src/Core/Grand.Data/Mongo/MongoStoreFilesContext.cs+++ b/src/Core/Grand.Data/Mongo/MongoStoreFilesContext.cs@@ -24,7 +24,7 @@ namespace Grand.Data.Mongopublic async Task<byte[]> BucketDownload(string id){var bucket = new MongoDB.Driver.GridFS.GridFSBucket(_database);- var binary = await bucket.DownloadAsBytesAsync(new ObjectId(id), new MongoDB.Driver.GridFS.GridFSDownloadOptions() { CheckMD5 = true });+ var binary = await bucket.DownloadAsBytesAsync(new ObjectId(id), new MongoDB.Driver.GridFS.GridFSDownloadOptions { CheckMD5 = true });return binary;}diff --git a/src/Core/Grand.Domain/Catalog/ProductExtensions.cs b/src/Core/Grand.Domain/Catalog/ProductExtensions.csindex 5cfa4cc3e..ed1ee102d 100644--- a/src/Core/Grand.Domain/Catalog/ProductExtensions.cs+++ b/src/Core/Grand.Domain/Catalog/ProductExtensions.cs@@ -223,7 +223,7 @@ namespace Grand.Domain.Catalogif (customAttributes == null)customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = productAttributeMapping.Id, Value = value });+ customAttributes.Add(new CustomAttribute { Key = productAttributeMapping.Id, Value = value });return customAttributes;}@@ -445,8 +445,8 @@ namespace Grand.Domain.Catalogif (product == null)throw new ArgumentNullException(nameof(product));- if (String.IsNullOrEmpty(product.RequiredProductIds))- return new string[0];+ if (string.IsNullOrEmpty(product.RequiredProductIds))+ return Array.Empty<string>();var ids = new List<string>();diff --git a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.csindex ea78eac7f..4e98d1ef8 100644--- a/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs+++ b/src/Core/Grand.Domain/Orders/GiftVoucherExtensions.cs@@ -25,11 +25,11 @@ namespace Grand.Domain.Ordersif (customAttributes == null)customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = recipientName });- customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = recipientEmail });- customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = senderName });- customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = senderEmail });- customAttributes.Add(new CustomAttribute() { Key = "Message", Value = giftVoucherMessage });+ customAttributes.Add(new CustomAttribute { Key = "RecipientName", Value = recipientName });+ customAttributes.Add(new CustomAttribute { Key = "RecipientEmail", Value = recipientEmail });+ customAttributes.Add(new CustomAttribute { Key = "SenderName", Value = senderName });+ customAttributes.Add(new CustomAttribute { Key = "SenderEmail", Value = senderEmail });+ customAttributes.Add(new CustomAttribute { Key = "Message", Value = giftVoucherMessage });return customAttributes;}diff --git a/src/Core/Grand.Domain/Vendors/VendorSettings.cs b/src/Core/Grand.Domain/Vendors/VendorSettings.csindex 5b05f4ffc..625ab359f 100644--- a/src/Core/Grand.Domain/Vendors/VendorSettings.cs+++ b/src/Core/Grand.Domain/Vendors/VendorSettings.cs@@ -171,8 +171,7 @@ namespace Grand.Domain.Vendors/// </summary>public bool FaxRequired { get; set; }- public AddressSettings AddressSettings => new AddressSettings()- {+ public AddressSettings AddressSettings => new AddressSettings {CityEnabled = CityEnabled,CityRequired = CityRequired,CompanyEnabled = CompanyEnabled,diff --git a/src/Core/Grand.Infrastructure/TypeConverters/Converter/ShippingOptionListTypeConverter.cs b/src/Core/Grand.Infrastructure/TypeConverters/Converter/ShippingOptionListTypeConverter.csindex df8a0f03e..f214e0624 100644--- a/src/Core/Grand.Infrastructure/TypeConverters/Converter/ShippingOptionListTypeConverter.cs+++ b/src/Core/Grand.Infrastructure/TypeConverters/Converter/ShippingOptionListTypeConverter.cs@@ -16,7 +16,7 @@ namespace Grand.Infrastructure.TypeConverters.Converter{if (value is not string valueStr) return base.ConvertFrom(context, culture, value);List<ShippingOption> shippingOptions = null;- if (string.IsNullOrEmpty(valueStr)) return (List<ShippingOption>)null;+ if (string.IsNullOrEmpty(valueStr)) return null;try{shippingOptions = JsonSerializer.Deserialize<List<ShippingOption>>(valueStr);diff --git a/src/Plugins/Authentication.Facebook/Controllers/FacebookAuthenticationController.cs b/src/Plugins/Authentication.Facebook/Controllers/FacebookAuthenticationController.csindex 6abb459f6..67d6dfe59 100644--- a/src/Plugins/Authentication.Facebook/Controllers/FacebookAuthenticationController.cs+++ b/src/Plugins/Authentication.Facebook/Controllers/FacebookAuthenticationController.cs@@ -73,7 +73,7 @@ namespace Authentication.Facebook.Controllerspublic IActionResult FacebookSignInFailed(string error_code, string error_message, string state){//handle exception and display message to user- var model = new FailedModel() {+ var model = new FailedModel {ErrorCode = error_code,ErrorMessage = error_message};diff --git a/src/Plugins/Authentication.Facebook/Infrastructure/FacebookAuthenticationBuilder.cs b/src/Plugins/Authentication.Facebook/Infrastructure/FacebookAuthenticationBuilder.csindex adf48623b..f0aacd3f5 100644--- a/src/Plugins/Authentication.Facebook/Infrastructure/FacebookAuthenticationBuilder.cs+++ b/src/Plugins/Authentication.Facebook/Infrastructure/FacebookAuthenticationBuilder.cs@@ -30,7 +30,7 @@ namespace Authentication.Facebook.Infrastructureoptions.AppSecret = !string.IsNullOrWhiteSpace(appSecret) ? appSecret : "000";options.SaveTokens = true;//handles exception thrown by external auth provider- options.Events = new OAuthEvents() {+ options.Events = new OAuthEvents {OnRemoteFailure = ctx =>{ctx.HandleResponse();diff --git a/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs b/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.csindex d953fefb3..b2098b234 100644--- a/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs+++ b/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs@@ -73,7 +73,7 @@ namespace Authentication.Google.Controllerspublic IActionResult GoogleSignInFailed(string error_message){//handle exception and display message to user- var model = new FailedModel() {+ var model = new FailedModel {ErrorMessage = error_message};return View(model);diff --git a/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs b/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.csindex 3901ac7e6..24c8945e5 100644--- a/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs+++ b/src/Plugins/Authentication.Google/Infrastructure/GoogleAuthenticationBuilder.cs@@ -30,7 +30,7 @@ namespace Authentication.Google.Infrastructureoptions.SaveTokens = true;//handles exception thrown by external auth provider- options.Events = new OAuthEvents() {+ options.Events = new OAuthEvents {OnRemoteFailure = ctx =>{ctx.HandleResponse();diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/CustomerGroupsController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/CustomerGroupsController.csindex 6bb739e7a..dcd987680 100644--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/CustomerGroupsController.cs+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/CustomerGroupsController.cs@@ -58,7 +58,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewData.TemplateInfo.HtmlFieldPrefix =$"DiscountRulesCustomerGroups{(!string.IsNullOrEmpty(discountRequirementId) ? discountRequirementId : "")}";- return View((object)model);+ return View(model);}[HttpPost]diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HadSpentAmountController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HadSpentAmountController.csindex 74f02f7fb..fcc40fbfa 100644--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HadSpentAmountController.cs+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HadSpentAmountController.cs@@ -51,7 +51,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewData.TemplateInfo.HtmlFieldPrefix =$"DiscountRulesHadSpentAmount{discount.Id}-{(!string.IsNullOrEmpty(discountRequirementId) ? discountRequirementId : "")}";- return View((object)model);+ return View(model);}[HttpPost]diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasAllProductsController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasAllProductsController.csindex dec8549d1..8ad54cf04 100644--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasAllProductsController.cs+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasAllProductsController.cs@@ -74,7 +74,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewData.TemplateInfo.HtmlFieldPrefix =$"DiscountRulesHasAllProducts{discount.Id}-{(!string.IsNullOrEmpty(discountRequirementId) ? discountRequirementId : "")}";- return View((object)model);+ return View(model);}[HttpPost]@@ -140,7 +140,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewBag.productIdsInput = productIdsInput;ViewBag.btnId = btnId;- return View((object)model);+ return View(model);}[HttpPost]diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasOneProductController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasOneProductController.csindex 9d32afbe5..3e0b8bdbc 100644--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasOneProductController.cs+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/HasOneProductController.cs@@ -73,7 +73,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewData.TemplateInfo.HtmlFieldPrefix =$"DiscountRulesHasOneProduct{discount.Id}-{(!string.IsNullOrEmpty(discountRequirementId) ? discountRequirementId : "")}";- return View((object)model);+ return View(model);}[HttpPost]@@ -139,7 +139,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewBag.productIdsInput = productIdsInput;ViewBag.btnId = btnId;- return View((object)model);+ return View(model);}[HttpPost]diff --git a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.csindex ba3f98967..cfce15806 100644--- a/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs+++ b/src/Plugins/DiscountRules.Standard/Areas/Admin/Controllers/ShoppingCartAmountController.cs@@ -50,7 +50,7 @@ namespace DiscountRules.Standard.Areas.Admin.ControllersViewData.TemplateInfo.HtmlFieldPrefix =$"DiscountRulesShoppingCart{(!string.IsNullOrEmpty(discountRequirementId) ? discountRequirementId : "")}";- return View((object)model);+ return View(model);}diff --git a/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.csindex 89555cef4..0a78bd28a 100644--- a/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs+++ b/src/Plugins/DiscountRules.Standard/Providers/HasAllProductsDiscountRule.cs@@ -26,7 +26,7 @@ namespace DiscountRules.Standard.Providers//invalid by defaultvar result = new DiscountRuleValidationResult();- var restrictedProductIds = string.IsNullOrEmpty(request.DiscountRule.Metadata) ? new List<string>() : request.DiscountRule.Metadata.Split(',').ToList();+ var restrictedProductIds = string.IsNullOrEmpty(request.DiscountRule.Metadata) ? [] : request.DiscountRule.Metadata.Split(',').ToList();if (!restrictedProductIds.Any()){@@ -63,11 +63,11 @@ namespace DiscountRules.Standard.Providers{//the third way (the quantity rage specified)//{Product ID}:{Min quantity}-{Max quantity}. For example, 77:1-3, 123:2-5, 156:3-8- var restrictedProductId = restrictedProduct.Split(new[] { ':' })[0];- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1].Split(new[] { '-' })[0], out var quantityMin))+ var restrictedProductId = restrictedProduct.Split([':'])[0];+ if (!int.TryParse(restrictedProduct.Split([':'])[1].Split(['-'])[0], out var quantityMin))//parsing error; exit;return result;- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1].Split(new[] { '-' })[1], out var quantityMax))+ if (!int.TryParse(restrictedProduct.Split([':'])[1].Split(['-'])[1], out var quantityMax))//parsing error; exit;return result;@@ -80,8 +80,8 @@ namespace DiscountRules.Standard.Providers{//the second way (the quantity specified)//{Product ID}:{Quantity}. For example, 77:1, 123:2, 156:3- var restrictedProductId = restrictedProduct.Split(new[] { ':' })[0];- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1], out var quantity))+ var restrictedProductId = restrictedProduct.Split([':'])[0];+ if (!int.TryParse(restrictedProduct.Split([':'])[1], out var quantity))//parsing error; exit;return result;diff --git a/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.csindex 1397562a6..af724d510 100644--- a/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs+++ b/src/Plugins/DiscountRules.Standard/Providers/HasOneProductDiscountRule.cs@@ -26,7 +26,7 @@ namespace DiscountRules.Standard.Providers//invalid by defaultvar result = new DiscountRuleValidationResult();- var restrictedProductIds = string.IsNullOrEmpty(request.DiscountRule.Metadata) ? new List<string>() : request.DiscountRule.Metadata.Split(',').ToList();+ var restrictedProductIds = string.IsNullOrEmpty(request.DiscountRule.Metadata) ? [] : request.DiscountRule.Metadata.Split(',').ToList();if (!restrictedProductIds.Any()){@@ -62,12 +62,12 @@ namespace DiscountRules.Standard.Providers{//the third way (the quantity rage specified)//{Product ID}:{Min quantity}-{Max quantity}. For example, 77:1-3, 123:2-5, 156:3-8- var restrictedProductId = restrictedProduct.Split(new[] { ':' })[0];+ var restrictedProductId = restrictedProduct.Split([':'])[0];- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1].Split(new[] { '-' })[0], out var quantityMin))+ if (!int.TryParse(restrictedProduct.Split([':'])[1].Split(['-'])[0], out var quantityMin))//parsing error; exit;return result;- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1].Split(new[] { '-' })[1], out var quantityMax))+ if (!int.TryParse(restrictedProduct.Split([':'])[1].Split(['-'])[1], out var quantityMax))//parsing error; exit;return result;@@ -80,9 +80,9 @@ namespace DiscountRules.Standard.Providers{//the second way (the quantity specified)//{Product ID}:{Quantity}. For example, 77:1, 123:2, 156:3- var restrictedProductId = restrictedProduct.Split(new[] { ':' })[0];+ var restrictedProductId = restrictedProduct.Split([':'])[0];- if (!int.TryParse(restrictedProduct.Split(new[] { ':' })[1], out var quantity))+ if (!int.TryParse(restrictedProduct.Split([':'])[1], out var quantity))//parsing error; exit;return result;diff --git a/src/Plugins/ExchangeRate.McExchange/EcbExchange.cs b/src/Plugins/ExchangeRate.McExchange/EcbExchange.csindex 00964491b..ddafdd6eb 100644--- a/src/Plugins/ExchangeRate.McExchange/EcbExchange.cs+++ b/src/Plugins/ExchangeRate.McExchange/EcbExchange.cs@@ -34,7 +34,7 @@ namespace ExchangeRate.McExchangevar exchangeRates = new List<Grand.Domain.Directory.ExchangeRate>();foreach (XmlNode node2 in node.ChildNodes){- exchangeRates.Add(new Grand.Domain.Directory.ExchangeRate() {+ exchangeRates.Add(new Grand.Domain.Directory.ExchangeRate {CurrencyCode = node2.Attributes["currency"].Value,Rate = double.Parse(node2.Attributes["rate"].Value, provider),UpdatedOn = updateDatediff --git a/src/Plugins/Shipping.FixedRateShipping/Areas/Admin/Controllers/ShippingFixedRateController.cs b/src/Plugins/Shipping.FixedRateShipping/Areas/Admin/Controllers/ShippingFixedRateController.csindex 51a40a943..9eae61f0a 100644--- a/src/Plugins/Shipping.FixedRateShipping/Areas/Admin/Controllers/ShippingFixedRateController.cs+++ b/src/Plugins/Shipping.FixedRateShipping/Areas/Admin/Controllers/ShippingFixedRateController.cs@@ -65,8 +65,7 @@ namespace Shipping.FixedRateShipping.Areas.Admin.Controllersreturn Content("Access denied");var shippingMethodId = model.ShippingMethodId;- var rate = new FixedShippingRate()- {+ var rate = new FixedShippingRate {Rate = model.Rate};diff --git a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.csindex 2a8069b5d..94d8f3dcd 100644--- a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs+++ b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs@@ -55,7 +55,7 @@ namespace Shipping.ShippingPoint.Controllerspublic async Task<IActionResult> Points(string shippingOption){- var parameter = shippingOption.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[0];+ var parameter = shippingOption.Split([":"], StringSplitOptions.RemoveEmptyEntries)[0];if (parameter != _translationService.GetResource("Shipping.ShippingPoint.PluginName"))return Content("ShippingPointController: given Shipping Option doesn't exist");diff --git a/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs b/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.csindex 05c7e86bb..1c791fb03 100644--- a/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs+++ b/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs@@ -93,7 +93,7 @@ namespace Shipping.ShippingPoint{data.TryGetValue("selectedShippingOption", out var shippingOptionId);- var shippingMethodName = shippingOption?.Split(new[] { ':' })[0];+ var shippingMethodName = shippingOption?.Split([':'])[0];if (string.IsNullOrEmpty(shippingOptionId))return new List<string> { _translationService.GetResource("Shipping.ShippingPoint.SelectBeforeProceed") };diff --git a/src/Plugins/Tax.FixedRate/Areas/Admin/Controllers/TaxFixedRateController.cs b/src/Plugins/Tax.FixedRate/Areas/Admin/Controllers/TaxFixedRateController.csindex 2e1b7018c..48f748ed7 100644--- a/src/Plugins/Tax.FixedRate/Areas/Admin/Controllers/TaxFixedRateController.cs+++ b/src/Plugins/Tax.FixedRate/Areas/Admin/Controllers/TaxFixedRateController.cs@@ -51,7 +51,7 @@ namespace Tax.FixedRate.Areas.Admin.Controllersvar taxCategoryId = model.TaxCategoryId;var rate = model.Rate;- await _settingService.SetSetting($"Tax.TaxProvider.FixedRate.TaxCategoryId{taxCategoryId}", new FixedTaxRate() { Rate = rate });+ await _settingService.SetSetting($"Tax.TaxProvider.FixedRate.TaxCategoryId{taxCategoryId}", new FixedTaxRate { Rate = rate });return new JsonResult("");}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/Courses.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/Courses.cshtmlindex 3bcec15af..cb21246da 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Account/Courses.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/Courses.cshtml@@ -30,7 +30,7 @@<div class="card mb-3"><div class="card-header"><h3 class="h5 mb-0 d-inline-flex">- <a href="@Url.RouteUrl("Course", new { SeName = item.SeName })">+ <a href="@Url.RouteUrl("Course", new { item.SeName })">@item.Name</a></h3>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtmlindex 4692f0431..0ead69164 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml@@ -171,9 +171,9 @@control-year="@Html.IdFor(x => x.DateOfBirthYear)"begin-year="@(DateTime.Now.Year - 100)"end-year="DateTime.Now.Year"- selected-day="(Model.DateOfBirthDay.HasValue ? Model.DateOfBirthDay.Value : 0)"- selected-month="(Model.DateOfBirthMonth.HasValue ? Model.DateOfBirthMonth.Value : 0)"- selected-year="(Model.DateOfBirthYear.HasValue ? Model.DateOfBirthYear.Value : 0)"+ selected-day="Model.DateOfBirthDay.HasValue ? Model.DateOfBirthDay.Value : 0"+ selected-month="Model.DateOfBirthMonth.HasValue ? Model.DateOfBirthMonth.Value : 0"+ selected-year="Model.DateOfBirthYear.HasValue ? Model.DateOfBirthYear.Value : 0"class="col-12 input-group px-0" /><span asp-validation-for="DateOfBirthDay"></span>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Blog/BlogPost.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Blog/BlogPost.cshtmlindex 02460804d..68cc34273 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Blog/BlogPost.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Blog/BlogPost.cshtml@@ -62,7 +62,7 @@@for (int i = 0; i < Model.Tags.Count; i++){var tag = Model.Tags[i];- <b-button variant="light" size="sm" class="mr-2 mb-2" href="@Url.RouteUrl("BlogByTag", new {tag = tag})">@tag</b-button>+ <b-button variant="light" size="sm" class="mr-2 mb-2" href="@Url.RouteUrl("BlogByTag", new { tag})">@tag</b-button>}</div>}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Blog/List.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Blog/List.cshtmlindex 6e28548c5..692b76da7 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Blog/List.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Blog/List.cshtml@@ -79,7 +79,7 @@</b-link>}<h3 class="h5 title">- <b-link href="@Url.RouteUrl("BlogPost", new { SeName = item.SeName })">+ <b-link href="@Url.RouteUrl("BlogPost", new { item.SeName })">@item.Title</b-link></h3>@@ -88,7 +88,7 @@</div></template><div class="buttons mt-3">- <a class="btn btn-sm btn-outline-secondary read-more" href="@Url.RouteUrl("BlogPost", new { SeName = item.SeName })">@Loc["Blog.MoreInfo"]</a>+ <a class="btn btn-sm btn-outline-secondary read-more" href="@Url.RouteUrl("BlogPost", new { item.SeName })">@Loc["Blog.MoreInfo"]</a></div></b-card></b-col>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Catalog/BrandLayout.GridOrLines.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Catalog/BrandLayout.GridOrLines.cshtmlindex 440dec237..40f88034f 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Catalog/BrandLayout.GridOrLines.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Catalog/BrandLayout.GridOrLines.cshtml@@ -11,7 +11,7 @@var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;if (canonicalUrlsEnabled){- var collectionUrl = Url.RouteUrl("Brand", new { SeName = Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);+ var collectionUrl = Url.RouteUrl("Brand", new { Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);pagebuilder.AddCanonicalUrlParts(collectionUrl);}<script asp-location="Header" asp-src="/theme/script/catalog.js"></script>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Catalog/CategoryLayout.GridOrLines.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Catalog/CategoryLayout.GridOrLines.cshtmlindex 6738ffac2..769002a06 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Catalog/CategoryLayout.GridOrLines.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Catalog/CategoryLayout.GridOrLines.cshtml@@ -10,7 +10,7 @@var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;if (canonicalUrlsEnabled){- var categoryUrl = Url.RouteUrl("Category", new { SeName = Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);+ var categoryUrl = Url.RouteUrl("Category", new { Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);pagebuilder.AddCanonicalUrlParts(categoryUrl);}}@@ -44,7 +44,7 @@<a><strong class="current-item" itemprop="name">@cat.Name</strong><span itemprop="item" itemscope itemtype="http://schema.org/Thing"- id="@Url.RouteUrl("Category", new {SeName = cat.SeName})">+ id="@Url.RouteUrl("Category", new { cat.SeName})"></span><meta itemprop="position" content="@count" /></a>@@ -53,10 +53,10 @@else{<li class="breadcrumb-item" itemprop="itemListElement" itemscope="itemscope" itemtype="http://schema.org/ListItem">- <a href="@Url.RouteUrl("Category", new { SeName = cat.SeName })" title="@cat.Name" itemprop="item">+ <a href="@Url.RouteUrl("Category", new { cat.SeName })" title="@cat.Name" itemprop="item"><span itemprop="name">@cat.Name</span><span itemprop="item" itemscope itemtype="http://schema.org/Thing"- id="@Url.RouteUrl("Category", new { SeName = cat.SeName })">+ id="@Url.RouteUrl("Category", new { cat.SeName })"></span><meta itemprop="position" content="@count" /></a>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Catalog/CollectionLayout.GridOrLines.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Catalog/CollectionLayout.GridOrLines.cshtmlindex 78c4f4200..99bcc93b6 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Catalog/CollectionLayout.GridOrLines.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Catalog/CollectionLayout.GridOrLines.cshtml@@ -10,7 +10,7 @@var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;if (canonicalUrlsEnabled){- var collectionUrl = Url.RouteUrl("Collection", new { SeName = Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);+ var collectionUrl = Url.RouteUrl("Collection", new { Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);pagebuilder.AddCanonicalUrlParts(collectionUrl);}}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Catalog/Vendor.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Catalog/Vendor.cshtmlindex be8595492..b8e242f51 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Catalog/Vendor.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Catalog/Vendor.cshtml@@ -10,7 +10,7 @@var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;if (canonicalUrlsEnabled){- var vendorUrl = Url.RouteUrl("Vendor", new { SeName = Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);+ var vendorUrl = Url.RouteUrl("Vendor", new { Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);pagebuilder.AddCanonicalUrlParts(vendorUrl);}}diff --git a/src/Plugins/Theme.Modern/Views/Modern/News/List.cshtml b/src/Plugins/Theme.Modern/Views/Modern/News/List.cshtmlindex 228c248ba..78ebdf8a0 100644--- a/src/Plugins/Theme.Modern/Views/Modern/News/List.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/News/List.cshtml@@ -32,7 +32,7 @@</b-link>}<h3 class="h5 title">- <b-link href="@Url.RouteUrl("NewsItem", new { SeName = item.SeName })">+ <b-link href="@Url.RouteUrl("NewsItem", new { item.SeName })">@item.Title</b-link></h3>@@ -46,7 +46,7 @@</div></b-card-text><div class="buttons mt-3">- <a class="btn btn-sm btn-outline-secondary read-more" href="@Url.RouteUrl("NewsItem", new { SeName = item.SeName })">@Loc["News.MoreInfo"]</a>+ <a class="btn btn-sm btn-outline-secondary read-more" href="@Url.RouteUrl("NewsItem", new { item.SeName })">@Loc["News.MoreInfo"]</a></div></b-card></b-col>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/Breadcrumbs.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/Breadcrumbs.cshtmlindex 503dfa430..09a1e154d 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/Breadcrumbs.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/Breadcrumbs.cshtml@@ -18,10 +18,10 @@{count++;<li itemprop="itemListElement" itemscope="itemscope" itemtype="http://schema.org/ListItem" class="breadcrumb-item">- <a href="@Url.RouteUrl("Category", new { SeName = category.SeName })" target="_self">+ <a href="@Url.RouteUrl("Category", new { category.SeName })" target="_self"><span itemprop="name">@category.Name</span><span itemprop="item" itemscope itemtype="http://schema.org/Thing"- id="@Url.RouteUrl("Category", new { SeName = category.SeName })">+ id="@Url.RouteUrl("Category", new { category.SeName })"></span><meta itemprop="position" content="@count" /></a>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/ProductTags.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/ProductTags.cshtmlindex 98e1b68ff..2d6ccb4be 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/ProductTags.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/ProductTags.cshtml@@ -3,7 +3,7 @@<div class="product-tags-list">@for (int i = 0; i < Model.Count; i++){- <b-button size="sm" variant="outline-secondary" class="producttag" href="@Url.RouteUrl("ProductsByTagName", new { SeName = Model[i].SeName })">+ <b-button size="sm" variant="outline-secondary" class="producttag" href="@Url.RouteUrl("ProductsByTagName", new { Model[i].SeName })">@Model[i].Name <span>@Loc["Products.Tags.Count", Model[i].ProductCount]</span></b-button>}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtmlindex e3543fe7f..ae76c13c6 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml@@ -15,7 +15,7 @@//canonical URLif (seoSettings.CanonicalUrlsEnabled){- var productUrl = Url.RouteUrl("Product", new { SeName = Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);+ var productUrl = Url.RouteUrl("Product", new { Model.SeName }, this.Url.ActionContext.HttpContext.Request.Scheme);pagebuilder.AddCanonicalUrlParts(productUrl);}}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/CollectionNavigation/Default.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/CollectionNavigation/Default.cshtmlindex a5b57c69c..813fcddd4 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/CollectionNavigation/Default.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/CollectionNavigation/Default.cshtml@@ -8,7 +8,7 @@@foreach (var collection in Model.Collections){<li class="@(collection.IsActive ? "active" : "inactive")">- <a href="@Url.RouteUrl("Collection", new { SeName = collection.SeName })">+ <a href="@Url.RouteUrl("Collection", new { collection.SeName })">@if (!string.IsNullOrEmpty(collection.Icon)){<span class="category-icon @collection.Icon"></span>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Footer/Default.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Footer/Default.cshtmlindex 2f2be72cb..ee937cb52 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Footer/Default.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Footer/Default.cshtml@@ -107,7 +107,7 @@@foreach (var topic in Model.Pages.Where(x => x.IncludeInFooterRow1).ToList()){<li>- <b-link href="@Url.RouteUrl("Page", new { SeName = topic.SeName })">@topic.Name</b-link>+ <b-link href="@Url.RouteUrl("Page", new { topic.SeName })">@topic.Name</b-link></li>}@if (Model.NewsEnabled)@@ -174,7 +174,7 @@}@foreach (var topic in Model.Pages.Where(x => x.IncludeInFooterRow2).ToList()){- <b-link href="@Url.RouteUrl("Page", new { SeName = topic.SeName })" target="_blank">@topic.Name</b-link>+ <b-link href="@Url.RouteUrl("Page", new { topic.SeName })" target="_blank">@topic.Name</b-link>}</ul></b-col>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Menu/Default.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Menu/Default.cshtmlindex 129e205fd..99e76ad5e 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Menu/Default.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/Menu/Default.cshtml@@ -22,7 +22,7 @@@foreach (var brand in Model.Brands){<li>- <a href="@Url.RouteUrl("Brand", new { SeName = brand.SeName })">+ <a href="@Url.RouteUrl("Brand", new { brand.SeName })"><span class="title">@brand.Name</span>@if (!string.IsNullOrEmpty(brand.Icon)){@@ -47,7 +47,7 @@@foreach (var collect in Model.Collections){<li>- <a href="@Url.RouteUrl("Collection", new { SeName = collect.SeName })">+ <a href="@Url.RouteUrl("Collection", new { collect.SeName })"><span class="title">@collect.Name</span>@if (!string.IsNullOrEmpty(collect.Icon)){@@ -77,7 +77,7 @@@foreach (var mpage in Model.Pages){<li>- <a href="@Url.RouteUrl("Page", new { SeName=mpage.SeName })">+ <a href="@Url.RouteUrl("Page", new { mpage.SeName })"><span class="title">@mpage.Name</span></a></li>@@ -130,5 +130,5 @@@{var rootCategoriesResponsive = Model.Categories.ToList();//name it "Categories" if we have only categories. Otherwise, "Menu"- var responsiveMenuTitle = (rootCategoriesResponsive.Any() && Model.Pages.Any()) ? Loc["Categories"] : Loc["Menu"];+ var responsiveMenuTitle = rootCategoriesResponsive.Any() && Model.Pages.Any() ? Loc["Categories"] : Loc["Menu"];}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/RecentlyViewedProductsBlock/Default.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/RecentlyViewedProductsBlock/Default.cshtmlindex 531331317..c97b45f71 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/RecentlyViewedProductsBlock/Default.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/RecentlyViewedProductsBlock/Default.cshtml@@ -10,11 +10,11 @@var product = Model[i];<div class="col-xl-3 col-lg-3 col-md-3 col-sm-4 col-6 mb-2 col-for-5-xl"><div class="card">- <a class="text-center picture" href="@Url.RouteUrl("Product", new { SeName = product.SeName })">+ <a class="text-center picture" href="@Url.RouteUrl("Product", new { product.SeName })"><b-img-lazy class="img-fluid" alt="@product.DefaultPictureModel.AlternateText" src="@product.DefaultPictureModel.ImageUrl" title="@product.DefaultPictureModel.Title"></b-img-lazy></a><div class="card-body">- <h5 class="h6"><a href="@Url.RouteUrl("Product", new { SeName = product.SeName })">@product.Name</a></h5>+ <h5 class="h6"><a href="@Url.RouteUrl("Product", new { product.SeName })">@product.Name</a></h5></div></div></div>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtmlindex 2a19d2b4d..67c8d0a76 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml@@ -11,23 +11,23 @@{if (Model.ProductPrice.ForceRedirectionAfterAddingToCart){- addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId, quantity = quantity, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });+ addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId, quantity, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });}else{- addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId, quantity = quantity });+ addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId, quantity });}- addtowishlistlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = (int)ShoppingCartType.Wishlist, quantity = quantity });+ addtowishlistlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = (int)ShoppingCartType.Wishlist, quantity });}else{if (Model.ProductPrice.ForceRedirectionAfterAddingToCart){- addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });+ addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });}else{- addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId });+ addtocartlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId });}addtowishlistlink = Url.RouteUrl("AddProductCatalog", new { productId = Model.Id, shoppingCartTypeId = (int)ShoppingCartType.Wishlist });}@@ -43,7 +43,7 @@</div>}<div class="picture-container">- <b-link class="img-container" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">+ <b-link class="img-container" href="@Url.RouteUrl("Product", new { Model.SeName })" title="@Model.DefaultPictureModel.Title"><b-card-img-lazy alt="@Model.DefaultPictureModel.AlternateText" class="main-product-img" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title"></b-card-img-lazy>@if (!string.IsNullOrEmpty(Model.SecondPictureModel.ImageUrl)){@@ -73,12 +73,12 @@case AttributeControlType.RadioList:case AttributeControlType.Checkboxes:case AttributeControlType.ReadonlyCheckboxes:- <b-button variant="light" size="sm" class="name" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })[email protected][email protected](spec.Name)">+ <b-button variant="light" size="sm" class="name" href="@Url.RouteUrl("Product", new { Model.SeName })[email protected][email protected](spec.Name)">@Html.Raw(spec.Name)</b-button>break;case AttributeControlType.ColorSquares:- if ((spec.PictureModel.FullSizeImageUrl) != null)+ if (spec.PictureModel.FullSizeImageUrl != null){<b-button variant="light" size="sm" class="name color-container" title="@spec.Name" v-on:click='productImage' data-href="@spec.PictureModel.FullSizeImageUrl"><span class="color" style="background-color:@spec.ColorSquaresRgb;"> </span>@@ -86,13 +86,13 @@}else{- <b-button variant="light" size="sm" class="name color-container" title="@spec.Name" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })[email protected][email protected](spec.Name)">+ <b-button variant="light" size="sm" class="name color-container" title="@spec.Name" href="@Url.RouteUrl("Product", new { Model.SeName })[email protected][email protected](spec.Name)"><span class="color" style="background-color:@spec.ColorSquaresRgb;"> </span></b-button>}break;case AttributeControlType.ImageSquares:- if ((spec.PictureModel.FullSizeImageUrl) != null)+ if (spec.PictureModel.FullSizeImageUrl != null){<b-button variant="light" size="sm" class="p-1 name image-container" v-on:click='productImage' data-href="@spec.PictureModel.FullSizeImageUrl"><img src="@spec.ImageSquaresPictureModel?.ImageUrl" alt="@spec.Name" />@@ -100,7 +100,7 @@}else{- <b-button variant="light" size="sm" class="p-1 name image-container" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })[email protected][email protected](spec.Name)">+ <b-button variant="light" size="sm" class="p-1 name image-container" href="@Url.RouteUrl("Product", new { Model.SeName })[email protected][email protected](spec.Name)"><img src="@spec.ImageSquaresPictureModel?.ImageUrl" alt="@spec.Name" /></b-button>}@@ -171,7 +171,7 @@</div><b-card-body><h5 class="card-title mb-0">- <a href="@Url.RouteUrl("Product", new { SeName = Model.SeName })">+ <a href="@Url.RouteUrl("Product", new { Model.SeName })">@Model.Name</a></h5>@@ -185,12 +185,12 @@decimal ratingValue = 0;if (Model.ReviewOverviewModel.TotalReviews != 0){- ratingValue = Convert.ToDecimal(((Model.ReviewOverviewModel.RatingSum * (double)100) / Model.ReviewOverviewModel.TotalReviews) / (double)100);+ ratingValue = Convert.ToDecimal(Model.ReviewOverviewModel.RatingSum * (double)100 / Model.ReviewOverviewModel.TotalReviews / 100);}<template><div class="rating"><b-form-rating id="[email protected]" class="p-0" variant="warning" no-border size="sm" show-value precision="2" readonly inline value="@(ratingValue)"></b-form-rating>- <b-link href="@Url.RouteUrl("Product", new { SeName = Model.SeName })">@Model.ReviewOverviewModel.TotalReviews @Loc["Reviews.Overview.Reviews"]</b-link>+ <b-link href="@Url.RouteUrl("Product", new { Model.SeName })">@Model.ReviewOverviewModel.TotalReviews @Loc["Reviews.Overview.Reviews"]</b-link></div></template>}diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtmlindex 5442aea74..cc15461e7 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml@@ -8,7 +8,7 @@<li class="@if (galleryCheck == "true") { <text>hasGallery</text> } @(Model.Category.SubCategories.Count() == 0 ? "category": "category -hasSubmenu" )">- <a href="@Url.RouteUrl("Category", new { SeName = Model.Category.SeName })">+ <a href="@Url.RouteUrl("Category", new { Model.Category.SeName })">@if (!string.IsNullOrEmpty(Model.Category.Icon)){<b-icon icon="@Model.Category.Icon" class="category-icon"></b-icon>diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/_TwoColumns.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/_TwoColumns.cshtmlindex 0754afe65..079bb44a9 100644--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/_TwoColumns.cshtml+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/_TwoColumns.cshtml@@ -64,9 +64,9 @@}@await Component.InvokeAsync("Widget", new { widgetZone = "left_side_column_before" })- @await Component.InvokeAsync("CategoryNavigation", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })+ @await Component.InvokeAsync("CategoryNavigation", new { currentCategoryId, currentProductId })@await Component.InvokeAsync("Widget", new { widgetZone = "left_side_column_after_category_navigation" })- @await Component.InvokeAsync("CollectionNavigation", new { currentCollectionId = currentCollectionId })+ @await Component.InvokeAsync("CollectionNavigation", new { currentCollectionId })@await Component.InvokeAsync("VendorNavigation")@await Component.InvokeAsync("Widget", new { widgetZone = "left_side_column_after" })}diff --git a/src/Plugins/Widgets.Slider/Components/WidgetSliderComponent.cs b/src/Plugins/Widgets.Slider/Components/WidgetSliderComponent.csindex 40a3faea0..49c62cf52 100644--- a/src/Plugins/Widgets.Slider/Components/WidgetSliderComponent.cs+++ b/src/Plugins/Widgets.Slider/Components/WidgetSliderComponent.cs@@ -40,7 +40,7 @@ namespace Widgets.Slider.Componentsif ((item.StartDateUtc.HasValue && item.StartDateUtc > DateTime.UtcNow) || (item.EndDateUtc.HasValue && item.EndDateUtc < DateTime.UtcNow))continue;- model.Slide.Add(new PublicInfoModel.Slider() {+ model.Slide.Add(new PublicInfoModel.Slider {Link = item.Link,PictureUrl = await GetPictureUrl(item.PictureId),Name = item.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),diff --git a/src/Plugins/Widgets.Slider/Extensions.cs b/src/Plugins/Widgets.Slider/Extensions.csindex c4fa0fc75..e5e0cf8d9 100644--- a/src/Plugins/Widgets.Slider/Extensions.cs+++ b/src/Plugins/Widgets.Slider/Extensions.cs@@ -59,8 +59,7 @@ namespace Widgets.Slider}if (insert && prop.GetValue(item) != null)- local.Add(new TranslationEntity()- {+ local.Add(new TranslationEntity {LanguageId = item.LanguageId,LocaleKey = prop.Name,LocaleValue = prop.GetValue(item)?.ToString()diff --git a/src/Plugins/Widgets.Slider/SliderWidgetPlugin.cs b/src/Plugins/Widgets.Slider/SliderWidgetPlugin.csindex 9b0e307ea..17502b0c5 100644--- a/src/Plugins/Widgets.Slider/SliderWidgetPlugin.cs+++ b/src/Plugins/Widgets.Slider/SliderWidgetPlugin.cs@@ -45,8 +45,7 @@ namespace Widgets.Slidervar byte1 = await File.ReadAllBytesAsync(sampleImagesPath + "banner1.png");var byte2 = await File.ReadAllBytesAsync(sampleImagesPath + "banner2.png");- var pictureSlider1 = new PictureSlider()- {+ var pictureSlider1 = new PictureSlider {DisplayOrder = 0,Link = "",Name = "Sample slider 1",@@ -60,8 +59,7 @@ namespace Widgets.Sliderawait _pictureSliderRepository.InsertAsync(pictureSlider1);- var pictureSlider2 = new PictureSlider()- {+ var pictureSlider2 = new PictureSlider {DisplayOrder = 1,Link = "https://grandnode.com",Name = "Sample slider 2",diff --git a/src/Tests/Grand.Business.Authentication.Tests/Events/CustomerDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Events/CustomerDeletedEventHandlerTests.csindex cf3787e43..893a4c2de 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Events/CustomerDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Events/CustomerDeletedEventHandlerTests.cs@@ -23,9 +23,9 @@ namespace Grand.Business.Authentication.Tests.Eventspublic async Task HandleTest(){//Arrange- await _repository.InsertAsync(new ExternalAuthentication() { CustomerId = "1" });+ await _repository.InsertAsync(new ExternalAuthentication { CustomerId = "1" });//Act- await _handler.Handle(new Infrastructure.Events.EntityDeleted<Customer>(new Customer() { Id = "1" }), CancellationToken.None);+ await _handler.Handle(new Infrastructure.Events.EntityDeleted<Customer>(new Customer { Id = "1" }), CancellationToken.None);//AssertAssert.AreEqual(0, _repository.Table.Count());}diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/ApiAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/ApiAuthenticationServiceTests.csindex a92ab274b..960488940 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/ApiAuthenticationServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/ApiAuthenticationServiceTests.cs@@ -91,7 +91,7 @@ namespace Grand.Business.Authentication.Tests.Servicesnew Claim("Token", "123")};context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, ""));- _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = false }));+ _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = false }));var result = await _jwtBearerAuthenticationService.Valid(context);Assert.IsFalse(result);Assert.AreEqual(await _jwtBearerAuthenticationService.ErrorMessage(), "Email not exists/or not active in the customer table");@@ -108,8 +108,8 @@ namespace Grand.Business.Authentication.Tests.Servicesnew Claim("Token", "123")};context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, ""));- _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = true }));- _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi() { IsActive = false, Token = "123" }));+ _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));+ _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi { IsActive = false, Token = "123" }));var result = await _jwtBearerAuthenticationService.Valid(context);Assert.IsFalse(result);Assert.AreEqual("User api not exists/or not active in the user api table", await _jwtBearerAuthenticationService.ErrorMessage());@@ -125,8 +125,8 @@ namespace Grand.Business.Authentication.Tests.Servicesnew Claim("Token", "123")};context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, ""));- _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = true }));- _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi() { IsActive = true, Token = "321" }));+ _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));+ _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi { IsActive = true, Token = "321" }));var result = await _jwtBearerAuthenticationService.Valid(context);Assert.IsFalse(result);Assert.AreEqual("Wrong token, generate again", await _jwtBearerAuthenticationService.ErrorMessage());@@ -142,8 +142,8 @@ namespace Grand.Business.Authentication.Tests.Servicesnew Claim("Token", "123")};context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, ""));- _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = true }));- _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi() { IsActive = true, Token = "123" }));+ _customerService.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));+ _userApiServiceMock.Setup(c => c.GetUserByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new UserApi { IsActive = true, Token = "123" }));var result = await _jwtBearerAuthenticationService.Valid(context);Assert.IsTrue(result);}@@ -153,7 +153,7 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task GetAuthenticatedCustomer_NullAuthHeader_GetNull(){- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };var httpContext = new Mock<HttpContext>();var req = new Mock<HttpRequest>();req.Setup(c => c.Path).Returns(new PathString("/api/..."));diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.csindex b47f49c26..d525555e0 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs@@ -45,7 +45,7 @@ namespace Grand.Business.Authentication.Tests.ServicesserviceProviderMock.Setup(_ => _.GetService(typeof(IAuthenticationService))).Returns(_authServiceMock.Object);- _httpContext = new DefaultHttpContext() { RequestServices = serviceProviderMock.Object };+ _httpContext = new DefaultHttpContext { RequestServices = serviceProviderMock.Object };_httpAccessorMock.Setup(c => c.HttpContext).Returns(_httpContext);}@@ -88,7 +88,7 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task GetAuthenticatedCustomer_UsernameEnableRegisterd_ReturnCustomer(){- var expectedCustomer = new Customer() { Username = "John", Active = true };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerSettings.UsernamesEnabled = true;var cliaim = new Claim(ClaimTypes.Name, "Johny", "", "grandnode");@@ -109,7 +109,7 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task GetAuthenticatedCustomer_UsernameEnableGuests_ReturnNull(){- var expectedCustomer = new Customer() { Username = "John", Active = true };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerSettings.UsernamesEnabled = true;var cliaim = new Claim(ClaimTypes.Name, "Johny", "", "grandnode");IList<Claim> claims = new List<Claim>diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.csindex 8cd155ea3..dfef5a736 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs@@ -40,8 +40,9 @@ namespace Grand.Business.Authentication.Tests.Services_externalAuthenticationProviders = new List<IExternalAuthenticationProvider> { new ExternalAuthenticationProviderTest() };var externalAuthenticationSetting = new ExternalAuthenticationSettings();- externalAuthenticationSetting.ActiveAuthenticationMethodSystemNames = new List<string>();- externalAuthenticationSetting.ActiveAuthenticationMethodSystemNames.Add("ExternalAuthenticationProviderTest");+ externalAuthenticationSetting.ActiveAuthenticationMethodSystemNames = [+ "ExternalAuthenticationProviderTest"+ ];_externalAuthenticationService = new ExternalAuthenticationService(_authenticationServiceMock.Object, _customerManagerServiceMock.Object, _customerServiceMock.Object,_groupServiceMock.Object, _mediatorMock.Object, _externalAuthenticationRecordRepository, _workContextMock.Object, _externalAuthenticationProviders,@@ -97,7 +98,7 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task AssociateCustomerTest(){//Act- await _externalAuthenticationService.AssociateCustomer(new Customer(), new Core.Utilities.Authentication.ExternalAuthParam() { ProviderSystemName = "ExternalAuthenticationProviderTest" });+ await _externalAuthenticationService.AssociateCustomer(new Customer(), new Core.Utilities.Authentication.ExternalAuthParam { ProviderSystemName = "ExternalAuthenticationProviderTest" });//AssertAssert.IsTrue(_externalAuthenticationRecordRepository.Table.Any());}@@ -106,11 +107,11 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task GetCustomerTest(){//Arrange- var expectedCustomer = new Customer() { Username = "John", Active = true };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));- await _externalAuthenticationService.AssociateCustomer(expectedCustomer, new Core.Utilities.Authentication.ExternalAuthParam() { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });+ await _externalAuthenticationService.AssociateCustomer(expectedCustomer, new Core.Utilities.Authentication.ExternalAuthParam { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });//Act- var customer = await _externalAuthenticationService.GetCustomer(new Core.Utilities.Authentication.ExternalAuthParam() { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });+ var customer = await _externalAuthenticationService.GetCustomer(new Core.Utilities.Authentication.ExternalAuthParam { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });//AssertAssert.IsNotNull(customer);Assert.AreEqual(customer.Username, expectedCustomer.Username);@@ -120,8 +121,8 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task GetExternalIdentifiersTest(){//Arrange- var customer = new Customer() { Username = "John", Active = true };- await _externalAuthenticationService.AssociateCustomer(customer, new Core.Utilities.Authentication.ExternalAuthParam() { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });+ var customer = new Customer { Username = "John", Active = true };+ await _externalAuthenticationService.AssociateCustomer(customer, new Core.Utilities.Authentication.ExternalAuthParam { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" });//Actvar result = await _externalAuthenticationService.GetExternalIdentifiers(customer);//Assert@@ -132,8 +133,8 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task DeleteExternalAuthenticationTest(){//Arrange- var customer = new Customer() { Username = "John", Active = true };- var externalAuthParam = new Core.Utilities.Authentication.ExternalAuthParam() { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" };+ var customer = new Customer { Username = "John", Active = true };+ var externalAuthParam = new Core.Utilities.Authentication.ExternalAuthParam { ProviderSystemName = "ExternalAuthenticationProviderTest", Identifier = "1" };await _externalAuthenticationService.AssociateCustomer(customer, externalAuthParam);//Actawait _externalAuthenticationService.DeleteExternalAuthentication(_externalAuthenticationRecordRepository.Table.FirstOrDefault(x=>x.ExternalIdentifier == externalAuthParam.Identifier));diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/JwtBearerCustomerAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/JwtBearerCustomerAuthenticationServiceTests.csindex f26c857ea..bc0d53097 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/JwtBearerCustomerAuthenticationServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/JwtBearerCustomerAuthenticationServiceTests.cs@@ -57,7 +57,7 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task Valid_NullToken_ReturnFalse(){- var expectedCustomer = new Customer() { Username = "John", Active = true };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));var httpContext = new Mock<HttpContext>();@@ -76,7 +76,7 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task Valid_NotActiveCustomer_ReturnFalse(){- var expectedCustomer = new Customer() { Username = "John", Active = true };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));var httpContext = new Mock<HttpContext>();@@ -87,7 +87,7 @@ namespace Grand.Business.Authentication.Tests.Servicesnew Claim("Token", "123")};context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, ""));- _customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = false }));+ _customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = false }));var result = await _jwtBearerCustomerAuthenticationService.Valid(context);Assert.IsFalse(result);Assert.AreEqual(await _jwtBearerCustomerAuthenticationService.ErrorMessage(), "Customer not exists/or not active in the customer table");@@ -96,9 +96,9 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task Valid_NoPermissions_Customer_ReturnFalse(){- var customer = new Customer() { Username = "John", Active = true };+ var customer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(customer));- _refreshTokenServiceMock.Setup(c => c.GetCustomerRefreshToken(customer)).Returns(() => Task.FromResult(new RefreshToken() { IsActive = true, RefreshId = "567", Token = "123" }));+ _refreshTokenServiceMock.Setup(c => c.GetCustomerRefreshToken(customer)).Returns(() => Task.FromResult(new RefreshToken { IsActive = true, RefreshId = "567", Token = "123" }));_permissionServiceMock.Setup(c => c.Authorize(StandardPermission.AllowUseApi, customer)).Returns(() => Task.FromResult(false));var httpContext = new Mock<HttpContext>();var context = new TokenValidatedContext(httpContext.Object, new AuthenticationScheme("", "", typeof(AuthSchemaMock)), new JwtBearerOptions());@@ -117,10 +117,10 @@ namespace Grand.Business.Authentication.Tests.Services[TestMethod()]public async Task Valid_Customer_ReturnTrue(){- var customer = new Customer() { Username = "John", Active = true };- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.PasswordToken, Value = "123", StoreId = "" });+ var customer = new Customer { Username = "John", Active = true };+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.PasswordToken, Value = "123", StoreId = "" });_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult(customer));- _refreshTokenServiceMock.Setup(c => c.GetCustomerRefreshToken(customer)).Returns(() => Task.FromResult(new RefreshToken() { IsActive = true, RefreshId = "567", Token = "123" }));+ _refreshTokenServiceMock.Setup(c => c.GetCustomerRefreshToken(customer)).Returns(() => Task.FromResult(new RefreshToken { IsActive = true, RefreshId = "567", Token = "123" }));_permissionServiceMock.Setup(c => c.Authorize(StandardPermission.AllowUseApi, customer)).Returns(() => Task.FromResult(true));var httpContext = new Mock<HttpContext>();var context = new TokenValidatedContext(httpContext.Object, new AuthenticationScheme("", "", typeof(AuthSchemaMock)), new JwtBearerOptions());diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/RefreshTokenServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/RefreshTokenServiceTests.csindex 5154dcc26..2bdf7b6bd 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/RefreshTokenServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/RefreshTokenServiceTests.cs@@ -17,7 +17,7 @@ namespace Grand.Business.Authentication.Tests.Servicespublic void Init(){_userFieldServiceMock = new Mock<IUserFieldService>();- _service = new RefreshTokenService(_userFieldServiceMock.Object, new Infrastructure.Configuration.FrontendAPIConfig() {+ _service = new RefreshTokenService(_userFieldServiceMock.Object, new Infrastructure.Configuration.FrontendAPIConfig {SecretKey = "JWTRefreshTokenHIGHsecuredPasswordVVVp1OH7Xzyr",ValidIssuer = "http://localhost:4200",ValidAudience = "http://localhost:4200",@@ -58,7 +58,7 @@ namespace Grand.Business.Authentication.Tests.Services{//Arrange_userFieldServiceMock.Setup(c => c.GetFieldsForEntity<RefreshToken>(It.IsAny<BaseEntity>(), It.IsAny<string>(), It.IsAny<string>()))- .Returns(Task.FromResult(new RefreshToken() { Token = "123" }));+ .Returns(Task.FromResult(new RefreshToken { Token = "123" }));//Actvar result = await _service.GetCustomerRefreshToken(new Domain.Customers.Customer());//Assertdiff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/TwoFactorAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/TwoFactorAuthenticationServiceTests.csindex 373c9119a..f754c9e1f 100644--- a/src/Tests/Grand.Business.Authentication.Tests/Services/TwoFactorAuthenticationServiceTests.cs+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/TwoFactorAuthenticationServiceTests.cs@@ -29,12 +29,12 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task GenerateCodeSetupTest_AppVerification(){//Arrange- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());//Actvar result = await _twoFactorAuthenticationService.GenerateCodeSetup(Guid.NewGuid().ToString(),- new Customer() { Email = "[email protected]" },- new Domain.Localization.Language() { LanguageCulture = "en" }, TwoFactorAuthenticationType.AppVerification);+ new Customer { Email = "[email protected]" },+ new Domain.Localization.Language { LanguageCulture = "en" }, TwoFactorAuthenticationType.AppVerification);//AssertAssert.IsTrue(result.CustomValues.ContainsKey("QrCodeImageUrl"));Assert.IsTrue(result.CustomValues.ContainsKey("ManualEntryQrCode"));@@ -43,12 +43,12 @@ namespace Grand.Business.Authentication.Tests.Servicespublic async Task GenerateCodeSetupTest_Email(){//Arrange- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());//Actvar result = await _twoFactorAuthenticationService.GenerateCodeSetup(Guid.NewGuid().ToString(),- new Customer() { Email = "[email protected]" },- new Domain.Localization.Language() { LanguageCulture = "en" }, TwoFactorAuthenticationType.EmailVerification);+ new Customer { Email = "[email protected]" },+ new Domain.Localization.Language { LanguageCulture = "en" }, TwoFactorAuthenticationType.EmailVerification);//AssertAssert.IsTrue(result.CustomValues.ContainsKey("Token"));}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CategoryDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CategoryDeletedEventHandlerTests.csindex 5c5182731..f9e463e24 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CategoryDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CategoryDeletedEventHandlerTests.cs@@ -28,7 +28,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers_mediatorMock = new Mock<IMediator>();_repository = new MongoDBRepositoryTest<Product>();_entityUrlRepository = new MongoDBRepositoryTest<EntityUrl>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_handler = new CategoryDeletedEventHandler(_entityUrlRepository, _repository, _cacheBase);}@@ -40,13 +40,13 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers//Arrangevar category = new Category();var product = new Product();- product.ProductCategories.Add(new ProductCategory() { CategoryId = category.Id });+ product.ProductCategories.Add(new ProductCategory { CategoryId = category.Id });await _repository.InsertAsync(product);var product2 = new Product();- product2.ProductCategories.Add(new ProductCategory() { CategoryId = category.Id });+ product2.ProductCategories.Add(new ProductCategory { CategoryId = category.Id });await _repository.InsertAsync(product2);var product3 = new Product();- product3.ProductCategories.Add(new ProductCategory() { CategoryId = "1" });+ product3.ProductCategories.Add(new ProductCategory { CategoryId = "1" });await _repository.InsertAsync(product3);//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CollectionDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CollectionDeletedEventHandlerTests.csindex f7bfcfc1e..02f4e92d9 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CollectionDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/CollectionDeletedEventHandlerTests.cs@@ -28,7 +28,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers_mediatorMock = new Mock<IMediator>();_repository = new MongoDBRepositoryTest<Product>();_entityUrlRepository = new MongoDBRepositoryTest<EntityUrl>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_handler = new CollectionDeletedEventHandler(_entityUrlRepository, _repository, _cacheBase);}@@ -40,13 +40,13 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers//Arrangevar collection = new Collection();var product = new Product();- product.ProductCollections.Add(new ProductCollection() { CollectionId = collection.Id });+ product.ProductCollections.Add(new ProductCollection { CollectionId = collection.Id });await _repository.InsertAsync(product);var product2 = new Product();- product2.ProductCollections.Add(new ProductCollection() { CollectionId = collection.Id });+ product2.ProductCollections.Add(new ProductCollection { CollectionId = collection.Id });await _repository.InsertAsync(product2);var product3 = new Product();- product3.ProductCollections.Add(new ProductCollection() { CollectionId = "1" });+ product3.ProductCollections.Add(new ProductCollection { CollectionId = "1" });await _repository.InsertAsync(product3);//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DiscountDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DiscountDeletedEventHandlerTests.csindex f9398a582..4b0d749ae 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DiscountDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DiscountDeletedEventHandlerTests.cs@@ -37,7 +37,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers_collectionRepository = new MongoDBRepositoryTest<Collection>();_vendorRepository = new MongoDBRepositoryTest<Vendor>();_discountCouponRepository = new MongoDBRepositoryTest<DiscountCoupon>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_handler = new DiscountDeletedEventHandler(_productRepository, _categoryRepository,_brandRepository, _collectionRepository, _vendorRepository, _discountCouponRepository, _cacheBase);@@ -47,7 +47,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_Product_Test(){//Arrange- var discount = new Discount() { DiscountTypeId = DiscountType.AssignedToSkus };+ var discount = new Discount { DiscountTypeId = DiscountType.AssignedToSkus };var product = new Product();product.AppliedDiscounts.Add(discount.Id);await _productRepository.InsertAsync(product);@@ -65,7 +65,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_Category_Test(){//Arrange- var discount = new Discount() { DiscountTypeId = DiscountType.AssignedToCategories };+ var discount = new Discount { DiscountTypeId = DiscountType.AssignedToCategories };var category = new Category();category.AppliedDiscounts.Add(discount.Id);await _categoryRepository.InsertAsync(category);@@ -84,7 +84,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_Collection_Test(){//Arrange- var discount = new Discount() { DiscountTypeId = DiscountType.AssignedToCollections };+ var discount = new Discount { DiscountTypeId = DiscountType.AssignedToCollections };var collection = new Collection();collection.AppliedDiscounts.Add(discount.Id);await _collectionRepository.InsertAsync(collection);@@ -102,7 +102,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_Vendor_Test(){//Arrange- var discount = new Discount() { DiscountTypeId = DiscountType.AssignedToVendors };+ var discount = new Discount { DiscountTypeId = DiscountType.AssignedToVendors };var vendor = new Vendor();vendor.AppliedDiscounts.Add(discount.Id);await _vendorRepository.InsertAsync(vendor);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductDeletedEventHandlerTests.csindex 39b34d2f7..258be0e82 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductDeletedEventHandlerTests.cs@@ -46,12 +46,12 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers//Arrangevar product = new Product();product.RecommendedProduct.Add("1");- product.RelatedProducts.Add(new RelatedProduct() { ProductId2 = "1" });+ product.RelatedProducts.Add(new RelatedProduct { ProductId2 = "1" });product.CrossSellProduct.Add("1");- product.SimilarProducts.Add(new SimilarProduct() { ProductId2 = "1" });+ product.SimilarProducts.Add(new SimilarProduct { ProductId2 = "1" });await _repository.InsertAsync(product);//Act- await _handler.Handle(new Infrastructure.Events.EntityDeleted<Product>(new Product() { Id = "1" }), CancellationToken.None);+ await _handler.Handle(new Infrastructure.Events.EntityDeleted<Product>(new Product { Id = "1" }), CancellationToken.None);//Assertvar result = _repository.Table.FirstOrDefault(x => x.Id == product.Id);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductPublishEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductPublishEventHandlerTests.csindex 2dffc9588..656764b3d 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductPublishEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/ProductPublishEventHandlerTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_Publish(){//Act- await handlerPublish.Handle(new Core.Events.Catalog.ProductPublishEvent(new Domain.Catalog.Product() { ShowOnHomePage = true }), CancellationToken.None);+ await handlerPublish.Handle(new Core.Events.Catalog.ProductPublishEvent(new Domain.Catalog.Product { ShowOnHomePage = true }), CancellationToken.None);_casheManagerMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), true), Times.Exactly(1));}@@ -33,7 +33,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlerspublic async Task Handle_UnPublish(){//Act- await handlerUnPublish.Handle(new Core.Events.Catalog.ProductUnPublishEvent(new Domain.Catalog.Product() { ShowOnHomePage = true }), CancellationToken.None);+ await handlerUnPublish.Handle(new Core.Events.Catalog.ProductUnPublishEvent(new Domain.Catalog.Product { ShowOnHomePage = true }), CancellationToken.None);_casheManagerMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), true), Times.Exactly(1));}}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/UpdateProductOnCartEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/UpdateProductOnCartEventHandlerTests.csindex bf40e49c9..0c6dbfb4c 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/UpdateProductOnCartEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/UpdateProductOnCartEventHandlerTests.cs@@ -28,8 +28,7 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers//Arrangevar product = new Product();var customer = new Customer();- customer.ShoppingCartItems.Add(new Domain.Orders.ShoppingCartItem()- {+ customer.ShoppingCartItems.Add(new Domain.Orders.ShoppingCartItem {ProductId = product.Id,IsFreeShipping = !product.IsFreeShipping,IsShipEnabled = !product.IsShipEnabled,diff --git a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.csindex 31637ed5b..a83cf30fe 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Extensions/ProductAttributeExtensionsTests.cs@@ -10,11 +10,11 @@ namespace Grand.Business.Catalog.Tests.Extensions[TestMethod()]public void ShouldHaveValues_ReturnExpentedResult(){- var pam = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.TextBox };- var pam2 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var pam3 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.Datepicker };- var pam4 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.FileUpload };- var pam5 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.DropdownList };+ var pam = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.TextBox };+ var pam2 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var pam3 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.Datepicker };+ var pam4 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.FileUpload };+ var pam5 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.DropdownList };ProductAttributeMapping pam6 = null;Assert.AreEqual(false, pam.ShouldHaveValues());Assert.AreEqual(false, pam2.ShouldHaveValues());@@ -28,11 +28,11 @@ namespace Grand.Business.Catalog.Tests.Extensions[TestMethod()]public void ValidationRulesAllowed_ReturnExpentedResult(){- var pam = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.TextBox };- var pam2 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var pam3 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.Datepicker };- var pam4 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.FileUpload };- var pam5 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.DropdownList };+ var pam = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.TextBox };+ var pam2 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var pam3 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.Datepicker };+ var pam4 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.FileUpload };+ var pam5 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.DropdownList };ProductAttributeMapping pam6 = null;Assert.AreEqual(true, pam.ValidationRulesAllowed());Assert.AreEqual(true, pam2.ValidationRulesAllowed());@@ -45,11 +45,11 @@ namespace Grand.Business.Catalog.Tests.Extensions[TestMethod()]public void CanBeUsedAsCondition_ReturnExpentedResult(){- var pam = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.TextBox };- var pam2 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var pam3 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.Datepicker };- var pam4 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.FileUpload };- var pam5 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.DropdownList };+ var pam = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.TextBox };+ var pam2 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var pam3 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.Datepicker };+ var pam4 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.FileUpload };+ var pam5 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.DropdownList };ProductAttributeMapping pam6 = null;Assert.AreEqual(false, pam.CanBeUsedAsCondition());Assert.AreEqual(false, pam2.CanBeUsedAsCondition());@@ -62,13 +62,13 @@ namespace Grand.Business.Catalog.Tests.Extensions[TestMethod()]public void IsNonCombinable_ReturnExpentedResult(){- var pam = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.TextBox };- var pam2 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var pam3 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.Datepicker };- var pam4 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.FileUpload };- var pam5 = new ProductAttributeMapping() { AttributeControlTypeId = AttributeControlType.DropdownList };+ var pam = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.TextBox };+ var pam2 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var pam3 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.Datepicker };+ var pam4 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.FileUpload };+ var pam5 = new ProductAttributeMapping { AttributeControlTypeId = AttributeControlType.DropdownList };ProductAttributeMapping pam6 = null;- var pam7 = new ProductAttributeMapping() { Combination = true };+ var pam7 = new ProductAttributeMapping { Combination = true };Assert.AreEqual(true, pam.IsNonCombinable());Assert.AreEqual(true, pam2.IsNonCombinable());Assert.AreEqual(true, pam4.IsNonCombinable());diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.csindex d5d8cda9c..9acd8d932 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs@@ -32,7 +32,7 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlerspublic async Task HandleTest(){var getRecommendedProductsQuery = new Core.Queries.Catalog.GetRecommendedProductsQuery();- getRecommendedProductsQuery.CustomerGroupIds = new[] { "1" };+ getRecommendedProductsQuery.CustomerGroupIds = ["1"];getRecommendedProductsQuery.StoreId = "1";await handler.Handle(getRecommendedProductsQuery, CancellationToken.None);_casheManagerMock.Verify(c => c.GetAsync(It.IsAny<string>(), It.IsAny<Func<Task<List<Product>>>>()), Times.Once);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.csindex d7d84dc0a..99c22cf63 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs@@ -18,7 +18,7 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlerspublic void Init(){_repository = new MongoDBRepositoryTest<Product>();- handler = new GetSearchProductsQueryHandler(_repository, new Mock<ISpecificationAttributeService>().Object, new CatalogSettings() { IgnoreFilterableSpecAttributeOption = true}, new AccessControlConfig());+ handler = new GetSearchProductsQueryHandler(_repository, new Mock<ISpecificationAttributeService>().Object, new CatalogSettings { IgnoreFilterableSpecAttributeOption = true}, new AccessControlConfig());}@@ -26,7 +26,7 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlerspublic async Task HandleTest(){//Arrange- await _repository.InsertAsync(new Product() { Published = true, VisibleIndividually = true });+ await _repository.InsertAsync(new Product { Published = true, VisibleIndividually = true });var searchProductsQuery = new Core.Queries.Catalog.GetSearchProductsQuery();searchProductsQuery.Customer = new Domain.Customers.Customer();//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.csindex d4baef0c7..a21e5bd96 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs@@ -32,7 +32,7 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlerspublic async Task HandleTest(){var suggestedProductsQuery = new Core.Queries.Catalog.GetSuggestedProductsQuery();- suggestedProductsQuery.CustomerTagIds = new[] { "1" };+ suggestedProductsQuery.CustomerTagIds = ["1"];suggestedProductsQuery.ProductsNumber = 10;await handler.Handle(suggestedProductsQuery, CancellationToken.None);_casheManagerMock.Verify(c => c.GetAsync(It.IsAny<string>(), It.IsAny<Func<Task<List<Product>>>>()), Times.Once);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.csindex fe5e87d76..a84f4dbdc 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs@@ -22,9 +22,9 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlerspublic async Task HandleTest(){//Arrange- await _repository.InsertAsync(new Vendor() { Id = "1" });+ await _repository.InsertAsync(new Vendor { Id = "1" });//Act- var result = await handler.Handle(new Core.Queries.Catalog.GetVendorByIdQuery() { Id = "1" }, CancellationToken.None);+ var result = await handler.Handle(new Core.Queries.Catalog.GetVendorByIdQuery { Id = "1" }, CancellationToken.None);//ArrangeAssert.IsNotNull(result);}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandLayoutServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandLayoutServiceTests.csindex b50a2c1fb..e72e64fe1 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandLayoutServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandLayoutServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brands_repository = new MongoDBRepositoryTest<BrandLayout>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_brandLayoutService = new BrandLayoutService(_repository, _cacheBase, _mediatorMock.Object);}@@ -49,7 +49,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task GetBrandLayoutByIdTest(){//Arrange- var brandLayout = new BrandLayout() {+ var brandLayout = new BrandLayout {Name = "test"};await _brandLayoutService.InsertBrandLayout(brandLayout);@@ -75,7 +75,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task UpdateBrandLayoutTest(){//Arrange- var categoryLayout = new BrandLayout() {+ var categoryLayout = new BrandLayout {Name = "test"};await _brandLayoutService.InsertBrandLayout(categoryLayout);@@ -93,11 +93,11 @@ namespace Grand.Business.Catalog.Tests.Services.Brands{//Arrange- var brandLayout1 = new BrandLayout() {+ var brandLayout1 = new BrandLayout {Name = "test1"};await _brandLayoutService.InsertBrandLayout(brandLayout1);- var brandLayout2 = new BrandLayout() {+ var brandLayout2 = new BrandLayout {Name = "test2"};await _brandLayoutService.InsertBrandLayout(brandLayout2);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.csindex 1aedd2713..d264a4e2d 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs@@ -30,10 +30,10 @@ namespace Grand.Business.Catalog.Tests.Services.Brands_repository = new MongoDBRepositoryTest<Brand>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_brandService = new BrandService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AccessControlConfig());}@@ -42,9 +42,9 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task GetAllBrandsTest(){//Arrange- await _brandService.InsertBrand(new Brand() { Published = true });- await _brandService.InsertBrand(new Brand() { Published = true });- await _brandService.InsertBrand(new Brand() { Published = true });+ await _brandService.InsertBrand(new Brand { Published = true });+ await _brandService.InsertBrand(new Brand { Published = true });+ await _brandService.InsertBrand(new Brand { Published = true });//Actvar brand = await _brandService.GetAllBrands();@@ -57,7 +57,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task GetBrandByIdTest(){//Arrange- var brand = new Brand() {+ var brand = new Brand {Name = "test"};await _brandService.InsertBrand(brand);@@ -83,7 +83,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task UpdateBrandTest(){//Arrange- var brand = new Brand() {+ var brand = new Brand {Name = "test"};await _brandService.InsertBrand(brand);@@ -100,11 +100,11 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task DeleteBrandTest(){//Arrange- var brand1 = new Brand() {+ var brand1 = new Brand {Name = "test1"};await _brandService.InsertBrand(brand1);- var brand2 = new Brand() {+ var brand2 = new Brand {Name = "test2"};await _brandService.InsertBrand(brand2);@@ -121,11 +121,11 @@ namespace Grand.Business.Catalog.Tests.Services.Brandspublic async Task GetAllBrandsByDiscountTest(){//Arrange- var brand1 = new Brand() {+ var brand1 = new Brand {Name = "test1"};await _brandService.InsertBrand(brand1);- var brand2 = new Brand() {+ var brand2 = new Brand {Name = "test2"};brand2.AppliedDiscounts.Add("disc1");diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryLayoutServiceDbTest.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryLayoutServiceDbTest.csindex 46569d8ea..85172f20a 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryLayoutServiceDbTest.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryLayoutServiceDbTest.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories_repository = new MongoDBRepositoryTest<CategoryLayout>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_categoryLayoutService = new CategoryLayoutService(_repository, _cacheBase, _mediatorMock.Object);}@@ -33,7 +33,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic async Task GetCategoryLayoutById(){//Arrange- var categoryLayout1 = new CategoryLayout() {+ var categoryLayout1 = new CategoryLayout {Name = "test1"};await _categoryLayoutService.InsertCategoryLayout(categoryLayout1);@@ -64,11 +64,11 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic async Task DeleteCategoryLayout(){//Arrange- var categoryLayout1 = new CategoryLayout() {+ var categoryLayout1 = new CategoryLayout {Name = "test1"};await _categoryLayoutService.InsertCategoryLayout(categoryLayout1);- var categoryLayout2 = new CategoryLayout() {+ var categoryLayout2 = new CategoryLayout {Name = "test2"};await _categoryLayoutService.InsertCategoryLayout(categoryLayout2);@@ -95,7 +95,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic async Task UpdateCategoryLayout_IsNotNull(){//Arrange- var categoryLayout = new CategoryLayout() {+ var categoryLayout = new CategoryLayout {Name = "test"};await _categoryLayoutService.InsertCategoryLayout(categoryLayout);@@ -112,7 +112,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic async Task UpdateCategoryLayout_IsNull(){//Arrange- var categoryLayout = new CategoryLayout() {+ var categoryLayout = new CategoryLayout {Name = "test"};await _categoryLayoutService.InsertCategoryLayout(categoryLayout);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.csindex 3e6064d37..46e717af5 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceDbTests.cs@@ -35,12 +35,12 @@ namespace Grand.Business.Catalog.Tests.Services.Categories_categoryRepository = new MongoDBRepositoryTest<Category>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();_aclServiceMock = new AclService(new AccessControlConfig());_settings = new CatalogSettings();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_categoryService = new CategoryService(_cacheBase, _categoryRepository, _workContextMock.Object, _mediatorMock.Object, _aclServiceMock, new AccessControlConfig());}@@ -57,7 +57,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic async Task UpdateCategory(){//Arrange- var category = new Category() { Name = "test" };+ var category = new Category { Name = "test" };await _categoryService.InsertCategory(category);category.Name = "test2";//Act@@ -84,7 +84,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { Id = "6", ParentCategoryId = "3", Published = true };+ var category = new Category { Id = "6", ParentCategoryId = "3", Published = true };await _categoryService.InsertCategory(category);var result = await _categoryService.GetCategoryBreadCrumb(category, false);Assert.IsTrue(result.Count == 2);@@ -97,7 +97,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { ParentCategoryId = "3" };+ var category = new Category { ParentCategoryId = "3" };var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);Assert.IsTrue(result.Count == 0);}@@ -172,7 +172,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { Id = "6", ParentCategoryId = "3", Published = true };+ var category = new Category { Id = "6", ParentCategoryId = "3", Published = true };await _categoryService.InsertCategory(category);var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);Assert.IsTrue(result.Count == 2);@@ -185,7 +185,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { Id = "6", ParentCategoryId = "1", Published = true };+ var category = new Category { Id = "6", ParentCategoryId = "1", Published = true };var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);Assert.IsTrue(result.Count == 3);Assert.IsTrue(result.Any(c => c.Id.Equals("6")));@@ -198,7 +198,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesvar exprectedString = "cat5 >> cat1 >> cat6";var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };+ var category = new Category { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };var result = await _categoryService.GetFormattedBreadCrumb(category);Assert.IsTrue(exprectedString.Equals(result));}@@ -208,7 +208,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesvar exprectedString = "cat5 >> cat1 >> cat6";var allCategory = GetMockCategoryList();allCategory.ToList().ForEach(x => _categoryService.InsertCategory(x).GetAwaiter().GetResult());- var category = new Category() { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };+ var category = new Category { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };var result = _categoryService.GetFormattedBreadCrumb(category, allCategory);Assert.IsTrue(exprectedString.Equals(result));}@@ -225,13 +225,12 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesprivate IList<Category> GetMockCategoryList(){- return new List<Category>()- {- new Category(){ Id="1" ,Name="cat1",Published=true,ParentCategoryId="5",FeaturedProductsOnHomePage=true},- new Category(){ Id="2" ,Name="cat2",Published=true,IncludeInMenu = true},- new Category(){ Id="3" ,Name="cat3",Published=true,ShowOnHomePage=true,ShowOnSearchBox=true},- new Category(){ Id="4" ,Name="cat4",Published=true,ShowOnHomePage=true,ShowOnSearchBox=true},- new Category(){ Id="5" ,Name="cat5",Published=true,FeaturedProductsOnHomePage=true}+ return new List<Category> {+ new Category { Id="1" ,Name="cat1",Published=true,ParentCategoryId="5",FeaturedProductsOnHomePage=true},+ new Category { Id="2" ,Name="cat2",Published=true,IncludeInMenu = true},+ new Category { Id="3" ,Name="cat3",Published=true,ShowOnHomePage=true,ShowOnSearchBox=true},+ new Category { Id="4" ,Name="cat4",Published=true,ShowOnHomePage=true,ShowOnSearchBox=true},+ new Category { Id="5" ,Name="cat5",Published=true,FeaturedProductsOnHomePage=true}};}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceTests.csindex 8a8662c07..6b4c059c9 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/CategoryServiceTests.cs@@ -81,7 +81,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic void GetCategoryBreadCrumb_ShouldReturnEmptyList(){var allCategory = GetMockCategoryList();- var category = new Category() { ParentCategoryId = "3" };+ var category = new Category { ParentCategoryId = "3" };_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<Customer>())).Returns(() => true);_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<string>())).Returns(() => true);var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);@@ -92,8 +92,8 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic void GetCategoryBreadCrumb_ShouldReturnTwoElement(){var allCategory = GetMockCategoryList();- var category = new Category() { Id = "6", ParentCategoryId = "3", Published = true };- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ var category = new Category { Id = "6", ParentCategoryId = "3", Published = true };+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<Customer>())).Returns(() => true);_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<string>())).Returns(() => true);var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);@@ -106,8 +106,8 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriespublic void GetCategoryBreadCrumb_ShouldReturnThreeElement(){var allCategory = GetMockCategoryList();- var category = new Category() { Id = "6", ParentCategoryId = "1", Published = true };- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ var category = new Category { Id = "6", ParentCategoryId = "1", Published = true };+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<Customer>())).Returns(() => true);_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<string>())).Returns(() => true);var result = _categoryService.GetCategoryBreadCrumb(category, allCategory);@@ -122,7 +122,7 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{var exprectedString = "cat5 >> cat1 >> cat6";var allCategory = GetMockCategoryList();- var category = new Category() { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };+ var category = new Category { Id = "6", Name = "cat6", ParentCategoryId = "1", Published = true };_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<Customer>())).Returns(() => true);_aclServiceMock.Setup(a => a.Authorize(It.IsAny<Category>(), It.IsAny<string>())).Returns(() => true);var result = _categoryService.GetFormattedBreadCrumb(category, allCategory);@@ -178,13 +178,12 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesprivate IList<Category> GetMockCategoryList(){- return new List<Category>()- {- new Category(){ Id="1" ,Name="cat1",Published=true,ParentCategoryId="5"},- new Category(){ Id="2" ,Name="cat2",Published=true},- new Category(){ Id="3" ,Name="cat3",Published=true},- new Category(){ Id="4" ,Name="cat4",Published=true},- new Category(){ Id="5" ,Name="cat5",Published=true}+ return new List<Category> {+ new Category { Id="1" ,Name="cat1",Published=true,ParentCategoryId="5"},+ new Category { Id="2" ,Name="cat2",Published=true},+ new Category { Id="3" ,Name="cat3",Published=true},+ new Category { Id="4" ,Name="cat4",Published=true},+ new Category { Id="5" ,Name="cat5",Published=true}};}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/ProductCategoryServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/ProductCategoryServiceTests.csindex 37610025d..ff7e2e4ec 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/ProductCategoryServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Categories/ProductCategoryServiceTests.cs@@ -30,10 +30,10 @@ namespace Grand.Business.Catalog.Tests.Services.Categories_repository = new MongoDBRepositoryTest<Product>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productCategoryService = new ProductCategoryService(_repository, _cacheBase, _workContextMock.Object, _mediatorMock.Object, new AccessControlConfig());}@@ -43,12 +43,12 @@ namespace Grand.Business.Catalog.Tests.Services.Categories{//Arrangevar p1 = new Product();- p1.ProductCategories.Add(new ProductCategory() { CategoryId = "1" });- p1.ProductCategories.Add(new ProductCategory() { CategoryId = "2" });+ p1.ProductCategories.Add(new ProductCategory { CategoryId = "1" });+ p1.ProductCategories.Add(new ProductCategory { CategoryId = "2" });await _repository.InsertAsync(p1);var p2 = new Product();- p2.ProductCategories.Add(new ProductCategory() { CategoryId = "2" });- p2.ProductCategories.Add(new ProductCategory() { CategoryId = "3" });+ p2.ProductCategories.Add(new ProductCategory { CategoryId = "2" });+ p2.ProductCategories.Add(new ProductCategory { CategoryId = "3" });await _repository.InsertAsync(p2);//Act@@ -70,8 +70,8 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesawait _repository.InsertAsync(p2);//Act- await _productCategoryService.InsertProductCategory(new ProductCategory() { CategoryId = "1", DisplayOrder = 10 }, p1.Id);- await _productCategoryService.InsertProductCategory(new ProductCategory() { CategoryId = "2" }, p1.Id);+ await _productCategoryService.InsertProductCategory(new ProductCategory { CategoryId = "1", DisplayOrder = 10 }, p1.Id);+ await _productCategoryService.InsertProductCategory(new ProductCategory { CategoryId = "2" }, p1.Id);var pc1 = await _productCategoryService.GetProductCategoriesByCategoryId("1");@@ -90,9 +90,9 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesawait _repository.InsertAsync(p2);//Act- var pc = new ProductCategory() { CategoryId = "1", DisplayOrder = 10 };+ var pc = new ProductCategory { CategoryId = "1", DisplayOrder = 10 };await _productCategoryService.InsertProductCategory(pc, p1.Id);- await _productCategoryService.InsertProductCategory(new ProductCategory() { CategoryId = "2" }, p1.Id);+ await _productCategoryService.InsertProductCategory(new ProductCategory { CategoryId = "2" }, p1.Id);pc.CategoryId = "10";pc.DisplayOrder = 5;@@ -115,9 +115,9 @@ namespace Grand.Business.Catalog.Tests.Services.Categoriesawait _repository.InsertAsync(p2);//Act- var pc = new ProductCategory() { CategoryId = "1", DisplayOrder = 10 };+ var pc = new ProductCategory { CategoryId = "1", DisplayOrder = 10 };await _productCategoryService.InsertProductCategory(pc, p1.Id);- await _productCategoryService.InsertProductCategory(new ProductCategory() { CategoryId = "2" }, p1.Id);+ await _productCategoryService.InsertProductCategory(new ProductCategory { CategoryId = "2" }, p1.Id);await _productCategoryService.DeleteProductCategory(pc, p1.Id);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/CollectionLayoutServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/CollectionLayoutServiceTests.csindex 7ea3e201c..48fe5460c 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/CollectionLayoutServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/CollectionLayoutServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Services.Collections_repository = new MongoDBRepositoryTest<CollectionLayout>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_collectionLayoutService = new CollectionLayoutService(_repository, _cacheBase, _mediatorMock.Object);}@@ -49,7 +49,7 @@ namespace Grand.Business.Catalog.Tests.Services.Collectionspublic async Task GetCollectionLayoutByIdTest(){//Arrange- var collectionLayout = new CollectionLayout() {+ var collectionLayout = new CollectionLayout {Name = "test"};await _collectionLayoutService.InsertCollectionLayout(collectionLayout);@@ -75,7 +75,7 @@ namespace Grand.Business.Catalog.Tests.Services.Collectionspublic async Task UpdateCollectionLayoutTest(){//Arrange- var categoryLayout = new CollectionLayout() {+ var categoryLayout = new CollectionLayout {Name = "test"};await _collectionLayoutService.InsertCollectionLayout(categoryLayout);@@ -93,11 +93,11 @@ namespace Grand.Business.Catalog.Tests.Services.Collections{//Arrange- var collectionLayout1 = new CollectionLayout() {+ var collectionLayout1 = new CollectionLayout {Name = "test1"};await _collectionLayoutService.InsertCollectionLayout(collectionLayout1);- var collectionLayout2 = new CollectionLayout() {+ var collectionLayout2 = new CollectionLayout {Name = "test2"};await _collectionLayoutService.InsertCollectionLayout(collectionLayout2);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/ProductCollectionServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/ProductCollectionServiceTests.csindex af8d8c6ab..ea1edb6a4 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/ProductCollectionServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Collections/ProductCollectionServiceTests.cs@@ -30,10 +30,10 @@ namespace Grand.Business.Catalog.Tests.Services.Collections_repository = new MongoDBRepositoryTest<Product>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productCollectionService = new ProductCollectionService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AccessControlConfig());}@@ -43,12 +43,12 @@ namespace Grand.Business.Catalog.Tests.Services.Collections{//Arrangevar p1 = new Product();- p1.ProductCollections.Add(new ProductCollection() { CollectionId = "1" });- p1.ProductCollections.Add(new ProductCollection() { CollectionId = "2" });+ p1.ProductCollections.Add(new ProductCollection { CollectionId = "1" });+ p1.ProductCollections.Add(new ProductCollection { CollectionId = "2" });await _repository.InsertAsync(p1);var p2 = new Product();- p2.ProductCollections.Add(new ProductCollection() { CollectionId = "2" });- p2.ProductCollections.Add(new ProductCollection() { CollectionId = "3" });+ p2.ProductCollections.Add(new ProductCollection { CollectionId = "2" });+ p2.ProductCollections.Add(new ProductCollection { CollectionId = "3" });await _repository.InsertAsync(p2);//Act@@ -70,8 +70,8 @@ namespace Grand.Business.Catalog.Tests.Services.Collectionsawait _repository.InsertAsync(p2);//Act- await _productCollectionService.InsertProductCollection(new ProductCollection() { CollectionId = "1", DisplayOrder = 10 }, p1.Id);- await _productCollectionService.InsertProductCollection(new ProductCollection() { CollectionId = "2" }, p1.Id);+ await _productCollectionService.InsertProductCollection(new ProductCollection { CollectionId = "1", DisplayOrder = 10 }, p1.Id);+ await _productCollectionService.InsertProductCollection(new ProductCollection { CollectionId = "2" }, p1.Id);var pc1 = await _productCollectionService.GetProductCollectionsByCollectionId("1", "");@@ -90,9 +90,9 @@ namespace Grand.Business.Catalog.Tests.Services.Collectionsawait _repository.InsertAsync(p2);//Act- var pc = new ProductCollection() { CollectionId = "1", DisplayOrder = 10 };+ var pc = new ProductCollection { CollectionId = "1", DisplayOrder = 10 };await _productCollectionService.InsertProductCollection(pc, p1.Id);- await _productCollectionService.InsertProductCollection(new ProductCollection() { CollectionId = "2" }, p1.Id);+ await _productCollectionService.InsertProductCollection(new ProductCollection { CollectionId = "2" }, p1.Id);pc.CollectionId = "10";pc.DisplayOrder = 5;@@ -115,9 +115,9 @@ namespace Grand.Business.Catalog.Tests.Services.Collectionsawait _repository.InsertAsync(p2);//Act- var pc = new ProductCollection() { CollectionId = "1", DisplayOrder = 10 };+ var pc = new ProductCollection { CollectionId = "1", DisplayOrder = 10 };await _productCollectionService.InsertProductCollection(pc, p1.Id);- await _productCollectionService.InsertProductCollection(new ProductCollection() { CollectionId = "2" }, p1.Id);+ await _productCollectionService.InsertProductCollection(new ProductCollection { CollectionId = "2" }, p1.Id);await _productCollectionService.DeleteProductCollection(pc, p1.Id);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountProviderTest.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountProviderTest.csindex 0aea49ebc..4c8dc8934 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountProviderTest.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountProviderTest.cs@@ -39,7 +39,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task<DiscountRuleValidationResult> CheckRequirement(DiscountRuleValidationRequest request){- var result = new DiscountRuleValidationResult() {+ var result = new DiscountRuleValidationResult {IsValid = true};return await Task.FromResult(result);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.csindex cff7e5b67..474da225e 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs@@ -44,10 +44,10 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts_discountUsageHistoryRepository = new MongoDBRepositoryTest<DiscountUsageHistory>();_workContextMock = new Mock<IWorkContext>();_translationServiceMock = new Mock<ITranslationService>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_discountProviders = new List<IDiscountProvider> { new DiscountProviderTest() };_discountAmountProviders = new List<IDiscountAmountProvider> { new DiscountAmountProviderTests() };@@ -60,7 +60,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountByIdTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test"};await _dicountService.InsertDiscount(discount);@@ -77,13 +77,13 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetAllDiscountsTest(){//Arrange- var discount1 = new Discount() {+ var discount1 = new Discount {Name = "test1",IsEnabled = true};await _dicountService.InsertDiscount(discount1);- var discount2 = new Discount() {+ var discount2 = new Discount {Name = "test2",IsEnabled = true};@@ -102,7 +102,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task InsertDiscountTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test"};//Act@@ -118,7 +118,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task UpdateDiscountTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test"};await _dicountService.InsertDiscount(discount);@@ -136,7 +136,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task DeleteDiscountTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test"};await _dicountService.InsertDiscount(discount);@@ -178,13 +178,13 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountByCouponCodeTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};@@ -202,13 +202,13 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ExistsCodeInDiscountTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};@@ -225,23 +225,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetAllCouponCodesByDiscountIdTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountCoupon1 = new DiscountCoupon() {+ var discountCoupon1 = new DiscountCoupon {CouponCode = "TEST124",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon1);- var discountCoupon2 = new DiscountCoupon() {+ var discountCoupon2 = new DiscountCoupon {CouponCode = "TEST125",DiscountId = "id"};@@ -256,23 +256,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountCodeByIdTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountCoupon1 = new DiscountCoupon() {+ var discountCoupon1 = new DiscountCoupon {CouponCode = "TEST124",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon1);- var discountCoupon2 = new DiscountCoupon() {+ var discountCoupon2 = new DiscountCoupon {CouponCode = "TEST125",DiscountId = "id"};@@ -288,23 +288,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountCodeByCodeTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountCoupon1 = new DiscountCoupon() {+ var discountCoupon1 = new DiscountCoupon {CouponCode = "TEST124",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon1);- var discountCoupon2 = new DiscountCoupon() {+ var discountCoupon2 = new DiscountCoupon {CouponCode = "TEST125",DiscountId = "id"};@@ -320,23 +320,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task DeleteDiscountCouponTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountCoupon1 = new DiscountCoupon() {+ var discountCoupon1 = new DiscountCoupon {CouponCode = "TEST124",DiscountId = discount.Id};await _discountCouponRepository.InsertAsync(discountCoupon1);- var discountCoupon2 = new DiscountCoupon() {+ var discountCoupon2 = new DiscountCoupon {CouponCode = "TEST125",DiscountId = "id"};@@ -352,13 +352,13 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task InsertDiscountCouponTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};@@ -373,13 +373,13 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task DiscountCouponSetAsUsedTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id};@@ -397,19 +397,19 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task CancelDiscountTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"@@ -428,22 +428,22 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ValidateDiscountTest_Valid_CouponCodesToValidate(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true,CurrencyCode = "USD"};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);var customer = new Customer();- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST123", StoreId = "" });+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST123", StoreId = "" });//Act- var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency() { CurrencyCode = "USD" });+ var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency { CurrencyCode = "USD" });//AssertAssert.IsTrue(result.IsValid);}@@ -451,23 +451,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ValidateDiscountTest_InValid_CouponCodesToValidate(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true,CurrencyCode = "USD",RequiresCouponCode = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);var customer = new Customer();- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });//Act- var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency() { CurrencyCode = "USD" });+ var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency { CurrencyCode = "USD" });//AssertAssert.IsFalse(result.IsValid);}@@ -475,22 +475,22 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ValidateDiscountTest_InValid_CurrencyCode(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true,CurrencyCode = "EUR"};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);var customer = new Customer();- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });//Act- var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency() { CurrencyCode = "USD" });+ var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency { CurrencyCode = "USD" });//AssertAssert.IsFalse(result.IsValid);}@@ -499,23 +499,23 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ValidateDiscountTest_InValid_EndDateUtc(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true,CurrencyCode = "USD",EndDateUtc = DateTime.UtcNow.AddDays(-1)};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);var customer = new Customer();- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });//Act- var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency() { CurrencyCode = "USD" });+ var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency { CurrencyCode = "USD" });//AssertAssert.IsFalse(result.IsValid);}@@ -523,22 +523,22 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task ValidateDiscountTest_InValid_Disable(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = false,CurrencyCode = "USD"};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);var customer = new Customer();- customer.UserFields.Add(new Domain.Common.UserField() { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });+ customer.UserFields.Add(new Domain.Common.UserField { Key = SystemCustomerFieldNames.DiscountCoupons, Value = "TEST12", StoreId = "" });//Act- var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency() { CurrencyCode = "USD" });+ var result = await _dicountService.ValidateDiscount(discount, customer, new Domain.Directory.Currency { CurrencyCode = "USD" });//AssertAssert.IsFalse(result.IsValid);}@@ -546,19 +546,19 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountUsageHistoryByIdTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"@@ -577,25 +577,25 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetAllDiscountUsageHistoryTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"};await _discountUsageHistoryRepository.InsertAsync(discountUsageHistory);- var discountUsageHistory2 = new DiscountUsageHistory() {+ var discountUsageHistory2 = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "124",CouponCode = "TEST123"@@ -613,19 +613,19 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task InsertDiscountUsageHistoryTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"@@ -644,19 +644,19 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task UpdateDiscountUsageHistoryTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"@@ -677,19 +677,19 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task DeleteDiscountUsageHistoryTest(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",IsEnabled = true};await _dicountService.InsertDiscount(discount);- var discountCoupon = new DiscountCoupon() {+ var discountCoupon = new DiscountCoupon {CouponCode = "TEST123",DiscountId = discount.Id,Used = true};await _discountCouponRepository.InsertAsync(discountCoupon);- var discountUsageHistory = new DiscountUsageHistory() {+ var discountUsageHistory = new DiscountUsageHistory {DiscountId = discount.Id,OrderId = "123",CouponCode = "TEST123"@@ -708,7 +708,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountAmountTest_global(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",DiscountAmount = 10,CurrencyCode = "USD",@@ -719,7 +719,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts//Actvar discountamount = await _dicountService.GetDiscountAmount(discount,new Customer(),- new Domain.Directory.Currency() { CurrencyCode = "USD" },new Product(), 100);+ new Domain.Directory.Currency { CurrencyCode = "USD" },new Product(), 100);//AssertAssert.AreEqual(discount.DiscountAmount, discountamount);@@ -727,7 +727,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountAmountTest_AssignedToAllProducts(){//Arrange- var discount = new Discount() {+ var discount = new Discount {Name = "test",DiscountAmount = 10,CurrencyCode = "USD",@@ -739,7 +739,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts//Actvar discountamount = await _dicountService.GetDiscountAmount(discount,new Customer(),- new Domain.Directory.Currency() { CurrencyCode = "USD" }, new Product(), 100);+ new Domain.Directory.Currency { CurrencyCode = "USD" }, new Product(), 100);//AssertAssert.AreEqual(discount.DiscountAmount, discountamount);@@ -748,7 +748,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetPreferredDiscountTest(){//Arrange- var discount1 = new Discount() {+ var discount1 = new Discount {Name = "test",DiscountAmount = 10,CurrencyCode = "USD",@@ -756,7 +756,7 @@ namespace Grand.Business.Catalog.Tests.Services.DiscountsDiscountTypeId = DiscountType.AssignedToAllProducts};await _dicountService.InsertDiscount(discount1);- var discount2 = new Discount() {+ var discount2 = new Discount {Name = "test",DiscountAmount = 20,CurrencyCode = "USD",@@ -767,11 +767,11 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts//Actvar discountamount = await _dicountService.GetPreferredDiscount(new List<ApplyDiscount> {- new ApplyDiscount() { DiscountId = discount1.Id, IsCumulative = false },- new ApplyDiscount() { DiscountId = discount2.Id, IsCumulative = false }+ new ApplyDiscount { DiscountId = discount1.Id, IsCumulative = false },+ new ApplyDiscount { DiscountId = discount2.Id, IsCumulative = false }},new Customer(),- new Domain.Directory.Currency() { CurrencyCode = "USD" }, new Product(), 100);+ new Domain.Directory.Currency { CurrencyCode = "USD" }, new Product(), 100);//AssertAssert.AreEqual(discount2.DiscountAmount, discountamount.discountAmount);@@ -781,7 +781,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetPreferredDiscountTest_IsCumulative_True(){//Arrange- var discount1 = new Discount() {+ var discount1 = new Discount {Name = "test",DiscountAmount = 10,CurrencyCode = "USD",@@ -789,7 +789,7 @@ namespace Grand.Business.Catalog.Tests.Services.DiscountsDiscountTypeId = DiscountType.AssignedToAllProducts};await _dicountService.InsertDiscount(discount1);- var discount2 = new Discount() {+ var discount2 = new Discount {Name = "test",DiscountAmount = 20,CurrencyCode = "USD",@@ -800,11 +800,11 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts//Actvar discountamount = await _dicountService.GetPreferredDiscount(new List<ApplyDiscount> {- new ApplyDiscount() { DiscountId = discount1.Id, IsCumulative = true },- new ApplyDiscount() { DiscountId = discount2.Id, IsCumulative = true }+ new ApplyDiscount { DiscountId = discount1.Id, IsCumulative = true },+ new ApplyDiscount { DiscountId = discount2.Id, IsCumulative = true }},new Customer(),- new Domain.Directory.Currency() { CurrencyCode = "USD" }, new Product(), 100);+ new Domain.Directory.Currency { CurrencyCode = "USD" }, new Product(), 100);//AssertAssert.AreEqual(discount1.DiscountAmount + discount2.DiscountAmount, discountamount.discountAmount);@@ -814,7 +814,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discountspublic async Task GetDiscountAmountProviderTest(){//Arrange- var discount1 = new Discount() {+ var discount1 = new Discount {Name = "test",DiscountAmount = 10,CurrencyCode = "USD",diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.csindex 38dde4bbd..59b4f9b05 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/BrandImportDataObjectTests.cs@@ -51,11 +51,11 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport_slugServiceMock = new Mock<ISlugService>();_languageServiceMock = new Mock<ILanguageService>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_brandService = new BrandService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AccessControlConfig());_brandImportDataObject = new BrandImportDataObject(_brandService, _pictureServiceMock.Object, _brandLayoutServiceMock.Object, _slugServiceMock.Object, _languageServiceMock.Object, new Domain.Seo.SeoSettings());@@ -66,13 +66,13 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport{//Arrangevar brands = new List<BrandDto>();- brands.Add(new BrandDto() { Name = "test1", Published = true });- brands.Add(new BrandDto() { Name = "test2", Published = true });- brands.Add(new BrandDto() { Name = "test3", Published = true });+ brands.Add(new BrandDto { Name = "test1", Published = true });+ brands.Add(new BrandDto { Name = "test2", Published = true });+ brands.Add(new BrandDto { Name = "test3", Published = true });_brandLayoutServiceMock.Setup(c => c.GetBrandLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new BrandLayout()));- _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout>() { new BrandLayout() }));+ _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout> { new BrandLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _brandImportDataObject.Execute(brands);@@ -85,29 +85,29 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Update(){//Arrange- var brand1 = new Brand() {+ var brand1 = new Brand {Name = "insert1"};await _brandService.InsertBrand(brand1);- var brand2 = new Brand() {+ var brand2 = new Brand {Name = "insert2"};await _brandService.InsertBrand(brand2);- var brand3 = new Brand() {+ var brand3 = new Brand {Name = "insert3"};await _brandService.InsertBrand(brand3);var brands = new List<BrandDto>();- brands.Add(new BrandDto() { Id = brand1.Id, Name = "update1", Published = false, DisplayOrder = 1 });- brands.Add(new BrandDto() { Id = brand2.Id, Name = "update2", Published = false, DisplayOrder = 2 });- brands.Add(new BrandDto() { Id = brand3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ brands.Add(new BrandDto { Id = brand1.Id, Name = "update1", Published = false, DisplayOrder = 1 });+ brands.Add(new BrandDto { Id = brand2.Id, Name = "update2", Published = false, DisplayOrder = 2 });+ brands.Add(new BrandDto { Id = brand3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_brandLayoutServiceMock.Setup(c => c.GetBrandLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new BrandLayout()));- _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout>() { new BrandLayout() }));+ _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout> { new BrandLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _brandImportDataObject.Execute(brands);@@ -124,20 +124,20 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_Update(){//Arrange- var brand3 = new Brand() {+ var brand3 = new Brand {Name = "insert3"};await _brandService.InsertBrand(brand3);var brands = new List<BrandDto>();- brands.Add(new BrandDto() { Name = "update1", Published = false, DisplayOrder = 1 });- brands.Add(new BrandDto() { Name = "update2", Published = false, DisplayOrder = 2 });- brands.Add(new BrandDto() { Id = brand3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ brands.Add(new BrandDto { Name = "update1", Published = false, DisplayOrder = 1 });+ brands.Add(new BrandDto { Name = "update2", Published = false, DisplayOrder = 2 });+ brands.Add(new BrandDto { Id = brand3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_brandLayoutServiceMock.Setup(c => c.GetBrandLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new BrandLayout()));- _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout>() { new BrandLayout() }));+ _brandLayoutServiceMock.Setup(c => c.GetAllBrandLayouts()).Returns(Task.FromResult<IList<BrandLayout>>(new List<BrandLayout> { new BrandLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _brandImportDataObject.Execute(brands);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.csindex f1c8e15fd..2f6e494a8 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CategoryImportDataObjectTests.cs@@ -52,11 +52,11 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport_slugServiceMock = new Mock<ISlugService>();_languageServiceMock = new Mock<ILanguageService>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_categoryService = new CategoryService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AclService(new AccessControlConfig()), new AccessControlConfig());_categoryImportDataObject = new CategoryImportDataObject(_categoryService, _pictureServiceMock.Object, _categoryLayoutServiceMock.Object, _slugServiceMock.Object, _languageServiceMock.Object, new Domain.Seo.SeoSettings());@@ -67,13 +67,13 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport{//Arrangevar categorys = new List<CategoryDto>();- categorys.Add(new CategoryDto() { Name = "test1", Published = true });- categorys.Add(new CategoryDto() { Name = "test2", Published = true });- categorys.Add(new CategoryDto() { Name = "test3", Published = true });+ categorys.Add(new CategoryDto { Name = "test1", Published = true });+ categorys.Add(new CategoryDto { Name = "test2", Published = true });+ categorys.Add(new CategoryDto { Name = "test3", Published = true });_categoryLayoutServiceMock.Setup(c => c.GetCategoryLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CategoryLayout()));- _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout>() { new CategoryLayout() }));+ _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout> { new CategoryLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _categoryImportDataObject.Execute(categorys);@@ -86,29 +86,29 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Update(){//Arrange- var category1 = new Category() {+ var category1 = new Category {Name = "insert1"};await _categoryService.InsertCategory(category1);- var category2 = new Category() {+ var category2 = new Category {Name = "insert2"};await _categoryService.InsertCategory(category2);- var category3 = new Category() {+ var category3 = new Category {Name = "insert3"};await _categoryService.InsertCategory(category3);var categorys = new List<CategoryDto>();- categorys.Add(new CategoryDto() { Id = category1.Id, Name = "update1", Published = false, DisplayOrder = 1 });- categorys.Add(new CategoryDto() { Id = category2.Id, Name = "update2", Published = false, DisplayOrder = 2 });- categorys.Add(new CategoryDto() { Id = category3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ categorys.Add(new CategoryDto { Id = category1.Id, Name = "update1", Published = false, DisplayOrder = 1 });+ categorys.Add(new CategoryDto { Id = category2.Id, Name = "update2", Published = false, DisplayOrder = 2 });+ categorys.Add(new CategoryDto { Id = category3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_categoryLayoutServiceMock.Setup(c => c.GetCategoryLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CategoryLayout()));- _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout>() { new CategoryLayout() }));+ _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout> { new CategoryLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _categoryImportDataObject.Execute(categorys);@@ -125,20 +125,20 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_Update(){//Arrange- var category3 = new Category() {+ var category3 = new Category {Name = "insert3"};await _categoryService.InsertCategory(category3);var categorys = new List<CategoryDto>();- categorys.Add(new CategoryDto() { Name = "update1", Published = false, DisplayOrder = 1 });- categorys.Add(new CategoryDto() { Name = "update2", Published = false, DisplayOrder = 2 });- categorys.Add(new CategoryDto() { Id = category3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ categorys.Add(new CategoryDto { Name = "update1", Published = false, DisplayOrder = 1 });+ categorys.Add(new CategoryDto { Name = "update2", Published = false, DisplayOrder = 2 });+ categorys.Add(new CategoryDto { Id = category3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_categoryLayoutServiceMock.Setup(c => c.GetCategoryLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CategoryLayout()));- _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout>() { new CategoryLayout() }));+ _categoryLayoutServiceMock.Setup(c => c.GetAllCategoryLayouts()).Returns(Task.FromResult<IList<CategoryLayout>>(new List<CategoryLayout> { new CategoryLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _categoryImportDataObject.Execute(categorys);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.csindex 07b8d25f5..db868f6f3 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/CollectionImportDataObjectTests.cs@@ -52,11 +52,11 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport_slugServiceMock = new Mock<ISlugService>();_languageServiceMock = new Mock<ILanguageService>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_collectionService = new CollectionService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AclService(new AccessControlConfig()), new AccessControlConfig());_collectionImportDataObject = new CollectionImportDataObject(_collectionService, _pictureServiceMock.Object, _collectionLayoutServiceMock.Object, _slugServiceMock.Object, _languageServiceMock.Object, new Domain.Seo.SeoSettings());@@ -67,13 +67,13 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport{//Arrangevar collections = new List<CollectionDto>();- collections.Add(new CollectionDto() { Name = "test1", Published = true });- collections.Add(new CollectionDto() { Name = "test2", Published = true });- collections.Add(new CollectionDto() { Name = "test3", Published = true });+ collections.Add(new CollectionDto { Name = "test1", Published = true });+ collections.Add(new CollectionDto { Name = "test2", Published = true });+ collections.Add(new CollectionDto { Name = "test3", Published = true });_collectionLayoutServiceMock.Setup(c => c.GetCollectionLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CollectionLayout()));- _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout>() { new CollectionLayout() }));+ _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout> { new CollectionLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _collectionImportDataObject.Execute(collections);@@ -86,29 +86,29 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Update(){//Arrange- var collection1 = new Collection() {+ var collection1 = new Collection {Name = "insert1"};await _collectionService.InsertCollection(collection1);- var collection2 = new Collection() {+ var collection2 = new Collection {Name = "insert2"};await _collectionService.InsertCollection(collection2);- var collection3 = new Collection() {+ var collection3 = new Collection {Name = "insert3"};await _collectionService.InsertCollection(collection3);var collections = new List<CollectionDto>();- collections.Add(new CollectionDto() { Id = collection1.Id, Name = "update1", Published = false, DisplayOrder = 1 });- collections.Add(new CollectionDto() { Id = collection2.Id, Name = "update2", Published = false, DisplayOrder = 2 });- collections.Add(new CollectionDto() { Id = collection3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ collections.Add(new CollectionDto { Id = collection1.Id, Name = "update1", Published = false, DisplayOrder = 1 });+ collections.Add(new CollectionDto { Id = collection2.Id, Name = "update2", Published = false, DisplayOrder = 2 });+ collections.Add(new CollectionDto { Id = collection3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_collectionLayoutServiceMock.Setup(c => c.GetCollectionLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CollectionLayout()));- _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout>() { new CollectionLayout() }));+ _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout> { new CollectionLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _collectionImportDataObject.Execute(collections);@@ -125,20 +125,20 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_Update(){//Arrange- var collection3 = new Collection() {+ var collection3 = new Collection {Name = "insert3"};await _collectionService.InsertCollection(collection3);var collections = new List<CollectionDto>();- collections.Add(new CollectionDto() { Name = "update1", Published = false, DisplayOrder = 1 });- collections.Add(new CollectionDto() { Name = "update2", Published = false, DisplayOrder = 2 });- collections.Add(new CollectionDto() { Id = collection3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ collections.Add(new CollectionDto { Name = "update1", Published = false, DisplayOrder = 1 });+ collections.Add(new CollectionDto { Name = "update2", Published = false, DisplayOrder = 2 });+ collections.Add(new CollectionDto { Id = collection3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_collectionLayoutServiceMock.Setup(c => c.GetCollectionLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new CollectionLayout()));- _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout>() { new CollectionLayout() }));+ _collectionLayoutServiceMock.Setup(c => c.GetAllCollectionLayouts()).Returns(Task.FromResult<IList<CollectionLayout>>(new List<CollectionLayout> { new CollectionLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _collectionImportDataObject.Execute(collections);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.csindex b8b4e5d73..7091b6e99 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/ExportImport/ProductImportDataObjectTests.cs@@ -77,11 +77,11 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport_productCollectionServiceMock = new Mock<IProductCollectionService>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productService = new ProductService(_cacheBase, _repository, _workContextMock.Object, _mediatorMock.Object, new AclService(new AccessControlConfig()));_productImportDataObject = new ProductImportDataObject@@ -97,27 +97,27 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImport{//Arrangevar products = new List<ProductDto>();- products.Add(new ProductDto() { Name = "test1", Published = true });- products.Add(new ProductDto() { Name = "test2", Published = true });- products.Add(new ProductDto() { Name = "test3", Published = true });+ products.Add(new ProductDto { Name = "test1", Published = true });+ products.Add(new ProductDto { Name = "test2", Published = true });+ products.Add(new ProductDto { Name = "test3", Published = true });_productLayoutServiceMock.Setup(c => c.GetProductLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new ProductLayout()));- _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout>() { new ProductLayout() }));+ _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout> { new ProductLayout() }));_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate>() { new Domain.Shipping.DeliveryDate() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate> { new Domain.Shipping.DeliveryDate() }));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Tax.TaxCategory()));- _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory>() { new Domain.Tax.TaxCategory() }));+ _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory> { new Domain.Tax.TaxCategory() }));_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse>() { new Domain.Shipping.Warehouse() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse> { new Domain.Shipping.Warehouse() }));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Directory.MeasureUnit()));- _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit>() { new Domain.Directory.MeasureUnit() }));+ _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit> { new Domain.Directory.MeasureUnit() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _productImportDataObject.Execute(products);@@ -131,42 +131,42 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Update(){//Arrange- var product1 = new Product() {+ var product1 = new Product {Name = "insert1"};await _productService.InsertProduct(product1);- var product2 = new Product() {+ var product2 = new Product {Name = "insert2"};await _productService.InsertProduct(product2);- var product3 = new Product() {+ var product3 = new Product {Name = "insert3"};await _productService.InsertProduct(product3);var products = new List<ProductDto>();- products.Add(new ProductDto() { Id = product1.Id, Name = "update1", Published = false, DisplayOrder = 1 });- products.Add(new ProductDto() { Id = product2.Id, Name = "update2", Published = false, DisplayOrder = 2 });- products.Add(new ProductDto() { Id = product3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ products.Add(new ProductDto { Id = product1.Id, Name = "update1", Published = false, DisplayOrder = 1 });+ products.Add(new ProductDto { Id = product2.Id, Name = "update2", Published = false, DisplayOrder = 2 });+ products.Add(new ProductDto { Id = product3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_productLayoutServiceMock.Setup(c => c.GetProductLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new ProductLayout()));- _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout>() { new ProductLayout() }));+ _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout> { new ProductLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate>() { new Domain.Shipping.DeliveryDate() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate> { new Domain.Shipping.DeliveryDate() }));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Tax.TaxCategory()));- _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory>() { new Domain.Tax.TaxCategory() }));+ _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory> { new Domain.Tax.TaxCategory() }));_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse>() { new Domain.Shipping.Warehouse() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse> { new Domain.Shipping.Warehouse() }));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Directory.MeasureUnit()));- _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit>() { new Domain.Directory.MeasureUnit() }));+ _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit> { new Domain.Directory.MeasureUnit() }));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _productImportDataObject.Execute(products);@@ -183,33 +183,33 @@ namespace Grand.Business.Catalog.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_Update(){//Arrange- var product3 = new Product() {+ var product3 = new Product {Name = "insert3"};await _productService.InsertProduct(product3);var products = new List<ProductDto>();- products.Add(new ProductDto() { Name = "update1", Published = false, DisplayOrder = 1 });- products.Add(new ProductDto() { Name = "update2", Published = false, DisplayOrder = 2 });- products.Add(new ProductDto() { Id = product3.Id, Name = "update3", Published = false, DisplayOrder = 3 });+ products.Add(new ProductDto { Name = "update1", Published = false, DisplayOrder = 1 });+ products.Add(new ProductDto { Name = "update2", Published = false, DisplayOrder = 2 });+ products.Add(new ProductDto { Id = product3.Id, Name = "update3", Published = false, DisplayOrder = 3 });_productLayoutServiceMock.Setup(c => c.GetProductLayoutById(It.IsAny<string>())).Returns(Task.FromResult(new ProductLayout()));- _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout>() { new ProductLayout() }));+ _productLayoutServiceMock.Setup(c => c.GetAllProductLayouts()).Returns(Task.FromResult<IList<ProductLayout>>(new List<ProductLayout> { new ProductLayout() }));_languageServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));_deliveryDateServiceMock.Setup(c => c.GetDeliveryDateById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.DeliveryDate()));- _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate>() { new Domain.Shipping.DeliveryDate() }));+ _deliveryDateServiceMock.Setup(c => c.GetAllDeliveryDates()).Returns(Task.FromResult<IList<Domain.Shipping.DeliveryDate>>(new List<Domain.Shipping.DeliveryDate> { new Domain.Shipping.DeliveryDate() }));_taxServiceMock.Setup(c => c.GetTaxCategoryById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Tax.TaxCategory()));- _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory>() { new Domain.Tax.TaxCategory() }));+ _taxServiceMock.Setup(c => c.GetAllTaxCategories()).Returns(Task.FromResult<IList<Domain.Tax.TaxCategory>>(new List<Domain.Tax.TaxCategory> { new Domain.Tax.TaxCategory() }));_warehouseServiceMock.Setup(c => c.GetWarehouseById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Shipping.Warehouse()));- _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse>() { new Domain.Shipping.Warehouse() }));+ _warehouseServiceMock.Setup(c => c.GetAllWarehouses()).Returns(Task.FromResult<IList<Domain.Shipping.Warehouse>>(new List<Domain.Shipping.Warehouse> { new Domain.Shipping.Warehouse() }));_measureServiceMock.Setup(c => c.GetMeasureUnitById(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Directory.MeasureUnit()));- _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit>() { new Domain.Directory.MeasureUnit() }));+ _measureServiceMock.Setup(c => c.GetAllMeasureUnits()).Returns(Task.FromResult<IList<Domain.Directory.MeasureUnit>>(new List<Domain.Directory.MeasureUnit> { new Domain.Directory.MeasureUnit() }));- _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl() { Slug = "slug" }));+ _slugServiceMock.Setup(c => c.GetBySlug(It.IsAny<string>())).Returns(Task.FromResult(new Domain.Seo.EntityUrl { Slug = "slug" }));//Actawait _productImportDataObject.Execute(products);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.csindex c9d7edf58..611bc0ffb 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs@@ -136,7 +136,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 49.99 });+ product.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 49.99 });var currency = new Currency { Id = "1", CurrencyCode = "USD", Rate = 1, Published = true, MidpointRoundId = System.MidpointRounding.ToEven, RoundingTypeId = RoundingType.Rounding001 };var customer = new Customer();@@ -156,7 +156,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 49.99 });+ product.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 49.99 });//TierPrice is simply "the more you buy, the less you pay"product.TierPrices.Add(new TierPrice { Price = 10, Quantity = 10, CurrencyCode = "USD" });product.TierPrices.Add(new TierPrice { Price = 2, Quantity = 200, CurrencyCode = "USD" });@@ -196,7 +196,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 49.99 });+ product.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 49.99 });var customer = new Customer();//additional charge +1000@@ -214,7 +214,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 49.99 });+ product.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 49.99 });var customer = new Customer();var discount001 = new Discount {@@ -230,11 +230,11 @@ namespace Grand.Business.Catalog.Tests.Services.Pricesproduct.AppliedDiscounts.Add(discount001.Id);- tempDiscountServiceMock.Setup(x => x.ValidateDiscount(discount001, customer, _currency)).ReturnsAsync(new DiscountValidationResult() { IsValid = true });+ tempDiscountServiceMock.Setup(x => x.ValidateDiscount(discount001, customer, _currency)).ReturnsAsync(new DiscountValidationResult { IsValid = true });tempDiscountServiceMock.Setup(x => x.GetAllDiscounts(DiscountType.AssignedToCategories, "1", _currency.CurrencyCode, "", "", false)).ReturnsAsync(new List<Discount>());tempDiscountServiceMock.Setup(x => x.GetAllDiscounts(DiscountType.AssignedToCollections, "1", _currency.CurrencyCode, "", "", false)).ReturnsAsync(new List<Discount>());tempDiscountServiceMock.Setup(x => x.GetAllDiscounts(DiscountType.AssignedToAllProducts, "1", _currency.CurrencyCode, "", "", false)).ReturnsAsync(new List<Discount>());- tempDiscountServiceMock.Setup(x => x.GetAllDiscounts(DiscountType.AssignedToSkus, "1", _currency.CurrencyCode, "", "", false)).ReturnsAsync(new List<Discount>() { discount001 });+ tempDiscountServiceMock.Setup(x => x.GetAllDiscounts(DiscountType.AssignedToSkus, "1", _currency.CurrencyCode, "", "", false)).ReturnsAsync(new List<Discount> { discount001 });var discountAmount = discount001.DiscountAmount;tempDiscountServiceMock.Setup(x => x.GetPreferredDiscount(It.IsAny<List<ApplyDiscount>>(), customer, _currency, product, 49.99)).ReturnsAsync((new List<ApplyDiscount>(), 10));@@ -259,7 +259,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product001.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 49.99 });+ product001.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 49.99 });tempProductService.Setup(x => x.GetProductById("242422", false)).ReturnsAsync(product001);@@ -287,7 +287,7 @@ namespace Grand.Business.Catalog.Tests.Services.PricesEnteredPrice = false,Published = true};- product001.ProductPrices.Add(new ProductPrice() { CurrencyCode = "USD", Price = 55.11 });+ product001.ProductPrices.Add(new ProductPrice { CurrencyCode = "USD", Price = 55.11 });tempProductService.Setup(x => x.GetProductById("242422", false)).ReturnsAsync(product001);var customer001 = new Customer { Id = "98767" };diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/AuctionServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/AuctionServiceTests.csindex fa3ee2e08..d227aa8e3 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/AuctionServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/AuctionServiceTests.cs@@ -32,10 +32,10 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repository = new MongoDBRepositoryTest<Bid>();_productrepository = new MongoDBRepositoryTest<Product>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_auctionService = new AuctionService(_repository, _productrepository, _cacheBase, _mediatorMock.Object);}@@ -43,7 +43,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetBidTest(){//Arrange- var bid = new Bid() {+ var bid = new Bid {Amount = 10};await _auctionService.InsertBid(bid);@@ -60,13 +60,13 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetLatestBidTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",Date = DateTime.UtcNow.AddDays(-1)};await _auctionService.InsertBid(bid1);- var bid2 = new Bid() {+ var bid2 = new Bid {Amount = 12,ProductId = "1",Date = DateTime.UtcNow@@ -85,13 +85,13 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetBidsByProductIdTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",Date = DateTime.UtcNow.AddDays(-1)};await _auctionService.InsertBid(bid1);- var bid2 = new Bid() {+ var bid2 = new Bid {Amount = 12,ProductId = "1",Date = DateTime.UtcNow@@ -110,14 +110,14 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetBidsByCustomerIdTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",Date = DateTime.UtcNow.AddDays(-1)};await _auctionService.InsertBid(bid1);- var bid2 = new Bid() {+ var bid2 = new Bid {Amount = 12,ProductId = "1",CustomerId = "2",@@ -137,7 +137,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task InsertBidTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",@@ -154,7 +154,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateBidTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",@@ -172,7 +172,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteBidTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",@@ -203,12 +203,12 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetAuctionsToEndTest(){//Arrange- var product1 = new Product() {+ var product1 = new Product {ProductTypeId = ProductType.Auction,AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1)};_productrepository.Insert(product1);- var product2 = new Product() {+ var product2 = new Product {ProductTypeId = ProductType.Auction,AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(-1)};@@ -225,7 +225,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateAuctionEndedTest(){//Arrange- var product1 = new Product() {+ var product1 = new Product {ProductTypeId = ProductType.Auction,AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1)};@@ -242,7 +242,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task NewBidTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",@@ -250,7 +250,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products};await _auctionService.InsertBid(bid1);//Act- await _auctionService.NewBid(new Customer() { Id = "1" }, new Product() { Id = "1" }, new Domain.Stores.Store(), new Domain.Localization.Language(), "", 12);+ await _auctionService.NewBid(new Customer { Id = "1" }, new Product { Id = "1" }, new Domain.Stores.Store(), new Domain.Localization.Language(), "", 12);//AssertAssert.AreEqual(12, _repository.Table.Where(x => x.ProductId == "1").Max(x => x.Amount));}@@ -259,7 +259,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task CancelBidByOrderTest(){//Arrange- var bid1 = new Bid() {+ var bid1 = new Bid {Amount = 10,ProductId = "1",CustomerId = "1",diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/CopyProductServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/CopyProductServiceTests.csindex c0b6a5c07..e40b2f815 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/CopyProductServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/CopyProductServiceTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task CopyProduct_InserAndReturnNewProduct(){_langServiceMock.Setup(c => c.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult<IList<Language>>(new List<Language>()));- var product = new Product() {+ var product = new Product {Name = "name",Price = 49,ShortDescription = "Desc"diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/InventoryManageServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/InventoryManageServiceTests.csindex df6aeb468..12e42ec4d 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/InventoryManageServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/InventoryManageServiceTests.cs@@ -41,11 +41,11 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repositoryInventoryJournal = new MongoDBRepositoryTest<InventoryJournal>();_workContextMock = new Mock<IWorkContext>();_translationService = new Mock<ITranslationService>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();_settings = new CatalogSettings();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_stockQuantityService = new StockQuantityService();_inventoryManageService = new InventoryManageService(_repository, _repositoryInventoryJournal, _stockQuantityService, _cacheBase, _mediatorMock.Object, _settings);}@@ -56,7 +56,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task AdjustReservedTest_ManageStock_Reserve(){//Arrange- var product = new Product() {+ var product = new Product {ManageInventoryMethodId = ManageInventoryMethod.ManageStock,ReservedQuantity = 5};@@ -72,7 +72,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task AdjustReservedTest_ManageStock_UnblockReserved(){//Arrange- var product = new Product() {+ var product = new Product {ManageInventoryMethodId = ManageInventoryMethod.ManageStock,ReservedQuantity = 10};@@ -88,7 +88,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task BookReservedInventoryTest_ManageStock(){//Arrange- var product = new Product() {+ var product = new Product {ManageInventoryMethodId = ManageInventoryMethod.ManageStock,StockQuantity = 10,ReservedQuantity = 10@@ -96,7 +96,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsawait _repository.InsertAsync(product);var shipment = new Shipment();- var shipmentItem = new Domain.Shipping.ShipmentItem() { Quantity = 10 };+ var shipmentItem = new Domain.Shipping.ShipmentItem { Quantity = 10 };//Actawait _inventoryManageService.BookReservedInventory(product, shipment, shipmentItem);@@ -110,7 +110,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task ReverseBookedInventoryTest(){//Arrange- var product = new Product() {+ var product = new Product {ManageInventoryMethodId = ManageInventoryMethod.ManageStock,StockQuantity = 10,ReservedQuantity = 10@@ -118,7 +118,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsawait _repository.InsertAsync(product);var shipment = new Shipment();- var shipmentItem = new Domain.Shipping.ShipmentItem() { Quantity = 10 };+ var shipmentItem = new Domain.Shipping.ShipmentItem { Quantity = 10 };await _inventoryManageService.BookReservedInventory(product, shipment, shipmentItem);//Act@@ -135,7 +135,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateStockProductTest(){//Arrange- var product = new Product() {+ var product = new Product {ManageInventoryMethodId = ManageInventoryMethod.ManageStock,StockQuantity = 0,ReservedQuantity = 0diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/OutOfStockSubscriptionServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/OutOfStockSubscriptionServiceTests.csindex 477ff7426..9c91202c9 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/OutOfStockSubscriptionServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/OutOfStockSubscriptionServiceTests.cs@@ -35,13 +35,13 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetAllSubscriptionsByCustomerIdTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1"};- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1"};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2"};await _repository.InsertAsync(outOfStockSubscription1);@@ -58,19 +58,19 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task FindSubscriptionTest_IsNotNull(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",WarehouseId = ""};- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1",ProductId = "2",StoreId = "",WarehouseId = ""};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2",ProductId = "3",StoreId = "",@@ -90,19 +90,19 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task FindSubscriptionTest_IsNull(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",WarehouseId = ""};- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1",ProductId = "2",StoreId = "",WarehouseId = ""};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2",ProductId = "3",StoreId = "",@@ -122,19 +122,19 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetSubscriptionByIdTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",WarehouseId = ""};- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1",ProductId = "2",StoreId = "",WarehouseId = ""};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2",ProductId = "3",StoreId = "",@@ -156,7 +156,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task InsertSubscriptionTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",@@ -174,7 +174,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateSubscriptionTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",@@ -192,7 +192,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteSubscriptionTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",@@ -211,19 +211,19 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task SendNotificationsToSubscribersTest(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",WarehouseId = ""};- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1",ProductId = "2",StoreId = "",WarehouseId = ""};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2",ProductId = "1",StoreId = "",@@ -235,7 +235,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsawait _repository.InsertAsync(outOfStockSubscription3);//Act- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(new Product() { Id = "1" }, "");+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(new Product { Id = "1" }, "");//Assert_mediatorMock.Verify(c => c.Send(It.IsAny<SendNotificationsToSubscribersCommand>(), default), Times.AtLeastOnce);@@ -245,21 +245,21 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task SendNotificationsToSubscribersTest1(){//Arange- var outOfStockSubscription1 = new OutOfStockSubscription() {+ var outOfStockSubscription1 = new OutOfStockSubscription {CustomerId = "1",ProductId = "1",StoreId = "",WarehouseId = ""};- outOfStockSubscription1.Attributes.Add(new CustomAttribute() { Key = "MyKey", Value = "1" });+ outOfStockSubscription1.Attributes.Add(new CustomAttribute { Key = "MyKey", Value = "1" });- var outOfStockSubscription2 = new OutOfStockSubscription() {+ var outOfStockSubscription2 = new OutOfStockSubscription {CustomerId = "1",ProductId = "2",StoreId = "",WarehouseId = ""};- var outOfStockSubscription3 = new OutOfStockSubscription() {+ var outOfStockSubscription3 = new OutOfStockSubscription {CustomerId = "2",ProductId = "1",StoreId = "",@@ -270,7 +270,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsawait _repository.InsertAsync(outOfStockSubscription3);//Act- await _outOfStockSubscriptionService.SendNotificationsToSubscribers(new Product() { Id = "1" }, new CustomAttribute[] { new CustomAttribute { Key = "MyKey", Value = "1" } }, "");+ await _outOfStockSubscriptionService.SendNotificationsToSubscribers(new Product { Id = "1" }, new CustomAttribute[] { new CustomAttribute { Key = "MyKey", Value = "1" } }, "");//Assert_mediatorMock.Verify(c => c.Send(It.IsAny<SendNotificationsToSubscribersCommand>(), default), Times.AtLeastOnce);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeFormatterTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeFormatterTests.csindex a6a7fd2ff..e1db74aa6 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeFormatterTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeFormatterTests.cs@@ -36,10 +36,10 @@ namespace Grand.Business.Catalog.Tests.Services.ProductsCommonPath.BaseDirectory = "";_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_productAttributeServiceMock = new Mock<IProductAttributeService>();- _productAttributeServiceMock.Setup(x => x.GetProductAttributeById(It.IsAny<string>())).Returns(Task.FromResult(new ProductAttribute() { Name = "test" }));+ _productAttributeServiceMock.Setup(x => x.GetProductAttributeById(It.IsAny<string>())).Returns(Task.FromResult(new ProductAttribute { Name = "test" }));_translationServiceMock = new Mock<ITranslationService>();_translationServiceMock.Setup(x => x.GetResource("GiftVoucherAttribute.From.Virtual")).Returns("Name {0}, Email {1}");_translationServiceMock.Setup(x => x.GetResource("GiftVoucherAttribute.For.Virtual")).Returns("RecName {0}, RecEmail {1}");@@ -68,15 +68,14 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task FormatAttributesTest_GiftVoucher(){//Arrange- var product = new Product() { GiftVoucherTypeId = GiftVoucherType.Virtual, IsGiftVoucher = true };+ var product = new Product { GiftVoucherTypeId = GiftVoucherType.Virtual, IsGiftVoucher = true };//Act- var result = await _productAttributeFormatter.FormatAttributes(product, new List<CustomAttribute>()- {- new CustomAttribute() { Key = "RecipientName", Value = "John" },- new CustomAttribute() { Key = "RecipientEmail", Value = "[email protected]" },- new CustomAttribute() { Key = "SenderName", Value = "Will" },- new CustomAttribute() { Key = "SenderEmail", Value = "[email protected]" },- new CustomAttribute() { Key = "Message", Value = "" }+ var result = await _productAttributeFormatter.FormatAttributes(product, new List<CustomAttribute> {+ new CustomAttribute { Key = "RecipientName", Value = "John" },+ new CustomAttribute { Key = "RecipientEmail", Value = "[email protected]" },+ new CustomAttribute { Key = "SenderName", Value = "Will" },+ new CustomAttribute { Key = "SenderEmail", Value = "[email protected]" },+ new CustomAttribute { Key = "Message", Value = "" }});//AssertAssert.AreEqual("Will <[email protected]><br />John <[email protected]>", result);@@ -86,13 +85,12 @@ namespace Grand.Business.Catalog.Tests.Services.Products{//Arrangevar product = new Product();- var productAttributeMapping = new ProductAttributeMapping() { Id = "1", AttributeControlTypeId = AttributeControlType.Checkboxes };- productAttributeMapping.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "1", Name = "aa" });+ var productAttributeMapping = new ProductAttributeMapping { Id = "1", AttributeControlTypeId = AttributeControlType.Checkboxes };+ productAttributeMapping.ProductAttributeValues.Add(new ProductAttributeValue { Id = "1", Name = "aa" });product.ProductAttributeMappings.Add(productAttributeMapping);//Act- var result = await _productAttributeFormatter.FormatAttributes(product, new List<CustomAttribute>()- {- new CustomAttribute() { Key = "1", Value = "1" }+ var result = await _productAttributeFormatter.FormatAttributes(product, new List<CustomAttribute> {+ new CustomAttribute { Key = "1", Value = "1" }});//AssertAssert.AreEqual("test: aa", result);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeParserTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeParserTests.csindex bc599da0c..7a96e0ee1 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeParserTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeParserTests.cs@@ -12,21 +12,20 @@ namespace Grand.Business.Catalog.Tests.Services.Products[TestInitialize()]public void Init(){- customAtr = new List<CustomAttribute>()- {- new CustomAttribute(){Key="key1",Value="value1" },- new CustomAttribute(){Key="key2",Value="value2" },- new CustomAttribute(){Key="key3",Value="value3" },- new CustomAttribute(){Key="key4",Value="value4" }- };+ customAtr = [+ new CustomAttribute { Key = "key1", Value = "value1" },+ new CustomAttribute { Key = "key2", Value = "value2" },+ new CustomAttribute { Key = "key3", Value = "value3" },+ new CustomAttribute { Key = "key4", Value = "value4" }+ ];}[TestMethod()]public void ParseProductAttributeMappings_ReturnExpectedValues(){var product = new Product();- product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key1" });- product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key2" });+ product.ProductAttributeMappings.Add(new ProductAttributeMapping { Id = "key1" });+ product.ProductAttributeMappings.Add(new ProductAttributeMapping { Id = "key2" });var result = product.ParseProductAttributeMappings(customAtr);Assert.IsTrue(result.Any(c => c.Id.Equals("key1")));@@ -39,8 +38,8 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic void ParseProductAttributeMappings_ReturnEmptyList(){var product = new Product();- product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key10" });- product.ProductAttributeMappings.Add(new ProductAttributeMapping() { Id = "key12" });+ product.ProductAttributeMappings.Add(new ProductAttributeMapping { Id = "key10" });+ product.ProductAttributeMappings.Add(new ProductAttributeMapping { Id = "key12" });var result = product.ParseProductAttributeMappings(customAtr);Assert.IsTrue(result.Count == 0);}@@ -49,11 +48,11 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic void ParseProductAttributeValues_ReturnExpectedValues(){var product = new Product();- var mapping1 = new ProductAttributeMapping() { Id = "key1" };- mapping1.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "value1" });+ var mapping1 = new ProductAttributeMapping { Id = "key1" };+ mapping1.ProductAttributeValues.Add(new ProductAttributeValue { Id = "value1" });product.ProductAttributeMappings.Add(mapping1);- var mapping2 = new ProductAttributeMapping() { Id = "key2" };- mapping2.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "value2" });+ var mapping2 = new ProductAttributeMapping { Id = "key2" };+ mapping2.ProductAttributeValues.Add(new ProductAttributeValue { Id = "value2" });product.ProductAttributeMappings.Add(mapping2);var result = product.ParseProductAttributeValues(customAtr);@@ -73,7 +72,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products[TestMethod()]public void AddProductAttribute_ReturnExpectedValues(){- var result = ProductExtensions.AddProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key6" }, "value6");+ var result = ProductExtensions.AddProductAttribute(customAtr, new ProductAttributeMapping { Id = "key6" }, "value6");Assert.IsTrue(result.Count == 5);Assert.IsTrue(result.Last().Value.Equals("value6"));}@@ -81,7 +80,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products[TestMethod()]public void RemoveProductAttribute_ReturnExpectedValues(){- var result = ProductExtensions.RemoveProductAttribute(customAtr, new ProductAttributeMapping() { Id = "key1" });+ var result = ProductExtensions.RemoveProductAttribute(customAtr, new ProductAttributeMapping { Id = "key1" });Assert.IsTrue(result.Count == 3);Assert.IsFalse(result.Any(c => c.Key.Equals("key1")));}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeServiceTests.csindex d587869eb..cd5ab4bbe 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductAttributeServiceTests.cs@@ -29,7 +29,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repository = new MongoDBRepositoryTest<Product>();_repositoryproductAttribute = new MongoDBRepositoryTest<ProductAttribute>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productAttributeService = new ProductAttributeService(_cacheBase, _repositoryproductAttribute, _repository, _mediatorMock.Object);}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductCourseServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductCourseServiceTests.csindex 78e9e8005..362e191ce 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductCourseServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductCourseServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetCourseByProductIdTest(){//Arrange- var course1 = new Course() { ProductId = "1" };+ var course1 = new Course { ProductId = "1" };await _courseRepository.InsertAsync(course1);//Actvar result = await _courseService.GetCourseByProductId("1");@@ -40,7 +40,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetProductByCourseIdTest(){//Arrange- var product = new Product() { CourseId = "1", Id = "1"};+ var product = new Product { CourseId = "1", Id = "1"};await _repository.InsertAsync(product);//Actvar result = await _courseService.GetProductByCourseId("1");@@ -55,7 +55,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateCourseOnProductTest(){//Arrange- var product = new Product() { CourseId = "1", Id = "1" };+ var product = new Product { CourseId = "1", Id = "1" };await _repository.InsertAsync(product);//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductLayoutServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductLayoutServiceTests.csindex e0f7a3718..2c4314c12 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductLayoutServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductLayoutServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repository = new MongoDBRepositoryTest<ProductLayout>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productLayoutService = new ProductLayoutService(_repository, _cacheBase, _mediatorMock.Object);}@@ -49,7 +49,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetProductLayoutByIdTest(){//Arrange- var productLayout = new ProductLayout() {+ var productLayout = new ProductLayout {Name = "test"};await _productLayoutService.InsertProductLayout(productLayout);@@ -75,7 +75,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateProductLayoutTest(){//Arrange- var categoryLayout = new ProductLayout() {+ var categoryLayout = new ProductLayout {Name = "test"};await _productLayoutService.InsertProductLayout(categoryLayout);@@ -92,11 +92,11 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteProductLayoutTest(){//Arrange- var productLayout1 = new ProductLayout() {+ var productLayout1 = new ProductLayout {Name = "test1"};await _productLayoutService.InsertProductLayout(productLayout1);- var productLayout2 = new ProductLayout() {+ var productLayout2 = new ProductLayout {Name = "test2"};await _productLayoutService.InsertProductLayout(productLayout2);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReservationServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReservationServiceTests.csindex 9c590312f..c365c5efd 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReservationServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReservationServiceTests.cs@@ -31,9 +31,9 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetProductReservationsByProductIdTest(){//Arrange- await _repository.InsertAsync(new ProductReservation() { ProductId = "1" });- await _repository.InsertAsync(new ProductReservation() { ProductId = "1" });- await _repository.InsertAsync(new ProductReservation() { ProductId = "2" });+ await _repository.InsertAsync(new ProductReservation { ProductId = "1" });+ await _repository.InsertAsync(new ProductReservation { ProductId = "1" });+ await _repository.InsertAsync(new ProductReservation { ProductId = "2" });//Actvar result = await _service.GetProductReservationsByProductId("1", null, null);@@ -44,7 +44,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task InsertProductReservationTest(){//Arrange- var p = new ProductReservation() { ProductId = "1" };+ var p = new ProductReservation { ProductId = "1" };//Actawait _service.InsertProductReservation(p);//Assert@@ -55,7 +55,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateProductReservationTest(){//Arrange- var p = new ProductReservation() { ProductId = "1" };+ var p = new ProductReservation { ProductId = "1" };await _repository.InsertAsync(p);//Actp.ProductId = "2";@@ -68,7 +68,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteProductReservationTest(){//Arrange- var p = new ProductReservation() { ProductId = "1" };+ var p = new ProductReservation { ProductId = "1" };await _repository.InsertAsync(p);//Actawait _service.DeleteProductReservation(p);@@ -80,7 +80,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetProductReservationTest(){//Arrange- var p = new ProductReservation() { ProductId = "1" };+ var p = new ProductReservation { ProductId = "1" };await _repository.InsertAsync(p);//Actvar result = await _service.GetProductReservation(p.Id);@@ -116,8 +116,8 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task CancelReservationsByOrderIdTest(){//Arrange- await _repository.InsertAsync(new ProductReservation() { OrderId = "1" });- await _repository.InsertAsync(new ProductReservation() { OrderId = "2" });+ await _repository.InsertAsync(new ProductReservation { OrderId = "1" });+ await _repository.InsertAsync(new ProductReservation { OrderId = "2" });//Actawait _service.CancelReservationsByOrderId("1");//Assert@@ -128,7 +128,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetCustomerReservationsHelperByIdTest(){//Arrange- var p = new CustomerReservationsHelper() { CustomerId = "1" };+ var p = new CustomerReservationsHelper { CustomerId = "1" };await _repositoryCustomerReservationsHelper.InsertAsync(p);//Actvar result = await _service.GetCustomerReservationsHelperById(p.Id);@@ -141,9 +141,9 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetCustomerReservationsHelpersTest(){//Arrange- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { CustomerId = "1" });- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { CustomerId = "1" });- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { CustomerId = "2" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { CustomerId = "1" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { CustomerId = "1" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { CustomerId = "2" });//Actvar result = await _service.GetCustomerReservationsHelpers("1");//Assert@@ -155,9 +155,9 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetCustomerReservationsHelperBySciIdTest(){//Arrange- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { ShoppingCartItemId = "1" });- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { ShoppingCartItemId = "1" });- await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper() { CustomerId = "2" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { ShoppingCartItemId = "1" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { ShoppingCartItemId = "1" });+ await _repositoryCustomerReservationsHelper.InsertAsync(new CustomerReservationsHelper { CustomerId = "2" });//Actvar result = await _service.GetCustomerReservationsHelperBySciId("1");//Assertdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.csindex fe0acf01b..4e0149d13 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs@@ -29,10 +29,10 @@ namespace Grand.Business.Catalog.Tests.Services.Products{//Arrange- await _repository.InsertAsync(new ProductReview(){ CustomerId = "1" });- await _repository.InsertAsync(new ProductReview(){ CustomerId = "1"});- await _repository.InsertAsync(new ProductReview(){ });- await _repository.InsertAsync(new ProductReview(){ });+ await _repository.InsertAsync(new ProductReview { CustomerId = "1" });+ await _repository.InsertAsync(new ProductReview { CustomerId = "1"});+ await _repository.InsertAsync(new ProductReview { });+ await _repository.InsertAsync(new ProductReview { });//Actvar result = await _productReviewService.GetAllProductReviews("1", null);@@ -54,7 +54,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateProductReviewTest(){//Arrange- var productReview = new ProductReview() {+ var productReview = new ProductReview {ReviewText = "test"};await _productReviewService.InsertProductReview(productReview);@@ -71,7 +71,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteProductReviewTest(){//Arrange- var productReview = new ProductReview() {+ var productReview = new ProductReview {ReviewText = "test"};await _productReviewService.InsertProductReview(productReview);@@ -87,7 +87,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetProductReviewByIdTest(){//Arrange- var productReview = new ProductReview() {+ var productReview = new ProductReview {ReviewText = "test"};await _productReviewService.InsertProductReview(productReview);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductServiceTests.csindex 2c441d8cd..2655cffb4 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductServiceTests.cs@@ -35,7 +35,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products_productRepository = new MongoDBRepositoryTest<Product>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_mediatorMock = new Mock<IMediator>();@@ -43,27 +43,27 @@ namespace Grand.Business.Catalog.Tests.Services.Products.Returns(Task.FromResult(new Product()));_aclServiceMock = new AclService(new AccessControlConfig());- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productService = new ProductService(_cacheBase, _productRepository, _workContextMock.Object, _mediatorMock.Object, _aclServiceMock);}private async Task insertSampleProducts(){- await _productRepository.InsertAsync(new Product() { Id = "1", Published = true, VisibleIndividually = true, ShowOnHomePage = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true, ShowOnHomePage = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true, BestSeller = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true, BestSeller = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true, Sku = "test123" });- await _productRepository.InsertAsync(new Product() { Published = true, VisibleIndividually = true, ParentGroupedProductId = "1" });-- var product = new Product() { Published = true, VisibleIndividually = true };+ await _productRepository.InsertAsync(new Product { Id = "1", Published = true, VisibleIndividually = true, ShowOnHomePage = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true, ShowOnHomePage = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true, BestSeller = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true, BestSeller = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true, Sku = "test123" });+ await _productRepository.InsertAsync(new Product { Published = true, VisibleIndividually = true, ParentGroupedProductId = "1" });++ var product = new Product { Published = true, VisibleIndividually = true };product.AppliedDiscounts.Add("1");- product.ProductCategories.Add(new ProductCategory() { CategoryId = "1" });- product.ProductAttributeMappings.Add(new ProductAttributeMapping() { ProductAttributeId = "1" });+ product.ProductCategories.Add(new ProductCategory { CategoryId = "1" });+ product.ProductAttributeMappings.Add(new ProductAttributeMapping { ProductAttributeId = "1" });await _productRepository.InsertAsync(product);}@@ -133,7 +133,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products{await insertSampleProducts();//Act- var result = await _productService.GetProductsByIds(new[] { "1" });+ var result = await _productService.GetProductsByIds(["1"]);//AssertAssert.IsTrue(result.Count > 0);@@ -156,7 +156,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task InsertProductTest(){//Arrange- var product = new Product() { Id = "1" };+ var product = new Product { Id = "1" };await _productService.InsertProduct(product);//Act@@ -170,7 +170,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateProductTest(){//Arrange- var product = new Product() { Id = "103", Name = "test" };+ var product = new Product { Id = "103", Name = "test" };await _productService.InsertProduct(product);//Act@@ -187,7 +187,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteProductTest(){//Arrange- var product = new Product() { Id = "1" };+ var product = new Product { Id = "1" };await _productService.InsertProduct(product);//Act@@ -202,7 +202,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UnPublishProductTest(){//Arrange- var product = new Product() { Id = "100", Published = true };+ var product = new Product { Id = "100", Published = true };await _productService.InsertProduct(product);//Act@@ -323,7 +323,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsvar product = new Product();await _productService.InsertProduct(product);//Act- await _productService.InsertRelatedProduct(new RelatedProduct() { ProductId2 = "2" }, product.Id);+ await _productService.InsertRelatedProduct(new RelatedProduct { ProductId2 = "2" }, product.Id);var result = await _productService.GetProductById(product.Id);@@ -338,7 +338,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var relatedproducts = new RelatedProduct() { ProductId2 = "2" };+ var relatedproducts = new RelatedProduct { ProductId2 = "2" };await _productService.InsertRelatedProduct(relatedproducts, product.Id);//Act@@ -356,7 +356,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var relatedproducts = new RelatedProduct() { ProductId2 = "2" };+ var relatedproducts = new RelatedProduct { ProductId2 = "2" };await _productService.InsertRelatedProduct(relatedproducts, product.Id);//Act@@ -395,7 +395,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var similarProduct = new SimilarProduct() { ProductId1 = product.Id, ProductId2 = "2" };+ var similarProduct = new SimilarProduct { ProductId1 = product.Id, ProductId2 = "2" };await _productService.InsertSimilarProduct(similarProduct);//Act@@ -415,7 +415,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var similarProduct = new SimilarProduct() { ProductId1 = product.Id, ProductId2 = "2" };+ var similarProduct = new SimilarProduct { ProductId1 = product.Id, ProductId2 = "2" };await _productService.InsertSimilarProduct(similarProduct);//Act@@ -451,7 +451,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var bundleProduct = new BundleProduct() { ProductId = "2" };+ var bundleProduct = new BundleProduct { ProductId = "2" };await _productService.InsertBundleProduct(bundleProduct, product.Id);//Act@@ -471,7 +471,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var bundleProduct = new BundleProduct() { ProductId = "2" };+ var bundleProduct = new BundleProduct { ProductId = "2" };await _productService.InsertBundleProduct(bundleProduct, product.Id);//Act@@ -529,11 +529,11 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetCrossSellProductsByShoppingCartTest(){//Arrange- var product = new Product() { Published = true, VisibleIndividually = true };+ var product = new Product { Published = true, VisibleIndividually = true };await _productService.InsertProduct(product);- var product2 = new Product() { Published = true, VisibleIndividually = true };+ var product2 = new Product { Published = true, VisibleIndividually = true };await _productService.InsertProduct(product2);- var product3 = new Product() { Published = true, VisibleIndividually = true };+ var product3 = new Product { Published = true, VisibleIndividually = true };await _productService.InsertProduct(product3);//Actawait _productService.InsertCrossSellProduct(new CrossSellProduct {@@ -546,7 +546,7 @@ namespace Grand.Business.Catalog.Tests.Services.ProductsProductId2 = product3.Id});- var result = await _productService.GetCrossSellProductsByShoppingCart(new List<ShoppingCartItem> { new ShoppingCartItem() { ProductId = product.Id } }, 2);+ var result = await _productService.GetCrossSellProductsByShoppingCart(new List<ShoppingCartItem> { new ShoppingCartItem { ProductId = product.Id } }, 2);//AssertAssert.IsNotNull(result);@@ -595,7 +595,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productsawait _productService.InsertProduct(product);//Act- await _productService.InsertTierPrice(new TierPrice() { Price = 10, Quantity = 1 }, product.Id);+ await _productService.InsertTierPrice(new TierPrice { Price = 10, Quantity = 1 }, product.Id);var result = await _productService.GetProductById(product.Id);@@ -610,7 +610,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var tierprice = new TierPrice() { Price = 10, Quantity = 1 };+ var tierprice = new TierPrice { Price = 10, Quantity = 1 };await _productService.InsertTierPrice(tierprice, product.Id);//Act@@ -630,7 +630,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var tierprice = new TierPrice() { Price = 10, Quantity = 1 };+ var tierprice = new TierPrice { Price = 10, Quantity = 1 };await _productService.InsertTierPrice(tierprice, product.Id);//Act@@ -648,7 +648,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPrice = new ProductPrice() { Price = 10, CurrencyCode = "USD", ProductId = product.Id };+ var productPrice = new ProductPrice { Price = 10, CurrencyCode = "USD", ProductId = product.Id };//Actawait _productService.InsertProductPrice(productPrice);@@ -666,7 +666,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPrice = new ProductPrice() { Price = 10, CurrencyCode = "USD", ProductId = product.Id };+ var productPrice = new ProductPrice { Price = 10, CurrencyCode = "USD", ProductId = product.Id };await _productService.InsertProductPrice(productPrice);//Act@@ -687,7 +687,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPrice = new ProductPrice() { Price = 10, CurrencyCode = "USD", ProductId = product.Id };+ var productPrice = new ProductPrice { Price = 10, CurrencyCode = "USD", ProductId = product.Id };await _productService.InsertProductPrice(productPrice);//Act@@ -706,7 +706,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPicture = new ProductPicture() { PictureId = "1" };+ var productPicture = new ProductPicture { PictureId = "1" };//Actawait _productService.InsertProductPicture(productPicture, product.Id);@@ -724,7 +724,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPicture = new ProductPicture() { PictureId = "1" };+ var productPicture = new ProductPicture { PictureId = "1" };await _productService.InsertProductPicture(productPicture, product.Id);//Act@@ -745,7 +745,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productPicture = new ProductPicture() { PictureId = "1" };+ var productPicture = new ProductPicture { PictureId = "1" };await _productService.InsertProductPicture(productPicture, product.Id);//Act@@ -764,7 +764,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productWarehouseInventory = new ProductWarehouseInventory() { WarehouseId = "1" };+ var productWarehouseInventory = new ProductWarehouseInventory { WarehouseId = "1" };//Actawait _productService.InsertProductWarehouseInventory(productWarehouseInventory, product.Id);@@ -782,7 +782,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productWarehouseInventory = new ProductWarehouseInventory() { WarehouseId = "1" };+ var productWarehouseInventory = new ProductWarehouseInventory { WarehouseId = "1" };await _productService.InsertProductWarehouseInventory(productWarehouseInventory, product.Id);//Act@@ -803,7 +803,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products//Arrangevar product = new Product();await _productService.InsertProduct(product);- var productWarehouseInventory = new ProductWarehouseInventory() { WarehouseId = "1" };+ var productWarehouseInventory = new ProductWarehouseInventory { WarehouseId = "1" };await _productService.InsertProductWarehouseInventory(productWarehouseInventory, product.Id);//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.csindex da06d9d42..2c69df054 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs@@ -29,7 +29,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repositoryProductTag = new MongoDBRepositoryTest<ProductTag>();_productRepository = new MongoDBRepositoryTest<Product>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_productTagService = new ProductTagService(_repositoryProductTag, _productRepository, _cacheBase, _mediatorMock.Object);}@@ -54,7 +54,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products{//Arrangeawait _repositoryProductTag.InsertAsync(new ProductTag());- await _repositoryProductTag.InsertAsync(new ProductTag() { Id = "1", Name = "test" });+ await _repositoryProductTag.InsertAsync(new ProductTag { Id = "1", Name = "test" });await _repositoryProductTag.InsertAsync(new ProductTag());//Act@@ -70,7 +70,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products{//Arrangeawait _repositoryProductTag.InsertAsync(new ProductTag());- await _repositoryProductTag.InsertAsync(new ProductTag() { Id = "1", Name = "test" });+ await _repositoryProductTag.InsertAsync(new ProductTag { Id = "1", Name = "test" });await _repositoryProductTag.InsertAsync(new ProductTag());//Act@@ -86,7 +86,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products{//Arrangeawait _repositoryProductTag.InsertAsync(new ProductTag());- await _repositoryProductTag.InsertAsync(new ProductTag() { Id = "1", Name = "test", SeName = "test" });+ await _repositoryProductTag.InsertAsync(new ProductTag { Id = "1", Name = "test", SeName = "test" });await _repositoryProductTag.InsertAsync(new ProductTag());//Actdiff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/RecentlyViewedProductsServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/RecentlyViewedProductsServiceTests.csindex 5f89dbdf5..c3a838643 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/RecentlyViewedProductsServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/RecentlyViewedProductsServiceTests.cs@@ -27,9 +27,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repository = new MongoDBRepositoryTest<RecentlyViewedProduct>();_mediatorMock = new Mock<IMediator>();_productServiceMock = new Mock<IProductService>();- _productServiceMock.Setup(a => a.GetProductsByIds(It.IsAny<string[]>(), false)).Returns(() => Task.FromResult((IList<Product>)new List<Product>() { new Product() { Id = "1", Published = true }, new Product() { Id = "2", Published = true }, new Product() { Id = "3", Published = true } }));- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});- _service = new RecentlyViewedProductsService(_productServiceMock.Object, _cacheBase, new CatalogSettings() { RecentlyViewedProductsEnabled = true, RecentlyViewedProductsNumber = 10 }, _repository);+ _productServiceMock.Setup(a => a.GetProductsByIds(It.IsAny<string[]>(), false)).Returns(() => Task.FromResult((IList<Product>)new List<Product> { new Product { Id = "1", Published = true }, new Product { Id = "2", Published = true }, new Product { Id = "3", Published = true } }));+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});+ _service = new RecentlyViewedProductsService(_productServiceMock.Object, _cacheBase, new CatalogSettings { RecentlyViewedProductsEnabled = true, RecentlyViewedProductsNumber = 10 }, _repository);}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/SpecificationAttributeServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/SpecificationAttributeServiceTests.csindex bfb1236b9..8425e31ed 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/SpecificationAttributeServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/SpecificationAttributeServiceTests.cs@@ -30,8 +30,8 @@ namespace Grand.Business.Catalog.Tests.Services.Products_repositoryProduct = new MongoDBRepositoryTest<Product>();_mediatorMock = new Mock<IMediator>();_productServiceMock = new Mock<IProductService>();- _productServiceMock.Setup(a => a.GetProductsByIds(It.IsAny<string[]>(), false)).Returns(() => Task.FromResult((IList<Product>)new List<Product>() { new Product() { Id = "1", Published = true }, new Product() { Id = "2", Published = true }, new Product() { Id = "3", Published = true } }));- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _productServiceMock.Setup(a => a.GetProductsByIds(It.IsAny<string[]>(), false)).Returns(() => Task.FromResult((IList<Product>)new List<Product> { new Product { Id = "1", Published = true }, new Product { Id = "2", Published = true }, new Product { Id = "3", Published = true } }));+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});service = new SpecificationAttributeService(_cacheBase, _repository, _repositoryProduct, _mediatorMock.Object);}@@ -39,7 +39,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetSpecificationAttributeByIdTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test"};await service.InsertSpecificationAttribute(specificationAttribute);@@ -56,7 +56,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetSpecificationAttributeBySeNameTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};@@ -90,7 +90,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task InsertSpecificationAttributeTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};@@ -106,7 +106,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task UpdateSpecificationAttributeTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};@@ -124,7 +124,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteSpecificationAttributeTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};@@ -141,7 +141,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task GetSpecificationAttributeByOptionIdTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};@@ -161,7 +161,7 @@ namespace Grand.Business.Catalog.Tests.Services.Productspublic async Task DeleteSpecificationAttributeOptionTest(){//Arrange- var specificationAttribute = new SpecificationAttribute() {+ var specificationAttribute = new SpecificationAttribute {Name = "test",SeName = "test"};diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/StockQuantityServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/StockQuantityServiceTests.csindex 8808b58a8..e14d444e3 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/StockQuantityServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/StockQuantityServiceTests.cs@@ -137,7 +137,7 @@ namespace Grand.Business.Catalog.Tests.Services.ProductsDisplayStockQuantity = true};//Act- var result = _stockQuantityService.GetTotalStockQuantityForCombination(product, new ProductAttributeCombination() { StockQuantity = 10 });+ var result = _stockQuantityService.GetTotalStockQuantityForCombination(product, new ProductAttributeCombination { StockQuantity = 10 });//AssertAssert.AreEqual(10, result);}diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxCategoryServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxCategoryServiceTests.csindex d980eac6c..4733436b9 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxCategoryServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxCategoryServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Catalog.Tests.Services.Tax_repository = new MongoDBRepositoryTest<TaxCategory>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_taxCategoryService = new TaxCategoryService(_cacheBase, _repository, _mediatorMock.Object);}@@ -50,7 +50,7 @@ namespace Grand.Business.Catalog.Tests.Services.Taxpublic async Task GetTaxCategoryByIdTest(){//Arrange- var taxCategory = new TaxCategory() {+ var taxCategory = new TaxCategory {Name = "test1"};await _repository.InsertAsync(taxCategory);@@ -77,7 +77,7 @@ namespace Grand.Business.Catalog.Tests.Services.Taxpublic async Task UpdateTaxCategoryTest(){//Arrange- var tax = new TaxCategory() {+ var tax = new TaxCategory {Name = "test"};await _taxCategoryService.InsertTaxCategory(tax);@@ -95,7 +95,7 @@ namespace Grand.Business.Catalog.Tests.Services.Taxpublic async Task DeleteTaxCategoryTest(){//Arrange- var tax = new TaxCategory() {+ var tax = new TaxCategory {Name = "test"};await _taxCategoryService.InsertTaxCategory(tax);diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/VatServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/VatServiceTests.csindex 851b8d1b2..4cb73f54a 100644--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/VatServiceTests.cs+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/VatServiceTests.cs@@ -13,7 +13,7 @@ namespace Grand.Business.Catalog.Tests.Services.Tax[TestInitialize()]public void Init(){- _taxSettings = new TaxSettings() { EuVatAssumeValid = true, EuVatUseWebService = false };+ _taxSettings = new TaxSettings { EuVatAssumeValid = true, EuVatUseWebService = false };_vatService = new VatService(_taxSettings);}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ActivatedValueForPurchasedGiftVouchersCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ActivatedValueForPurchasedGiftVouchersCommandHandlerTests.csindex 952f949d1..6ec8414c2 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ActivatedValueForPurchasedGiftVouchersCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ActivatedValueForPurchasedGiftVouchersCommandHandlerTests.cs@@ -31,16 +31,16 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders[TestMethod]public async Task Handle_InvokeExpectedMethods(){- var command = new ActivatedValueForPurchasedGiftVouchersCommand() {+ var command = new ActivatedValueForPurchasedGiftVouchersCommand {Order = new Order()};- var gift = new GiftVoucher() { RecipientEmail = "fdsf", SenderEmail = "aaa", IsGiftVoucherActivated = false };+ var gift = new GiftVoucher { RecipientEmail = "fdsf", SenderEmail = "aaa", IsGiftVoucherActivated = false };command.Activate = true;- command.Order.OrderItems.Add(new OrderItem() { });+ command.Order.OrderItems.Add(new OrderItem { });_langService.Setup(c => c.GetLanguageById(It.IsAny<string>())).ReturnsAsync(new Language());_giftVoucherMock.Setup(c => c.GetAllGiftVouchers(It.IsAny<string>(), It.IsAny<DateTime?>(), It.IsAny<DateTime?>(),It.IsAny<bool?>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))- .ReturnsAsync(new PagedList<GiftVoucher>() { gift });+ .ReturnsAsync(new PagedList<GiftVoucher> { gift });await _handler.Handle(command, default);Assert.IsTrue(gift.IsGiftVoucherActivated);@@ -51,16 +51,16 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders[TestMethod]public async Task Handle_Deactivate(){- var command = new ActivatedValueForPurchasedGiftVouchersCommand() {+ var command = new ActivatedValueForPurchasedGiftVouchersCommand {Order = new Order()};- var gift = new GiftVoucher() { RecipientEmail = "fdsf", SenderEmail = "aaa", IsGiftVoucherActivated = true };+ var gift = new GiftVoucher { RecipientEmail = "fdsf", SenderEmail = "aaa", IsGiftVoucherActivated = true };command.Activate = false;- command.Order.OrderItems.Add(new OrderItem() { });+ command.Order.OrderItems.Add(new OrderItem { });_langService.Setup(c => c.GetLanguageById(It.IsAny<string>())).ReturnsAsync(new Language());_giftVoucherMock.Setup(c => c.GetAllGiftVouchers(It.IsAny<string>(), It.IsAny<DateTime?>(), It.IsAny<DateTime?>(),It.IsAny<bool?>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()))- .ReturnsAsync(new PagedList<GiftVoucher>() { gift });+ .ReturnsAsync(new PagedList<GiftVoucher> { gift });await _handler.Handle(command, default);Assert.IsFalse(gift.IsGiftVoucherActivated);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.csindex 8116996cd..7d05eb46d 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs@@ -28,23 +28,22 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderscommand.Customer = new Domain.Customers.Customer();command.RentalStartDate = DateTime.UtcNow.AddDays(1).Date;command.RentalEndDate = DateTime.UtcNow.AddDays(2).Date;- command.Product = new Domain.Catalog.Product() {+ command.Product = new Domain.Catalog.Product {IncBothDate = true,IntervalUnitId = IntervalUnit.Day};- command.ShoppingCartItem = new Domain.Orders.ShoppingCartItem() { };+ command.ShoppingCartItem = new Domain.Orders.ShoppingCartItem { };_productReservationServiceMock.Setup(c => c.GetProductReservationsByProductId(It.IsAny<string>(), true, null, 0, int.MaxValue)).Returns(() => Task.FromResult((IPagedList<ProductReservation>)- new PagedList<ProductReservation>() {- new ProductReservation() { Date = DateTime.UtcNow.AddDays(4).Date, Resource = "" },- new ProductReservation() { Date = DateTime.UtcNow.AddDays(3).Date, Resource = "" },- new ProductReservation() { Date = DateTime.UtcNow.AddDays(2).Date, Resource = "" },- new ProductReservation() { Date = DateTime.UtcNow.AddDays(1).Date, Resource = "" },- new ProductReservation() { Date = DateTime.UtcNow.Date, Resource = "" } }+ new PagedList<ProductReservation> {+ new ProductReservation { Date = DateTime.UtcNow.AddDays(4).Date, Resource = "" },+ new ProductReservation { Date = DateTime.UtcNow.AddDays(3).Date, Resource = "" },+ new ProductReservation { Date = DateTime.UtcNow.AddDays(2).Date, Resource = "" },+ new ProductReservation { Date = DateTime.UtcNow.AddDays(1).Date, Resource = "" },+ new ProductReservation { Date = DateTime.UtcNow.Date, Resource = "" } }));- _productReservationServiceMock.Setup(c => c.GetCustomerReservationsHelpers(It.IsAny<string>())).ReturnsAsync((IList<CustomerReservationsHelper>)- new List<CustomerReservationsHelper>() { });+ _productReservationServiceMock.Setup(c => c.GetCustomerReservationsHelpers(It.IsAny<string>())).ReturnsAsync(new List<CustomerReservationsHelper> { });//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.csindex 793979904..d61349f14 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs@@ -34,13 +34,13 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders//Arrangevar command = new Core.Commands.Checkout.Orders.AddRequiredProductsCommand();command.Customer = new Domain.Customers.Customer();- command.Customer.ShoppingCartItems.Add(new ShoppingCartItem() { ProductId = "1", ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "" });- command.Product = new Domain.Catalog.Product() { Id = "1", RequireOtherProducts = true, RequiredProductIds = "2,3", AutoAddRequiredProducts = true };+ command.Customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "1", ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "" });+ command.Product = new Domain.Catalog.Product { Id = "1", RequireOtherProducts = true, RequiredProductIds = "2,3", AutoAddRequiredProducts = true };command.ShoppingCartType = ShoppingCartType.ShoppingCart;command.StoreId = "";- _productServiceMock.Setup(a => a.GetProductById("2", false)).Returns(() => Task.FromResult(new Product() { Id = "2", Published = true, Price = 10 }));- _productServiceMock.Setup(a => a.GetProductById("3", false)).Returns(() => Task.FromResult(new Product() { Id = "3", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById("2", false)).Returns(() => Task.FromResult(new Product { Id = "2", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById("3", false)).Returns(() => Task.FromResult(new Product { Id = "3", Published = true, Price = 10 }));//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.csindex 8f61bbb61..22c5926e1 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs@@ -43,8 +43,8 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{//Arrangevar command = new AwardLoyaltyPointsCommand();- command.Order = new Domain.Orders.Order() { StoreId = "", OrderNumber = 1 };- var expectedCustomer = new Customer() { Username = "John", Active = true };+ command.Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1 };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));_currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).Returns(() => Task.FromResult(new Domain.Directory.Currency()));_currencyServiceMock.Setup(c => c.ConvertToPrimaryStoreCurrency(100, It.IsAny<Currency>())).Returns(() => Task.FromResult((double)100));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CalculateLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CalculateLoyaltyPointsCommandHandlerTests.csindex 68dacfa8f..d4a4ecf1a 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CalculateLoyaltyPointsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CalculateLoyaltyPointsCommandHandlerTests.cs@@ -23,7 +23,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{_settings.Enabled = true;_settings.PointsForPurchases_Amount = 20;- var command = new CalculateLoyaltyPointsCommand() {+ var command = new CalculateLoyaltyPointsCommand {Customer = null};var result = await _handler.Handle(command, default);@@ -35,7 +35,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{_settings.Enabled = false;_settings.PointsForPurchases_Amount = 20;- var command = new CalculateLoyaltyPointsCommand() {+ var command = new CalculateLoyaltyPointsCommand {Customer = new Domain.Customers.Customer()};var result = await _handler.Handle(command, default);@@ -48,7 +48,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders_settings.Enabled = true;_settings.PointsForPurchases_Amount = 10;_settings.PointsForPurchases_Points = 2;- var command = new CalculateLoyaltyPointsCommand() {+ var command = new CalculateLoyaltyPointsCommand {Customer = new Domain.Customers.Customer(),Amount = 100};diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.csindex fe7067c9f..791e8ab0f 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs@@ -58,7 +58,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic void Handle_AlreadyCancelled_ThrowException(){var command = new CancelOrderCommand();- command.Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Cancelled };+ command.Order = new Order { OrderStatusId = (int)OrderStatusSystem.Cancelled };Assert.ThrowsExceptionAsync<Exception>(async () => await _handler.Handle(command, default));}@@ -66,7 +66,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task Handle_InvokeExpectedMethods(){var command = new CancelOrderCommand();- command.Order = new Order() {+ command.Order = new Order {Id = "id"};_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder("id")).ReturnsAsync(new List<Shipment>());diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.csindex 32ad64327..4c9cac1d9 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs@@ -40,13 +40,13 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){var command = new CancelOrderItemCommand();- command.Order = new Order() {+ command.Order = new Order {Id = "id"};- command.OrderItem = new OrderItem() { OpenQty = 1, Status = OrderItemStatus.Open };+ command.OrderItem = new OrderItem { OpenQty = 1, Status = OrderItemStatus.Open };_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder(It.IsAny<string>())).ReturnsAsync(new List<Shipment>());- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "2", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "2", Published = true, Price = 10 }));await _handler.Handle(command, default);_inventoryMock.Verify(c => c.AdjustReserved(It.IsAny<Product>(), It.IsAny<int>(), It.IsAny<IList<CustomAttribute>>(), It.IsAny<string>()), Times.Once);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CaptureCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CaptureCommandHandlerTests.csindex b14357ba8..c22a71dfd 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CaptureCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CaptureCommandHandlerTests.cs@@ -38,7 +38,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new CaptureCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new CaptureCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanCaptureQuery>(), default)).Returns(Task.FromResult(true));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderCommandHandlerTests.csindex ca7b5eeba..3ddfed3b1 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderCommandHandlerTests.cs@@ -47,7 +47,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new DeleteOrderCommand() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending } };+ var command = new DeleteOrderCommand { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending } };_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder(It.IsAny<string>())).ReturnsAsync(new List<Shipment>());//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderItemCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderItemCommandHandlerTests.csindex c29e5d921..b13c91538 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderItemCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/DeleteOrderItemCommandHandlerTests.cs@@ -41,10 +41,10 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new DeleteOrderItemCommand() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending }, OrderItem = new OrderItem() { Quantity = 1, OpenQty = 1, Status = OrderItemStatus.Open } };+ var command = new DeleteOrderItemCommand { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending }, OrderItem = new OrderItem { Quantity = 1, OpenQty = 1, Status = OrderItemStatus.Open } };_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder(It.IsAny<string>())).ReturnsAsync(new List<Shipment>());_giftVoucherServiceMock.Setup(c => c.GetGiftVouchersByPurchasedWithOrderItemId(It.IsAny<string>())).ReturnsAsync(new List<GiftVoucher>());- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "2", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "2", Published = true, Price = 10 }));//Actvar result = await _handler.Handle(command, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/InsertOrderItemCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/InsertOrderItemCommandHandlerTests.csindex 3c2b4f910..e6a10625e 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/InsertOrderItemCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/InsertOrderItemCommandHandlerTests.cs@@ -40,7 +40,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new InsertOrderItemCommand() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending }, OrderItem = new OrderItem() { Quantity = 1, OpenQty = 1, Status = OrderItemStatus.Open }, Product = new Product() };+ var command = new InsertOrderItemCommand { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending }, OrderItem = new OrderItem { Quantity = 1, OpenQty = 1, Status = OrderItemStatus.Open }, Product = new Product() };_giftVoucherServiceMock.Setup(c => c.GetGiftVouchersByPurchasedWithOrderItemId(It.IsAny<string>())).ReturnsAsync(new List<GiftVoucher>());//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsAuthorizedCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsAuthorizedCommandHandlerTests.csindex 9e678d332..b579591b2 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsAuthorizedCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsAuthorizedCommandHandlerTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new MarkAsAuthorizedCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new MarkAsAuthorizedCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanCaptureQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsPaidCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsPaidCommandHandlerTests.csindex 27b0a3774..ca552448d 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsPaidCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MarkAsPaidCommandHandlerTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new MarkAsPaidCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new MarkAsPaidCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanCaptureQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MaxOrderNumberCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MaxOrderNumberCommandHandlerTests.csindex 24e7d2038..ba53ebaa5 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MaxOrderNumberCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/MaxOrderNumberCommandHandlerTests.cs@@ -23,7 +23,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Act- var result = await _handler.Handle(new Core.Commands.Checkout.Orders.MaxOrderNumberCommand() { OrderNumber = 10 }, CancellationToken.None);+ var result = await _handler.Handle(new Core.Commands.Checkout.Orders.MaxOrderNumberCommand { OrderNumber = 10 }, CancellationToken.None);//AssertAssert.AreEqual(10, result);}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/OrderStatusCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/OrderStatusCommandHandlerTests.csindex e01a66bf8..04813f210 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/OrderStatusCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/OrderStatusCommandHandlerTests.cs@@ -42,7 +42,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new SetOrderStatusCommand() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending }, Os = OrderStatusSystem.Complete };+ var command = new SetOrderStatusCommand { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending }, Os = OrderStatusSystem.Complete };//Actawait _handler.Handle(command, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyPaidOfflineCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyPaidOfflineCommandHandlerTests.csindex 186b09144..3a622ad24 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyPaidOfflineCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyPaidOfflineCommandHandlerTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new PartiallyPaidOfflineCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new PartiallyPaidOfflineCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanPartiallyPaidOfflineQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundCommandHandlerTests.csindex 788975e5a..708d38b65 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundCommandHandlerTests.cs@@ -42,11 +42,11 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new PartiallyRefundCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new PartiallyRefundCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanPartiallyRefundQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));- _paymentServiceMock.Setup(x => x.Refund(It.IsAny<RefundPaymentRequest>())).Returns(Task.FromResult(new RefundPaymentResult() { NewTransactionStatus = TransactionStatus.Refunded }));+ _paymentServiceMock.Setup(x => x.Refund(It.IsAny<RefundPaymentRequest>())).Returns(Task.FromResult(new RefundPaymentResult { NewTransactionStatus = TransactionStatus.Refunded }));_paymentTransactionMock.Setup(x => x.GetById(It.IsAny<string>())).Returns(Task.FromResult(new PaymentTransaction()));//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundOfflineCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundOfflineCommandHandlerTests.csindex 80566eeb5..a0a8ae8b3 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundOfflineCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PartiallyRefundOfflineCommandHandlerTests.cs@@ -36,7 +36,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new PartiallyRefundOfflineCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new PartiallyRefundOfflineCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanPartiallyRefundOfflineQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PrepareOrderCodeCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PrepareOrderCodeCommandHandlerTests.csindex 65c49c4a9..4e6c1a063 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PrepareOrderCodeCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/PrepareOrderCodeCommandHandlerTests.cs@@ -12,7 +12,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders[TestInitialize]public void Init(){- _handler = new PrepareOrderCodeCommandHandler(new Domain.Orders.OrderSettings() { LengthCode = LengthCode });+ _handler = new PrepareOrderCodeCommandHandler(new Domain.Orders.OrderSettings { LengthCode = LengthCode });}[TestMethod()]diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.csindex a119e0f2f..90bca70b3 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs@@ -43,8 +43,8 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{//Arrangevar command = new ReduceLoyaltyPointsCommand();- command.Order = new Domain.Orders.Order() { StoreId = "", OrderNumber = 1, CalcLoyaltyPoints = 100 };- var expectedCustomer = new Customer() { Username = "John", Active = true };+ command.Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1, CalcLoyaltyPoints = 100 };+ var expectedCustomer = new Customer { Username = "John", Active = true };_customerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));_currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).Returns(() => Task.FromResult(new Domain.Directory.Currency()));_currencyServiceMock.Setup(c => c.ConvertToPrimaryStoreCurrency(100, It.IsAny<Currency>())).Returns(() => Task.FromResult((double)100));diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/RefundCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/RefundCommandHandlerTests.csindex 83cdb9754..4c6a7ffd7 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/RefundCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/RefundCommandHandlerTests.cs@@ -42,11 +42,11 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new RefundCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new RefundCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanPartiallyRefundQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));- _paymentServiceMock.Setup(x => x.Refund(It.IsAny<RefundPaymentRequest>())).Returns(Task.FromResult(new RefundPaymentResult() { NewTransactionStatus = TransactionStatus.Refunded }));+ _paymentServiceMock.Setup(x => x.Refund(It.IsAny<RefundPaymentRequest>())).Returns(Task.FromResult(new RefundPaymentResult { NewTransactionStatus = TransactionStatus.Refunded }));_paymentTransactionMock.Setup(x => x.GetById(It.IsAny<string>())).Returns(Task.FromResult(new PaymentTransaction()));//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.csindex 2e100f513..c9425206c 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{//Arrangevar command = new Core.Commands.Checkout.Orders.ReturnBackRedeemedLoyaltyPointsCommand();- command.Order = new Domain.Orders.Order() { RedeemedLoyaltyPoints = 10 };+ command.Order = new Domain.Orders.Order { RedeemedLoyaltyPoints = 10 };_translationServiceMock.Setup(x => x.GetResource(It.IsAny<string>())).Returns("Name");//Actawait _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/UpdateOrderItemCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/UpdateOrderItemCommandHandlerTests.csindex b99241b9b..eaee22520 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/UpdateOrderItemCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/UpdateOrderItemCommandHandlerTests.cs@@ -41,15 +41,15 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending };+ var order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending };var orderItem = new OrderItem();order.OrderItems.Add(orderItem);- var command = new UpdateOrderItemCommand() { Order = order, OrderItem = orderItem };+ var command = new UpdateOrderItemCommand { Order = order, OrderItem = orderItem };_orderServiceMock.Setup(x => x.GetOrderById(It.IsAny<string>())).Returns(Task.FromResult(order));_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder(It.IsAny<string>())).ReturnsAsync(new List<Shipment>());_giftVoucherServiceMock.Setup(c => c.GetGiftVouchersByPurchasedWithOrderItemId(It.IsAny<string>())).ReturnsAsync(new List<GiftVoucher>());- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "2", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "2", Published = true, Price = 10 }));//Actvar result = await _handler.Handle(command, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.csindex 9f7426418..7c43764ed 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs@@ -18,7 +18,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic void Init(){_orderTotalCalculationServiceMock = new Mock<IOrderCalculationService>();- _orderSettings = new OrderSettings() { MinOrderSubtotalAmount = 10};+ _orderSettings = new OrderSettings { MinOrderSubtotalAmount = 10};_handler = new ValidateMinShoppingCartSubtotalAmountCommandHandler(_orderTotalCalculationServiceMock.Object, _orderSettings);}@@ -28,7 +28,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders{var command = new Core.Commands.Checkout.Orders.ValidateMinShoppingCartSubtotalAmountCommand();command.Customer = new Domain.Customers.Customer();- command.Cart = new List<ShoppingCartItem>() { new ShoppingCartItem() };+ command.Cart = new List<ShoppingCartItem> { new ShoppingCartItem() };_orderTotalCalculationServiceMock.Setup(x => x.GetShoppingCartSubTotal(It.IsAny<IList<ShoppingCartItem>>(), false)).Returns(() => Task.FromResult<(double discountAmount, List<ApplyDiscount> appliedDiscounts, double subTotalWithoutDiscount, double subTotalWithDiscount, SortedDictionary<double, double> taxRates)>((20,null, 100,100,null)));//Actdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidCommandHandlerTests.csindex 1338e040a..4d6dbd9fc 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidCommandHandlerTests.cs@@ -44,11 +44,11 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new VoidCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new VoidCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanVoidQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));- _paymentServiceMock.Setup(x => x.Void(It.IsAny<PaymentTransaction>())).Returns(Task.FromResult(new VoidPaymentResult() { NewTransactionStatus = TransactionStatus.Voided }));+ _paymentServiceMock.Setup(x => x.Void(It.IsAny<PaymentTransaction>())).Returns(Task.FromResult(new VoidPaymentResult { NewTransactionStatus = TransactionStatus.Voided }));_paymentTransactionMock.Setup(x => x.GetById(It.IsAny<string>())).Returns(Task.FromResult(new PaymentTransaction()));//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidOfflineCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidOfflineCommandHandlerTests.csindex 3aa10f280..070cfeb1f 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidOfflineCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/VoidOfflineCommandHandlerTests.cs@@ -38,11 +38,11 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orderspublic async Task HandleTest(){//Arrange- var command = new VoidOfflineCommand() { PaymentTransaction = new PaymentTransaction() };+ var command = new VoidOfflineCommand { PaymentTransaction = new PaymentTransaction() };_mediatorMock.Setup(x => x.Send(It.IsAny<CanVoidOfflineQuery>(), default)).Returns(Task.FromResult(true));_orderServiceMock.Setup(x => x.GetOrderByGuid(It.IsAny<Guid>())).Returns(Task.FromResult(new Order()));- _paymentServiceMock.Setup(x => x.Void(It.IsAny<PaymentTransaction>())).Returns(Task.FromResult(new VoidPaymentResult() { NewTransactionStatus = TransactionStatus.Voided }));+ _paymentServiceMock.Setup(x => x.Void(It.IsAny<PaymentTransaction>())).Returns(Task.FromResult(new VoidPaymentResult { NewTransactionStatus = TransactionStatus.Voided }));_paymentTransactionMock.Setup(x => x.GetById(It.IsAny<string>())).Returns(Task.FromResult(new PaymentTransaction()));//Actvar result = await _handler.Handle(command, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/DeliveryCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/DeliveryCommandHandlerTests.csindex 97c0a2894..e87ea5d2b 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/DeliveryCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/DeliveryCommandHandlerTests.cs@@ -35,7 +35,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Shipping//Arrange_orderServiceMock.Setup(x => x.GetOrderById(It.IsAny<string>())).Returns(Task.FromResult(new Order()));_shipmentServiceMock.Setup(x => x.GetShipmentsByOrder(It.IsAny<string>())).Returns(Task.FromResult((IList<Shipment>)new List<Shipment>()));- var deliveryCommand = new Core.Commands.Checkout.Shipping.DeliveryCommand() { NotifyCustomer = true, Shipment = new Domain.Shipping.Shipment() { ShippedDateUtc = DateTime.Now } };+ var deliveryCommand = new Core.Commands.Checkout.Shipping.DeliveryCommand { NotifyCustomer = true, Shipment = new Domain.Shipping.Shipment { ShippedDateUtc = DateTime.Now } };//Actvar result = await _deliveryCommandHandler.Handle(deliveryCommand, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/ShipCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/ShipCommandHandlerTests.csindex df1e777ad..a7702730f 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/ShipCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Shipping/ShipCommandHandlerTests.cs@@ -35,7 +35,7 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Shipping//Arrange_orderServiceMock.Setup(x => x.GetOrderById(It.IsAny<string>())).Returns(Task.FromResult(new Order()));_shipmentServiceMock.Setup(x => x.GetShipmentsByOrder(It.IsAny<string>())).Returns(Task.FromResult((IList<Shipment>)new List<Shipment>()));- var shipCommand = new Core.Commands.Checkout.Shipping.ShipCommand() { NotifyCustomer = true, Shipment = new Domain.Shipping.Shipment() { } };+ var shipCommand = new Core.Commands.Checkout.Shipping.ShipCommand { NotifyCustomer = true, Shipment = new Domain.Shipping.Shipment { } };//Actvar result = await _shipCommandHandler.Handle(shipCommand, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Events/Customers/CustomerRegisteredEventHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Events/Customers/CustomerRegisteredEventHandlerTests.csindex 35cafe66a..7d2c6fa36 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Events/Customers/CustomerRegisteredEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Events/Customers/CustomerRegisteredEventHandlerTests.cs@@ -18,7 +18,7 @@ namespace Grand.Business.Checkout.Tests.Events.Customersvar translationServiceMock = new Mock<ITranslationService>();translationServiceMock.Setup(x => x.GetResource(It.IsAny<string>())).Returns("Name");_loyaltyPointsServiceMock = new Mock<ILoyaltyPointsService>();- _loyaltyPointsSettings = new Domain.Orders.LoyaltyPointsSettings() { Enabled = true, PointsForRegistration = 10 };+ _loyaltyPointsSettings = new Domain.Orders.LoyaltyPointsSettings { Enabled = true, PointsForRegistration = 10 };_customerRegisteredEventHandler = new CustomerRegisteredEventHandler(translationServiceMock.Object, _loyaltyPointsServiceMock.Object, _loyaltyPointsSettings);}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Events/Orders/OrderPlacedEventHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Events/Orders/OrderPlacedEventHandlerTests.csindex db5f7a044..475e34e4a 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Events/Orders/OrderPlacedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Events/Orders/OrderPlacedEventHandlerTests.cs@@ -31,9 +31,9 @@ namespace Grand.Business.Checkout.Tests.Events.Orderspublic async Task HandleTest(){//Arrange- var order = new Order() { RedeemedLoyaltyPointsAmount = 10 };- order.OrderItems.Add(new OrderItem() { ProductId = "1" });- order.OrderItems.Add(new OrderItem() { ProductId = "2" });+ var order = new Order { RedeemedLoyaltyPointsAmount = 10 };+ order.OrderItems.Add(new OrderItem { ProductId = "1" });+ order.OrderItems.Add(new OrderItem { ProductId = "2" });var notification = new OrderPlacedEvent(order);//Actawait _orderPlacedEventHandler.Handle(notification, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentDeletedEventHandlerTests.csindex aa9863010..f97430455 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentDeletedEventHandlerTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Checkout.Tests.Events.Shipping_orderServiceMock.Setup(x => x.GetOrderById(It.IsAny<string>())).Returns(Task.FromResult(order));var shipment = new Shipment();- shipment.ShipmentItems.Add(new ShipmentItem() { OrderItemId = "!" });+ shipment.ShipmentItems.Add(new ShipmentItem { OrderItemId = "!" });var notification = new Infrastructure.Events.EntityDeleted<Shipment>(shipment);//Actawait _shipmentDeletedEventHandler.Handle(notification, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentInsertedEventHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentInsertedEventHandlerTests.csindex 07acef846..6748041de 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentInsertedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Events/Shipping/ShipmentInsertedEventHandlerTests.cs@@ -35,7 +35,7 @@ namespace Grand.Business.Checkout.Tests.Events.Shipping_productServiceMock.Setup(x => x.GetProductById(It.IsAny<string>(), false)).Returns(Task.FromResult(new Domain.Catalog.Product()));var shipment = new Shipment();- shipment.ShipmentItems.Add(new ShipmentItem() { OrderItemId = "!" });+ shipment.ShipmentItems.Add(new ShipmentItem { OrderItemId = "!" });var notification = new Infrastructure.Events.EntityInserted<Shipment>(shipment);//Actawait _shipmentInsertedEventHandler.Handle(notification, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Checkout.Tests/Events/ShoppingCart/ShoppingCartItemDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Events/ShoppingCart/ShoppingCartItemDeletedEventHandlerTests.csindex 559c36711..773c428e0 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Events/ShoppingCart/ShoppingCartItemDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Events/ShoppingCart/ShoppingCartItemDeletedEventHandlerTests.cs@@ -24,8 +24,8 @@ namespace Grand.Business.Checkout.Tests.Events.ShoppingCartpublic async Task HandleTest(){//Arrange- _productReservationServiceMock.Setup(x => x.GetCustomerReservationsHelperBySciId(It.IsAny<string>())).Returns(Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper>() { new CustomerReservationsHelper() }));- var notification = new Infrastructure.Events.EntityDeleted<Domain.Orders.ShoppingCartItem>(new Domain.Orders.ShoppingCartItem() { RentalStartDateUtc = DateTime.UtcNow, RentalEndDateUtc = DateTime.UtcNow});+ _productReservationServiceMock.Setup(x => x.GetCustomerReservationsHelperBySciId(It.IsAny<string>())).Returns(Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper> { new CustomerReservationsHelper() }));+ var notification = new Infrastructure.Events.EntityDeleted<Domain.Orders.ShoppingCartItem>(new Domain.Orders.ShoppingCartItem { RentalStartDateUtc = DateTime.UtcNow, RentalEndDateUtc = DateTime.UtcNow});//Actawait _shoppingCartItemDeletedEventHandler.Handle(notification, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShippingExtensionsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShippingExtensionsTests.csindex e420c5e8c..5e22e76b0 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShippingExtensionsTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Extensions/ShippingExtensionsTests.cs@@ -44,7 +44,7 @@ namespace Grand.Business.Checkout.Tests.Extensionsvar method = new ShippingMethod();var countryId = "countryId";Assert.IsFalse(method.CountryRestrictionExists(countryId));- method.RestrictedCountries.Add(new Domain.Directory.Country() { Id = countryId });+ method.RestrictedCountries.Add(new Domain.Directory.Country { Id = countryId });Assert.IsTrue(method.CountryRestrictionExists(countryId));}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Queries/Handlers/Orders/HandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Queries/Handlers/Orders/HandlerTests.csindex 3d79c8263..583291d62 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Queries/Handlers/Orders/HandlerTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Queries/Handlers/Orders/HandlerTests.cs@@ -29,7 +29,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canCancelOrderQueryHandler = new CanCancelOrderQueryHandler();//Act- var result = await canCancelOrderQueryHandler.Handle(new CanCancelOrderQuery() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Pending } }, CancellationToken.None);+ var result = await canCancelOrderQueryHandler.Handle(new CanCancelOrderQuery { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Pending } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -39,7 +39,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canCancelOrderQueryHandler = new CanCancelOrderQueryHandler();//Act- var result = await canCancelOrderQueryHandler.Handle(new CanCancelOrderQuery() { Order = new Order() { OrderStatusId = (int)OrderStatusSystem.Processing } }, CancellationToken.None);+ var result = await canCancelOrderQueryHandler.Handle(new CanCancelOrderQuery { Order = new Order { OrderStatusId = (int)OrderStatusSystem.Processing } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -51,7 +51,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canCaptureQueryHandler = new CanCaptureQueryHandler(_paymentServiceMock.Object);//Act- var result = await canCaptureQueryHandler.Handle(new CanCaptureQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Authorized } }, CancellationToken.None);+ var result = await canCaptureQueryHandler.Handle(new CanCaptureQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Authorized } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -61,7 +61,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canCaptureQueryHandler = new CanCaptureQueryHandler(_paymentServiceMock.Object);//Act- var result = await canCaptureQueryHandler.Handle(new CanCaptureQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid } }, CancellationToken.None);+ var result = await canCaptureQueryHandler.Handle(new CanCaptureQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -71,7 +71,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canMarkPaymentTransactionAsAuthorizedQueryHandler = new CanMarkPaymentTransactionAsAuthorizedQueryHandler();//Act- var result = await canMarkPaymentTransactionAsAuthorizedQueryHandler.Handle(new CanMarkPaymentTransactionAsAuthorizedQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Canceled } }, CancellationToken.None);+ var result = await canMarkPaymentTransactionAsAuthorizedQueryHandler.Handle(new CanMarkPaymentTransactionAsAuthorizedQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Canceled } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -81,7 +81,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canMarkPaymentTransactionAsAuthorizedQueryHandler = new CanMarkPaymentTransactionAsAuthorizedQueryHandler();//Act- var result = await canMarkPaymentTransactionAsAuthorizedQueryHandler.Handle(new CanMarkPaymentTransactionAsAuthorizedQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending } }, CancellationToken.None);+ var result = await canMarkPaymentTransactionAsAuthorizedQueryHandler.Handle(new CanMarkPaymentTransactionAsAuthorizedQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -91,7 +91,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canMarkPaymentTransactionAsPaidQueryHandler = new CanMarkPaymentTransactionAsPaidQueryHandler();//Act- var result = await canMarkPaymentTransactionAsPaidQueryHandler.Handle(new CanMarkPaymentTransactionAsPaidQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Authorized } }, CancellationToken.None);+ var result = await canMarkPaymentTransactionAsPaidQueryHandler.Handle(new CanMarkPaymentTransactionAsPaidQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Authorized } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -101,7 +101,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canMarkPaymentTransactionAsPaidQueryHandler = new CanMarkPaymentTransactionAsPaidQueryHandler();//Act- var result = await canMarkPaymentTransactionAsPaidQueryHandler.Handle(new CanMarkPaymentTransactionAsPaidQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Canceled } }, CancellationToken.None);+ var result = await canMarkPaymentTransactionAsPaidQueryHandler.Handle(new CanMarkPaymentTransactionAsPaidQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Canceled } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -112,7 +112,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyPaidOfflineQueryHandler = new CanPartiallyPaidOfflineQueryHandler();//Act- var result = await canPartiallyPaidOfflineQueryHandler.Handle(new CanPartiallyPaidOfflineQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 }, AmountToPaid = 10 }, CancellationToken.None);+ var result = await canPartiallyPaidOfflineQueryHandler.Handle(new CanPartiallyPaidOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 }, AmountToPaid = 10 }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -122,7 +122,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyPaidOfflineQueryHandler = new CanPartiallyPaidOfflineQueryHandler();//Act- var result = await canPartiallyPaidOfflineQueryHandler.Handle(new CanPartiallyPaidOfflineQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 20 }, AmountToPaid = 10 }, CancellationToken.None);+ var result = await canPartiallyPaidOfflineQueryHandler.Handle(new CanPartiallyPaidOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 20 }, AmountToPaid = 10 }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -132,7 +132,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyRefundOfflineQueryHandler = new CanPartiallyRefundOfflineQueryHandler();//Act- var result = await canPartiallyRefundOfflineQueryHandler.Handle(new CanPartiallyRefundOfflineQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 } }, CancellationToken.None);+ var result = await canPartiallyRefundOfflineQueryHandler.Handle(new CanPartiallyRefundOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -142,7 +142,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyRefundOfflineQueryHandler = new CanPartiallyRefundOfflineQueryHandler();//Act- var result = await canPartiallyRefundOfflineQueryHandler.Handle(new CanPartiallyRefundOfflineQuery() { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 } }, CancellationToken.None);+ var result = await canPartiallyRefundOfflineQueryHandler.Handle(new CanPartiallyRefundOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 20 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -153,7 +153,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyRefundQueryHandler = new CanPartiallyRefundQueryHandler(_paymentServiceMock.Object);//Act- var result = await canPartiallyRefundQueryHandler.Handle(new CanPartiallyRefundQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canPartiallyRefundQueryHandler.Handle(new CanPartiallyRefundQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -163,7 +163,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canPartiallyRefundQueryHandler = new CanPartiallyRefundQueryHandler(_paymentServiceMock.Object);//Act- var result = await canPartiallyRefundQueryHandler.Handle(new CanPartiallyRefundQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending } }, CancellationToken.None);+ var result = await canPartiallyRefundQueryHandler.Handle(new CanPartiallyRefundQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -173,7 +173,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canRefundOfflineQueryHandler = new CanRefundOfflineQueryHandler();//Act- var result = await canRefundOfflineQueryHandler.Handle(new CanRefundOfflineQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canRefundOfflineQueryHandler.Handle(new CanRefundOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -183,7 +183,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canRefundOfflineQueryHandler = new CanRefundOfflineQueryHandler();//Act- var result = await canRefundOfflineQueryHandler.Handle(new CanRefundOfflineQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canRefundOfflineQueryHandler.Handle(new CanRefundOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -193,7 +193,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canRefundQueryHandler = new CanRefundQueryHandler(_paymentServiceMock.Object);//Act- var result = await canRefundQueryHandler.Handle(new CanRefundQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canRefundQueryHandler.Handle(new CanRefundQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -203,7 +203,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canRefundQueryHandler = new CanRefundQueryHandler(_paymentServiceMock.Object);//Act- var result = await canRefundQueryHandler.Handle(new CanRefundQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canRefundQueryHandler.Handle(new CanRefundQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Pending, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -213,7 +213,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canVoidOfflineQueryHandler = new CanVoidOfflineQueryHandler();//Act- var result = await canVoidOfflineQueryHandler.Handle(new CanVoidOfflineQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Authorized, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canVoidOfflineQueryHandler.Handle(new CanVoidOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Authorized, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -223,7 +223,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canVoidOfflineQueryHandler = new CanVoidOfflineQueryHandler();//Act- var result = await canVoidOfflineQueryHandler.Handle(new CanVoidOfflineQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.PartialPaid, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canVoidOfflineQueryHandler.Handle(new CanVoidOfflineQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.PartialPaid, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}@@ -234,7 +234,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canVoidQueryHandler = new CanVoidQueryHandler(_paymentServiceMock.Object);//Act- var result = await canVoidQueryHandler.Handle(new CanVoidQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Authorized, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canVoidQueryHandler.Handle(new CanVoidQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Authorized, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsTrue(result);}@@ -244,7 +244,7 @@ namespace Grand.Business.Checkout.Tests.Queries.Handlers.Orders//Arrangevar canVoidQueryHandler = new CanVoidQueryHandler(_paymentServiceMock.Object);//Act- var result = await canVoidQueryHandler.Handle(new CanVoidQuery { PaymentTransaction = new PaymentTransaction() { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);+ var result = await canVoidQueryHandler.Handle(new CanVoidQuery { PaymentTransaction = new PaymentTransaction { TransactionStatus = TransactionStatus.Paid, TransactionAmount = 10 } }, CancellationToken.None);//AssertAssert.IsFalse(result);}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/GiftVouchers/GiftVoucherServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/GiftVouchers/GiftVoucherServiceTests.csindex 7d4adf6fc..407a99622 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/GiftVouchers/GiftVoucherServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/GiftVouchers/GiftVoucherServiceTests.cs@@ -42,7 +42,7 @@ namespace Grand.Business.Checkout.Tests.Services.GiftVouchers[TestMethod]public async Task InsertGiftVoucher_InovokeExpectedMethods(){- await _service.InsertGiftVoucher(new GiftVoucher() { Code = "code" });+ await _service.InsertGiftVoucher(new GiftVoucher { Code = "code" });_repositoryMock.Verify(c => c.InsertAsync(It.IsAny<GiftVoucher>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<GiftVoucher>>(), default(CancellationToken)), Times.Once);}@@ -56,7 +56,7 @@ namespace Grand.Business.Checkout.Tests.Services.GiftVouchers[TestMethod]public async Task UpdateGiftVoucher_InovokeExpectedMethods(){- await _service.UpdateGiftVoucher(new GiftVoucher() { Code = "code" });+ await _service.UpdateGiftVoucher(new GiftVoucher { Code = "code" });_repositoryMock.Verify(c => c.UpdateAsync(It.IsAny<GiftVoucher>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityUpdated<GiftVoucher>>(), default(CancellationToken)), Times.Once);}diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/LoyaltyPointsServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/LoyaltyPointsServiceTests.csindex 3aa66cd1d..3f9233beb 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/LoyaltyPointsServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/LoyaltyPointsServiceTests.cs@@ -21,16 +21,16 @@ namespace Grand.Business.Checkout.Tests.Services.Orders_repository = new MongoDBRepositoryTest<LoyaltyPointsHistory>();_mediatorMock = new Mock<IMediator>();- _loyaltyPointsService = new LoyaltyPointsService(_repository, new LoyaltyPointsSettings() { }, _mediatorMock.Object);+ _loyaltyPointsService = new LoyaltyPointsService(_repository, new LoyaltyPointsSettings { }, _mediatorMock.Object);}[TestMethod()]public async Task GetLoyaltyPointsBalanceTest(){//Assert- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 10 });- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 20 });- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 30 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 10 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 20 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 30 });//Actvar result = await _loyaltyPointsService.GetLoyaltyPointsBalance("1", "");//Assert@@ -53,9 +53,9 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetLoyaltyPointsHistoryTest(){//Assert- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 10 });- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 20 });- await _repository.InsertAsync(new LoyaltyPointsHistory() { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 30 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 10 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 20 });+ await _repository.InsertAsync(new LoyaltyPointsHistory { CustomerId = "1", StoreId = "", Points = 10, PointsBalance = 30 });//Actvar result = await _loyaltyPointsService.GetLoyaltyPointsHistory("1");//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.csindex 3dde512aa..ed3ec8213 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs@@ -40,7 +40,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orders_mediatorMock.Setup(x => x.Send(It.IsAny<GetMerchandiseReturnQuery>(), default)).Returns(Task.FromResult(query));- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_merchandiseReturnService = new MerchandiseReturnService(_repository, _merchandiseReturnActionRepository, _merchandiseReturnReasonRepository, _merchandiseReturnNoteRepository, _cacheBase, _mediatorMock.Object);}@@ -63,7 +63,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetMerchandiseReturnByIdTest_ReturnNumber(){//Arange- var merchandiseReturn = new MerchandiseReturn() { ReturnNumber = 1 };+ var merchandiseReturn = new MerchandiseReturn { ReturnNumber = 1 };await _repository.InsertAsync(merchandiseReturn);//Act@@ -106,7 +106,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetMerchandiseReturnActionByIdTest(){//Arrange- await _merchandiseReturnActionRepository.InsertAsync(new MerchandiseReturnAction() { Id = "1" });+ await _merchandiseReturnActionRepository.InsertAsync(new MerchandiseReturnAction { Id = "1" });await _merchandiseReturnActionRepository.InsertAsync(new MerchandiseReturnAction());//Act@@ -212,7 +212,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetAllMerchandiseReturnReasonsTest(){//Arrange- await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason() { Id = "1" });+ await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason { Id = "1" });await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason());//Act@@ -226,7 +226,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetMerchandiseReturnReasonByIdTest(){//Arrange- await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason() { Id = "1" });+ await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason { Id = "1" });await _merchandiseReturnReasonRepository.InsertAsync(new MerchandiseReturnReason());//Act@@ -294,7 +294,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetMerchandiseReturnNotesTest(){//Arange- var merchandiseReturnNote = new MerchandiseReturnNote() { MerchandiseReturnId = "1" };+ var merchandiseReturnNote = new MerchandiseReturnNote { MerchandiseReturnId = "1" };await _merchandiseReturnNoteRepository.InsertAsync(merchandiseReturnNote);//Act@@ -308,7 +308,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetMerchandiseReturnNoteTest(){//Arange- var merchandiseReturnNote = new MerchandiseReturnNote() { Id = "1" };+ var merchandiseReturnNote = new MerchandiseReturnNote { Id = "1" };await _merchandiseReturnNoteRepository.InsertAsync(merchandiseReturnNote);//Actdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderCalculationServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderCalculationServiceTests.csindex 0111fbb77..b64b0980a 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderCalculationServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderCalculationServiceTests.cs@@ -67,7 +67,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orders_shoppingCartSettings = new ShoppingCartSettings();_catalogSettings = new CatalogSettings();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });var customer = new Customer();customer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);@@ -83,11 +83,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orders[TestMethod()]public async Task GetShoppingCartSubTotalTest(){- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_checkoutAttributeParserMock.Setup(a => a.ParseCheckoutAttributeValue(It.IsAny<List<CustomAttribute>>())).Returns(() => Task.FromResult((IList<(CheckoutAttribute ca, CheckoutAttributeValue cav)>)new List<(CheckoutAttribute ca, CheckoutAttributeValue cav)>()));- _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount>() { }));+ _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount> { }));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1 } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1 } };var result = await _service.GetShoppingCartSubTotal(shoppingCartItem, false);Assert.IsNotNull(result);@@ -97,11 +97,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetShoppingCartAdditionalShippingChargeTest(){//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10 } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10 } };//Actvar result = await _service.GetShoppingCartAdditionalShippingCharge(shoppingCartItem);//Assert@@ -112,11 +112,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task IsFreeShippingTest(){//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };//Actvar result = await _service.GetShoppingCartAdditionalShippingCharge(shoppingCartItem);//Assert@@ -127,11 +127,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task AdjustShippingRateTest(){//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10 } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10 } };//Actvar result = await _service.AdjustShippingRate(10, shoppingCartItem);@@ -143,14 +143,14 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetShoppingCartShippingTotalTest(){//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_checkoutAttributeParserMock.Setup(a => a.ParseCheckoutAttributeValue(It.IsAny<List<CustomAttribute>>())).Returns(() => Task.FromResult((IList<(CheckoutAttribute ca, CheckoutAttributeValue cav)>)new List<(CheckoutAttribute ca, CheckoutAttributeValue cav)>()));- _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount>() { }));+ _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount> { }));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };//Actvar result = await _service.GetShoppingCartShippingTotal(shoppingCartItem);@@ -163,14 +163,14 @@ namespace Grand.Business.Checkout.Tests.Services.Orders{//TODO//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_checkoutAttributeParserMock.Setup(a => a.ParseCheckoutAttributeValue(It.IsAny<List<CustomAttribute>>())).Returns(() => Task.FromResult((IList<(CheckoutAttribute ca, CheckoutAttributeValue cav)>)new List<(CheckoutAttribute ca, CheckoutAttributeValue cav)>()));- _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount>() { }));+ _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount> { }));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };//Actvar result = await _service.GetTaxTotal(shoppingCartItem, false);//Assert@@ -182,14 +182,14 @@ namespace Grand.Business.Checkout.Tests.Services.Orders{//TODO//Arrange- var cgs = new List<CustomerGroup>() { new CustomerGroup() };+ var cgs = new List<CustomerGroup> { new CustomerGroup() };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_checkoutAttributeParserMock.Setup(a => a.ParseCheckoutAttributeValue(It.IsAny<List<CustomAttribute>>())).Returns(() => Task.FromResult((IList<(CheckoutAttribute ca, CheckoutAttributeValue cav)>)new List<(CheckoutAttribute ca, CheckoutAttributeValue cav)>()));- _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount>() { }));+ _discountServiceMock.Setup(a => a.GetAllDiscounts(DiscountType.AssignedToOrderSubTotal, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(() => Task.FromResult((IList<Discount>)new List<Discount> { }));- var shoppingCartItem = new List<ShoppingCartItem>() { new ShoppingCartItem() { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };+ var shoppingCartItem = new List<ShoppingCartItem> { new ShoppingCartItem { Quantity = 1, IsShipEnabled = true, AdditionalShippingChargeProduct = 10, IsFreeShipping = true } };//Actvar result = await _service.GetShoppingCartTotal(shoppingCartItem, false, false);//Assertdiff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderTagServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderTagServiceTests.csindex 8b1f30b07..4558232de 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderTagServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/OrderTagServiceTests.cs@@ -28,7 +28,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orders_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_service = new OrderTagService(_orderTagRepository, _orderRepository, _cacheBase, _mediatorMock.Object);}@@ -52,7 +52,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetOrderTagByIdTest(){//Arrange- await _orderTagRepository.InsertAsync(new OrderTag() { Id = "1"});+ await _orderTagRepository.InsertAsync(new OrderTag { Id = "1"});await _orderTagRepository.InsertAsync(new OrderTag());await _orderTagRepository.InsertAsync(new OrderTag());@@ -67,7 +67,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orderspublic async Task GetOrderTagByNameTest(){//Arrange- await _orderTagRepository.InsertAsync(new OrderTag() { Id = "1", Name = "test" });+ await _orderTagRepository.InsertAsync(new OrderTag { Id = "1", Name = "test" });await _orderTagRepository.InsertAsync(new OrderTag());await _orderTagRepository.InsertAsync(new OrderTag());diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/ShoppingCartServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/ShoppingCartServiceTests.csindex 0bb19a78a..e2daaaeac 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/ShoppingCartServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/ShoppingCartServiceTests.cs@@ -40,7 +40,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orders_userFieldServiceMock = new Mock<IUserFieldService>();_shoppingCartValidatorMock = new Mock<IShoppingCartValidator>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });var customer = new Customer();customer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);@@ -57,10 +57,10 @@ namespace Grand.Business.Checkout.Tests.Services.Orders//Arrangevar customer = new Customer();customer.Groups.Add("1");- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));//Actvar result = await _shoppingCartService.GetShoppingCart();@@ -74,11 +74,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orders//Arrangevar customer = new Customer();customer.Groups.Add("1");- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "", ProductId = "1" });- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "", ProductId = "2" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "", ProductId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "", ProductId = "2" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));//Actvar result = await _shoppingCartService.FindShoppingCartItem(customer.ShoppingCartItems.ToList(), ShoppingCartType.ShoppingCart, "1");@@ -95,11 +95,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderscustomer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_shoppingCartValidatorMock.Setup(x => x.CheckCommonWarnings(It.IsAny<Customer>(), It.IsAny<IList<ShoppingCartItem>>(), It.IsAny<Product>(), ShoppingCartType.ShoppingCart, null, null, It.IsAny<int>(), It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));_shoppingCartValidatorMock.Setup(x => x.GetShoppingCartItemWarnings(It.IsAny<Customer>(), It.IsAny<ShoppingCartItem>(), It.IsAny<Product>(), It.IsAny<ShoppingCartValidatorOptions>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));//Actvar result = await _shoppingCartService.AddToCart(customer, "2", ShoppingCartType.ShoppingCart, "");@@ -115,11 +115,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderscustomer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_shoppingCartValidatorMock.Setup(x => x.CheckCommonWarnings(It.IsAny<Customer>(), It.IsAny<IList<ShoppingCartItem>>(), It.IsAny<Product>(), ShoppingCartType.ShoppingCart, null, null, It.IsAny<int>(), It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));_shoppingCartValidatorMock.Setup(x => x.GetShoppingCartItemWarnings(It.IsAny<Customer>(), It.IsAny<ShoppingCartItem>(), It.IsAny<Product>(), It.IsAny<ShoppingCartValidatorOptions>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { "Error" }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { "Error" }));//Actvar result = await _shoppingCartService.AddToCart(customer, "2", ShoppingCartType.ShoppingCart, "");@@ -135,11 +135,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderscustomer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_shoppingCartValidatorMock.Setup(x => x.CheckCommonWarnings(It.IsAny<Customer>(), It.IsAny<IList<ShoppingCartItem>>(), It.IsAny<Product>(), ShoppingCartType.ShoppingCart, null, null, It.IsAny<int>(), It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));_shoppingCartValidatorMock.Setup(x => x.GetShoppingCartItemWarnings(It.IsAny<Customer>(), It.IsAny<ShoppingCartItem>(), It.IsAny<Product>(), It.IsAny<ShoppingCartValidatorOptions>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));var item = await _shoppingCartService.AddToCart(customer, "2", ShoppingCartType.ShoppingCart, "");//Act@@ -156,11 +156,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderscustomer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_shoppingCartValidatorMock.Setup(x => x.CheckCommonWarnings(It.IsAny<Customer>(), It.IsAny<IList<ShoppingCartItem>>(), It.IsAny<Product>(), ShoppingCartType.ShoppingCart, null, null, It.IsAny<int>(), It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));_shoppingCartValidatorMock.Setup(x => x.GetShoppingCartItemWarnings(It.IsAny<Customer>(), It.IsAny<ShoppingCartItem>(), It.IsAny<Product>(), It.IsAny<ShoppingCartValidatorOptions>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));var item = await _shoppingCartService.AddToCart(customer, "2", ShoppingCartType.ShoppingCart, "");//Act@@ -177,11 +177,11 @@ namespace Grand.Business.Checkout.Tests.Services.Orderscustomer.Groups.Add("1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => customer);- _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product() { Id = "1", Published = true, Price = 10 }));+ _productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "1", Published = true, Price = 10 }));_shoppingCartValidatorMock.Setup(x => x.CheckCommonWarnings(It.IsAny<Customer>(), It.IsAny<IList<ShoppingCartItem>>(), It.IsAny<Product>(), ShoppingCartType.ShoppingCart, null, null, It.IsAny<int>(), It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));_shoppingCartValidatorMock.Setup(x => x.GetShoppingCartItemWarnings(It.IsAny<Customer>(), It.IsAny<ShoppingCartItem>(), It.IsAny<Product>(), It.IsAny<ShoppingCartValidatorOptions>()))- .Returns(() => Task.FromResult((IList<string>)new List<string>() { }));+ .Returns(() => Task.FromResult((IList<string>)new List<string> { }));var item = await _shoppingCartService.AddToCart(customer, "2", ShoppingCartType.ShoppingCart, "");var customer2 = new Customer();diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.csindex 35173e67d..96d3c5577 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs@@ -22,11 +22,12 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic void TestInitialize(){_paymentSettings = new PaymentSettings();- _paymentSettings.ActivePaymentProviderSystemNames = new List<string>();- _paymentSettings.ActivePaymentProviderSystemNames.Add("Payments.TestMethod");+ _paymentSettings.ActivePaymentProviderSystemNames = [+ "Payments.TestMethod"+ ];_settingService = new Mock<ISettingService>();_paymentProviderMock = new Mock<IPaymentProvider>();- _paymentService = new PaymentService(_paymentSettings, new List<IPaymentProvider>() { _paymentProviderMock.Object }, _settingService.Object);+ _paymentService = new PaymentService(_paymentSettings, new List<IPaymentProvider> { _paymentProviderMock.Object }, _settingService.Object);}[TestMethod()]@@ -42,10 +43,10 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic void GetRestrictedCountryIds(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");- var expectedResult = new List<string>() { "1", "2", "3", "4" };+ var expectedResult = new List<string> { "1", "2", "3", "4" };var expectedKey = "PaymentMethodRestictions.systemName";_settingService.Setup(s => s.GetSettingByKey<PaymentRestrictedSettings>(It.IsAny<string>(), null, ""))- .Returns(() => new PaymentRestrictedSettings() { Ids = expectedResult });+ .Returns(() => new PaymentRestrictedSettings { Ids = expectedResult });var result = _paymentService.GetRestrictedCountryIds(_paymentProviderMock.Object);Assert.IsTrue(expectedResult.SequenceEqual(result));@@ -69,7 +70,7 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic async Task SaveRestictedCountryIds_InvokeSettingsService(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");- var countryIds = new List<string>() { "1", "2", "3", "4" };+ var countryIds = new List<string> { "1", "2", "3", "4" };var expectedKey = "PaymentMethodRestictions.systemName";await _paymentService.SaveRestrictedCountryIds(_paymentProviderMock.Object, countryIds);@@ -89,7 +90,7 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic async Task ProcessPayment_InvokeProcessPaymentFromPaymentMethod(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");- var request = new PaymentTransaction() { PaymentMethodSystemName = "systemName", TransactionAmount = 500 };+ var request = new PaymentTransaction { PaymentMethodSystemName = "systemName", TransactionAmount = 500 };await _paymentService.ProcessPayment(request);@@ -100,7 +101,7 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic void ProcessPayment_NotFoundPaymentMethod_ThrowException(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName2");- var request = new PaymentTransaction() { PaymentMethodSystemName = "systemName", TransactionAmount = 500 };+ var request = new PaymentTransaction { PaymentMethodSystemName = "systemName", TransactionAmount = 500 };Assert.ThrowsExceptionAsync<GrandException>(async () => await _paymentService.ProcessPayment(request));}@@ -108,7 +109,7 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic async Task PostProcessPayment_InvokePostProccessFromPaymentMethod(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");- var request = new PaymentTransaction() { PaymentMethodSystemName = "systemName", TransactionAmount = 500, TransactionStatus = TransactionStatus.Authorized };+ var request = new PaymentTransaction { PaymentMethodSystemName = "systemName", TransactionAmount = 500, TransactionStatus = TransactionStatus.Authorized };await _paymentService.PostProcessPayment(request);_paymentProviderMock.Verify(m => m.PostProcessPayment(request), Times.Once);}@@ -117,7 +118,7 @@ namespace Grand.Business.Checkout.Tests.Services.Paymentspublic void PostProcessPayment_NotFoundPaymentMethod_ThrowException(){_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");- var request = new PaymentTransaction() { PaymentMethodSystemName = "systemName2", TransactionAmount = 500, TransactionStatus = TransactionStatus.Authorized };+ var request = new PaymentTransaction { PaymentMethodSystemName = "systemName2", TransactionAmount = 500, TransactionStatus = TransactionStatus.Authorized };Assert.ThrowsExceptionAsync<GrandException>(async () => await _paymentService.PostProcessPayment(request), "Payment method couldn't be loaded");}@@ -126,7 +127,7 @@ namespace Grand.Business.Checkout.Tests.Services.Payments{_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");_paymentProviderMock.Setup(c => c.CanRePostRedirectPayment(It.IsAny<PaymentTransaction>())).ReturnsAsync(true);- var request = new PaymentTransaction() { PaymentMethodSystemName = "systemName" };+ var request = new PaymentTransaction { PaymentMethodSystemName = "systemName" };_paymentSettings.AllowRePostingPayments = false;Assert.IsFalse(await _paymentService.CanRePostRedirectPayment(request));_paymentSettings.AllowRePostingPayments = true;@@ -146,8 +147,7 @@ namespace Grand.Business.Checkout.Tests.Services.Payments{_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");_paymentProviderMock.Setup(c => c.GetAdditionalHandlingFee(It.IsAny<IList<ShoppingCartItem>>())).ReturnsAsync(100);- var cart = new List<ShoppingCartItem>()- {+ var cart = new List<ShoppingCartItem> {new ShoppingCartItem(),new ShoppingCartItem()};@@ -159,8 +159,7 @@ namespace Grand.Business.Checkout.Tests.Services.Payments{_paymentProviderMock.Setup(c => c.SystemName).Returns("systemName");_paymentProviderMock.Setup(c => c.GetAdditionalHandlingFee(It.IsAny<IList<ShoppingCartItem>>())).ReturnsAsync(100);- var cart = new List<ShoppingCartItem>()- {+ var cart = new List<ShoppingCartItem> {new ShoppingCartItem(),new ShoppingCartItem()};diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Shipping/ShippingServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Shipping/ShippingServiceTests.csindex 390ca3cbb..d8264afde 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Shipping/ShippingServiceTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Shipping/ShippingServiceTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Checkout.Tests.Services.Shipping_shippingSettings = new ShippingSettings();_rateProviderMock = new Mock<IShippingRateCalculationProvider>();_service = new ShippingService(_loggerMock.Object, _countryServiceMokc.Object,- new List<IShippingRateCalculationProvider>() { _rateProviderMock.Object }, _shippingProviderSettings, _shippingSettings);+ new List<IShippingRateCalculationProvider> { _rateProviderMock.Object }, _shippingProviderSettings, _shippingSettings);}[TestMethod]@@ -49,8 +49,8 @@ namespace Grand.Business.Checkout.Tests.Services.Shipping[TestMethod]public async Task LoadActiveShippingRateCalculationProviders_HideShipmentMethods_ReturnEmptyList(){- _rateProviderMock.Setup(c => c.LimitedToStores).Returns(new List<string>() { "storeId" });- _rateProviderMock.Setup(c => c.LimitedToGroups).Returns(new List<string>() { });+ _rateProviderMock.Setup(c => c.LimitedToStores).Returns(new List<string> { "storeId" });+ _rateProviderMock.Setup(c => c.LimitedToGroups).Returns(new List<string> { });_rateProviderMock.Setup(c => c.HideShipmentMethods(It.IsAny<IList<ShoppingCartItem>>())).ReturnsAsync(true);var result = await _service.LoadActiveShippingRateCalculationProviders(new Customer(), "storeId");Assert.IsTrue(result.Count == 0);@@ -59,9 +59,9 @@ namespace Grand.Business.Checkout.Tests.Services.Shipping[TestMethod]public async Task LoadActiveShippingRateCalculationProviders_ReturnExpectedValues(){- _shippingProviderSettings.ActiveSystemNames = new List<string>() { "sysname" };- _rateProviderMock.Setup(c => c.LimitedToStores).Returns(new List<string>() { "storeId" });- _rateProviderMock.Setup(c => c.LimitedToGroups).Returns(new List<string>() { });+ _shippingProviderSettings.ActiveSystemNames = ["sysname"];+ _rateProviderMock.Setup(c => c.LimitedToStores).Returns(new List<string> { "storeId" });+ _rateProviderMock.Setup(c => c.LimitedToGroups).Returns(new List<string> { });_rateProviderMock.Setup(c => c.SystemName).Returns("sysname");_rateProviderMock.Setup(c => c.HideShipmentMethods(It.IsAny<IList<ShoppingCartItem>>())).ReturnsAsync(false);var result = await _service.LoadActiveShippingRateCalculationProviders(new Customer(), "storeId");@@ -74,8 +74,7 @@ namespace Grand.Business.Checkout.Tests.Services.Shipping{var cart = new List<ShoppingCartItem>{- new ShoppingCartItem()- {+ new ShoppingCartItem {IsShipEnabled=true,WarehouseId="id"}@@ -83,8 +82,8 @@ namespace Grand.Business.Checkout.Tests.Services.Shippingvar customer = new Customer();var shippingAddress = new Address();- var store = new Store() { Id = "id" };- var warehouse = new Warehouse() {+ var store = new Store { Id = "id" };+ var warehouse = new Warehouse {Address = null};@@ -100,8 +99,7 @@ namespace Grand.Business.Checkout.Tests.Services.Shipping{var cart = new List<ShoppingCartItem>{- new ShoppingCartItem()- {+ new ShoppingCartItem {IsShipEnabled=false,WarehouseId="id"}@@ -109,8 +107,8 @@ namespace Grand.Business.Checkout.Tests.Services.Shippingvar customer = new Customer();var shippingAddress = new Address();- var store = new Store() { Id = "id" };- var warehouse = new Warehouse() {+ var store = new Store { Id = "id" };+ var warehouse = new Warehouse {Address = null};diff --git a/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.csindex b79f4f4b8..68c9038bc 100644--- a/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs+++ b/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs@@ -49,7 +49,7 @@ namespace Grand.Business.Checkout.Tests.Validators//Arrangevar shoppingCartAuctionValidator = new ShoppingCartAuctionValidator(_translationServiceMock.Object);//Act- var result = shoppingCartAuctionValidator.Validate(new ShoppingCartAuctionValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product() { AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1) }, new Domain.Orders.ShoppingCartItem(), 10));+ var result = shoppingCartAuctionValidator.Validate(new ShoppingCartAuctionValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product { AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1) }, new Domain.Orders.ShoppingCartItem(), 10));//AssertAssert.IsTrue(result.IsValid);@@ -61,7 +61,7 @@ namespace Grand.Business.Checkout.Tests.Validators//Arrangevar shoppingCartAuctionValidator = new ShoppingCartAuctionValidator(_translationServiceMock.Object);//Act- var result = shoppingCartAuctionValidator.Validate(new ShoppingCartAuctionValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product() { AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1), StartPrice = 20 }, new Domain.Orders.ShoppingCartItem(), 10));+ var result = shoppingCartAuctionValidator.Validate(new ShoppingCartAuctionValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product { AvailableEndDateTimeUtc = DateTime.UtcNow.AddDays(1), StartPrice = 20 }, new Domain.Orders.ShoppingCartItem(), 10));//AssertAssert.IsFalse(result.IsValid);}@@ -71,15 +71,15 @@ namespace Grand.Business.Checkout.Tests.Validators//Arrangevar shoppingCartGiftVoucherValidator = new ShoppingCartGiftVoucherValidator(_translationServiceMock.Object);var customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = "value" });- customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = "[email protected]" });- customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = "value" });- customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = "[email protected]" });- customAttributes.Add(new CustomAttribute() { Key = "Message", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientName", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientEmail", Value = "[email protected]" });+ customAttributes.Add(new CustomAttribute { Key = "SenderName", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "SenderEmail", Value = "[email protected]" });+ customAttributes.Add(new CustomAttribute { Key = "Message", Value = "value" });//Act- var result = shoppingCartGiftVoucherValidator.Validate(new ShoppingCartGiftVoucherValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product() {+ var result = shoppingCartGiftVoucherValidator.Validate(new ShoppingCartGiftVoucherValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product {GiftVoucherTypeId = GiftVoucherType.Virtual- }, new Domain.Orders.ShoppingCartItem() { Attributes = customAttributes }));+ }, new Domain.Orders.ShoppingCartItem { Attributes = customAttributes }));//AssertAssert.IsTrue(result.IsValid);@@ -91,15 +91,15 @@ namespace Grand.Business.Checkout.Tests.Validators//Arrangevar shoppingCartGiftVoucherValidator = new ShoppingCartGiftVoucherValidator(_translationServiceMock.Object);var customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = "value" });- customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = "[email protected]" });- customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = "value" });- customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = "@email.com" });- customAttributes.Add(new CustomAttribute() { Key = "Message", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientName", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientEmail", Value = "[email protected]" });+ customAttributes.Add(new CustomAttribute { Key = "SenderName", Value = "value" });+ customAttributes.Add(new CustomAttribute { Key = "SenderEmail", Value = "@email.com" });+ customAttributes.Add(new CustomAttribute { Key = "Message", Value = "value" });//Act- var result = shoppingCartGiftVoucherValidator.Validate(new ShoppingCartGiftVoucherValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product() {+ var result = shoppingCartGiftVoucherValidator.Validate(new ShoppingCartGiftVoucherValidatorRecord(new Domain.Customers.Customer(), new Domain.Catalog.Product {GiftVoucherTypeId = GiftVoucherType.Virtual- }, new Domain.Orders.ShoppingCartItem() { Attributes = customAttributes }));+ }, new Domain.Orders.ShoppingCartItem { Attributes = customAttributes }));//AssertAssert.IsFalse(result.IsValid);@@ -113,10 +113,10 @@ namespace Grand.Business.Checkout.Tests.Validators_checkoutAttributeParserMock.Object, _checkoutAttributeServiceMock.Object);_checkoutAttributeParserMock.Setup(x => x.ParseCheckoutAttributes(It.IsAny<IList<CustomAttribute>>()))- .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute>() { new CheckoutAttribute() { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox } }));+ .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute> { new CheckoutAttribute { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox } }));_checkoutAttributeServiceMock.Setup(x => x.GetAllCheckoutAttributes(It.IsAny<string>(), true, false))- .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute>() { new CheckoutAttribute() { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox } }));+ .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute> { new CheckoutAttribute { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox } }));_checkoutAttributeParserMock.Setup(x => x.IsConditionMet(It.IsAny<CheckoutAttribute>(), It.IsAny<IList<CustomAttribute>>())).Returns(() => Task.FromResult((bool?)true));@@ -125,8 +125,8 @@ namespace Grand.Business.Checkout.Tests.Validatorsvar result = await shoppingCartCheckoutValidator.ValidateAsync(new ShoppingCartCheckoutAttributesValidatorRecord(new Domain.Customers.Customer(),new Domain.Stores.Store(),- new List<ShoppingCartItem>() { new ShoppingCartItem() { } },- new List<CustomAttribute>() { new CustomAttribute() { Key = "1", Value = "test" } }+ new List<ShoppingCartItem> { new ShoppingCartItem { } },+ new List<CustomAttribute> { new CustomAttribute { Key = "1", Value = "test" } }));//Assert@@ -141,10 +141,10 @@ namespace Grand.Business.Checkout.Tests.Validators_checkoutAttributeParserMock.Object, _checkoutAttributeServiceMock.Object);_checkoutAttributeParserMock.Setup(x => x.ParseCheckoutAttributes(It.IsAny<IList<CustomAttribute>>()))- .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute>() { new CheckoutAttribute() { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox, ValidationMinLength = 10 } }));+ .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute> { new CheckoutAttribute { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox, ValidationMinLength = 10 } }));_checkoutAttributeServiceMock.Setup(x => x.GetAllCheckoutAttributes(It.IsAny<string>(), true, false))- .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute>() { new CheckoutAttribute() { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox, ValidationMinLength = 10 } }));+ .Returns(() => Task.FromResult((IList<CheckoutAttribute>)new List<CheckoutAttribute> { new CheckoutAttribute { Id = "1", Name = "test", IsRequired = true, AttributeControlTypeId = AttributeControlType.TextBox, ValidationMinLength = 10 } }));_checkoutAttributeParserMock.Setup(x => x.IsConditionMet(It.IsAny<CheckoutAttribute>(), It.IsAny<IList<CustomAttribute>>())).Returns(() => Task.FromResult((bool?)true));@@ -153,8 +153,8 @@ namespace Grand.Business.Checkout.Tests.Validatorsvar result = await shoppingCartCheckoutValidator.ValidateAsync(new ShoppingCartCheckoutAttributesValidatorRecord(new Domain.Customers.Customer(),new Domain.Stores.Store(),- new List<ShoppingCartItem>() { new ShoppingCartItem() { } },- new List<CustomAttribute>() { new CustomAttribute() { Key = "1", Value = "" } }+ new List<ShoppingCartItem> { new ShoppingCartItem { } },+ new List<CustomAttribute> { new CustomAttribute { Key = "1", Value = "" } }));//Assert@@ -166,13 +166,13 @@ namespace Grand.Business.Checkout.Tests.Validators{//Arrangevar shoppingCartInventoryValidator = new ShoppingCartInventoryProductValidator(_translationServiceMock.Object,- _productServiceMock.Object, _stockQuantityService, new ShoppingCartSettings() { });+ _productServiceMock.Object, _stockQuantityService, new ShoppingCartSettings { });//Actvar result = await shoppingCartInventoryValidator.ValidateAsync(new ShoppingCartInventoryProductValidatorRecord(new Domain.Customers.Customer(),- new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock },- new ShoppingCartItem() { ProductId = "1", Quantity = 1 }+ new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock },+ new ShoppingCartItem { ProductId = "1", Quantity = 1 }));//Assert@@ -183,13 +183,13 @@ namespace Grand.Business.Checkout.Tests.Validators{//Arrangevar shoppingCartInventoryValidator = new ShoppingCartInventoryProductValidator(_translationServiceMock.Object,- _productServiceMock.Object, _stockQuantityService, new ShoppingCartSettings() { });+ _productServiceMock.Object, _stockQuantityService, new ShoppingCartSettings { });//Actvar result = await shoppingCartInventoryValidator.ValidateAsync(new ShoppingCartInventoryProductValidatorRecord(new Domain.Customers.Customer(),- new Product() { Id = "1", StockQuantity = 0, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock },- new ShoppingCartItem() { ProductId = "1", Quantity = 1 }+ new Product { Id = "1", StockQuantity = 0, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock },+ new ShoppingCartItem { ProductId = "1", Quantity = 1 }));//Assert@@ -207,20 +207,20 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productAttributeService.Setup(x => x.GetProductAttributeById(It.IsAny<string>()))- .Returns(() => Task.FromResult(new ProductAttribute() { Name = "test" }));+ .Returns(() => Task.FromResult(new ProductAttribute { Name = "test" }));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };- var mapping = new ProductAttributeMapping() { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };- mapping.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "1", Name = "a" });+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var mapping = new ProductAttributeMapping { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };+ mapping.ProductAttributeValues.Add(new ProductAttributeValue { Id = "1", Name = "a" });product.ProductAttributeMappings.Add(mapping);- var attributes = new List<CustomAttribute>() { new CustomAttribute() { Key = "1", Value = "1" } };+ var attributes = new List<CustomAttribute> { new CustomAttribute { Key = "1", Value = "1" } };//Actvar result = await shoppingCartItemAttributeValidator.ValidateAsync(new ShoppingCartItemAttributeValidatorRecord(new Domain.Customers.Customer(),product,- new ShoppingCartItem() { ProductId = "1", Quantity = 1, Attributes = attributes },+ new ShoppingCartItem { ProductId = "1", Quantity = 1, Attributes = attributes },false));@@ -238,20 +238,20 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productAttributeService.Setup(x => x.GetProductAttributeById(It.IsAny<string>()))- .Returns(() => Task.FromResult(new ProductAttribute() { Name = "test" }));+ .Returns(() => Task.FromResult(new ProductAttribute { Name = "test" }));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };- var mapping = new ProductAttributeMapping() { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };- mapping.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "1", Name = "a" });+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var mapping = new ProductAttributeMapping { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };+ mapping.ProductAttributeValues.Add(new ProductAttributeValue { Id = "1", Name = "a" });product.ProductAttributeMappings.Add(mapping);- var attributes = new List<CustomAttribute>() { new CustomAttribute() { Key = "2" } };+ var attributes = new List<CustomAttribute> { new CustomAttribute { Key = "2" } };//Actvar result = await shoppingCartItemAttributeValidator.ValidateAsync(new ShoppingCartItemAttributeValidatorRecord(new Domain.Customers.Customer(),product,- new ShoppingCartItem() { ProductId = "1", Quantity = 1, Attributes = attributes },+ new ShoppingCartItem { ProductId = "1", Quantity = 1, Attributes = attributes },false));@@ -269,22 +269,22 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productServiceMock.Setup(x => x.GetProductById("1", false))- .Returns(() => Task.FromResult(new Product() { Id = "1", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "1", Name = "test" }));_productServiceMock.Setup(x => x.GetProductById("2", false))- .Returns(() => Task.FromResult(new Product() { Id = "2", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "2", Name = "test" }));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };product.RequireOtherProducts = true;product.RequiredProductIds = "2";var customer = new Domain.Customers.Customer();- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });//Actvar result = await shoppingCartRequiredProductValidator.ValidateAsync(new ShoppingCartRequiredProductValidatorRecord(customer,- new Domain.Stores.Store() { Id = "1" },+ new Domain.Stores.Store { Id = "1" },product,- new ShoppingCartItem() { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new ShoppingCartItem { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }));//Assert@@ -301,21 +301,21 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productServiceMock.Setup(x => x.GetProductById("1", false))- .Returns(() => Task.FromResult(new Product() { Id = "1", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "1", Name = "test" }));_productServiceMock.Setup(x => x.GetProductById("2", false))- .Returns(() => Task.FromResult(new Product() { Id = "2", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "2", Name = "test" }));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };product.RequireOtherProducts = true;product.RequiredProductIds = "2";var customer = new Domain.Customers.Customer();//Actvar result = await shoppingCartRequiredProductValidator.ValidateAsync(new ShoppingCartRequiredProductValidatorRecord(customer,- new Domain.Stores.Store() { Id = "1" },+ new Domain.Stores.Store { Id = "1" },product,- new ShoppingCartItem() { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new ShoppingCartItem { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }));//Assert@@ -332,32 +332,32 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productServiceMock.Setup(x => x.GetProductById("1", false))- .Returns(() => Task.FromResult(new Product() { Id = "1", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "1", Name = "test" }));_productReservationServiceMock.Setup(x => x.GetCustomerReservationsHelpers(It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper>() { new CustomerReservationsHelper() { Id = "1", CustomerId = "1", ShoppingCartItemId = "2" } }));+ .Returns(() => Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper> { new CustomerReservationsHelper { Id = "1", CustomerId = "1", ShoppingCartItemId = "2" } }));_productReservationServiceMock.Setup(x => x.GetProductReservationsByProductId(It.IsAny<string>(), true, null, 0, int.MaxValue)).Returns(() => Task.FromResult((IPagedList<ProductReservation>)- new PagedList<ProductReservation>() {- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(4).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(3).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(2).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(1).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.Date, Resource = "" } }+ new PagedList<ProductReservation> {+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(4).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(3).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(2).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(1).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.Date, Resource = "" } }));- var product = new Product() { Id = "1", ProductTypeId = ProductType.Reservation, IntervalUnitId = IntervalUnit.Day };+ var product = new Product { Id = "1", ProductTypeId = ProductType.Reservation, IntervalUnitId = IntervalUnit.Day };var customer = new Domain.Customers.Customer();- customer.ShoppingCartItems.Add(new ShoppingCartItem() { Id = "1", ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { Id = "1", ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });//Actvar result = await shoppingCartReservationProductValidator.ValidateAsync(new ShoppingCartReservationProductValidatorRecord(customer,product,- new ShoppingCartItem() {+ new ShoppingCartItem {ProductId = "1",Quantity = 1,ShoppingCartTypeId = ShoppingCartType.ShoppingCart,@@ -380,31 +380,31 @@ namespace Grand.Business.Checkout.Tests.Validators.Returns(() => Task.FromResult(new Product()));_productServiceMock.Setup(x => x.GetProductById("1", false))- .Returns(() => Task.FromResult(new Product() { Id = "1", Name = "test" }));+ .Returns(() => Task.FromResult(new Product { Id = "1", Name = "test" }));_productReservationServiceMock.Setup(x => x.GetCustomerReservationsHelpers(It.IsAny<string>()))- .Returns(() => Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper>() { new CustomerReservationsHelper() { Id = "1", CustomerId = "1", ShoppingCartItemId = "2" } }));+ .Returns(() => Task.FromResult((IList<CustomerReservationsHelper>)new List<CustomerReservationsHelper> { new CustomerReservationsHelper { Id = "1", CustomerId = "1", ShoppingCartItemId = "2" } }));_productReservationServiceMock.Setup(x => x.GetProductReservationsByProductId(It.IsAny<string>(), true, null, 0, int.MaxValue)).Returns(() => Task.FromResult((IPagedList<ProductReservation>)- new PagedList<ProductReservation>() {- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(10).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(9).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(8).Date, Resource = "" },- new ProductReservation() { Id = "1", Date = DateTime.UtcNow.AddDays(7).Date, Resource = "" } }+ new PagedList<ProductReservation> {+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(10).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(9).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(8).Date, Resource = "" },+ new ProductReservation { Id = "1", Date = DateTime.UtcNow.AddDays(7).Date, Resource = "" } }));- var product = new Product() { Id = "1", ProductTypeId = ProductType.Reservation, IntervalUnitId = IntervalUnit.Day };+ var product = new Product { Id = "1", ProductTypeId = ProductType.Reservation, IntervalUnitId = IntervalUnit.Day };var customer = new Domain.Customers.Customer();- customer.ShoppingCartItems.Add(new ShoppingCartItem() { Id = "1", ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { Id = "1", ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });//Actvar result = await shoppingCartReservationProductValidator.ValidateAsync(new ShoppingCartReservationProductValidatorRecord(customer,product,- new ShoppingCartItem() {+ new ShoppingCartItem {ProductId = "1",Quantity = 1,ShoppingCartTypeId = ShoppingCartType.ShoppingCart,@@ -421,21 +421,21 @@ namespace Grand.Business.Checkout.Tests.Validatorspublic async Task ShoppingCartCommonWarningsValidator_Success(){//Arrange- var shoppingCartCommonWarningsValidator = new ShoppingCartCommonWarningsValidator(_translationServiceMock.Object, _permissionServiceMock.Object, new ShoppingCartSettings() {+ var shoppingCartCommonWarningsValidator = new ShoppingCartCommonWarningsValidator(_translationServiceMock.Object, _permissionServiceMock.Object, new ShoppingCartSettings {MiniCartProductNumber = 1,MaximumShoppingCartItems = 100});_permissionServiceMock.Setup(x => x.Authorize(It.IsAny<Permission>(), It.IsAny<Customer>())).Returns(async () => await Task.FromResult(true));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };var customer = new Domain.Customers.Customer();- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });//Actvar result = await shoppingCartCommonWarningsValidator.ValidateAsync(new ShoppingCartCommonWarningsValidatorRecord(customer,- new Domain.Stores.Store() { Id = "1" },- new List<ShoppingCartItem>() {- new ShoppingCartItem() { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new Domain.Stores.Store { Id = "1" },+ new List<ShoppingCartItem> {+ new ShoppingCartItem { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }},product, ShoppingCartType.ShoppingCart, null, null, 1, ""));@@ -447,21 +447,21 @@ namespace Grand.Business.Checkout.Tests.Validatorspublic async Task ShoppingCartCommonWarningsValidator_Fail(){//Arrange- var shoppingCartCommonWarningsValidator = new ShoppingCartCommonWarningsValidator(_translationServiceMock.Object, _permissionServiceMock.Object, new ShoppingCartSettings() {+ var shoppingCartCommonWarningsValidator = new ShoppingCartCommonWarningsValidator(_translationServiceMock.Object, _permissionServiceMock.Object, new ShoppingCartSettings {MiniCartProductNumber = 1,MaximumShoppingCartItems = 100});_permissionServiceMock.Setup(x => x.Authorize(It.IsAny<Permission>(), It.IsAny<Customer>())).Returns(async () => await Task.FromResult(false));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };var customer = new Domain.Customers.Customer();- customer.ShoppingCartItems.Add(new ShoppingCartItem() { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });+ customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });//Actvar result = await shoppingCartCommonWarningsValidator.ValidateAsync(new ShoppingCartCommonWarningsValidatorRecord(customer,- new Domain.Stores.Store() { Id = "1" },- new List<ShoppingCartItem>() {- new ShoppingCartItem() { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new Domain.Stores.Store { Id = "1" },+ new List<ShoppingCartItem> {+ new ShoppingCartItem { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }},product, ShoppingCartType.ShoppingCart, null, null, 1, ""));@@ -478,7 +478,7 @@ namespace Grand.Business.Checkout.Tests.Validators_aclServiceMock.Setup(x => x.Authorize(It.IsAny<Product>(), It.IsAny<Customer>())).Returns(() => true);_aclServiceMock.Setup(x => x.Authorize(It.IsAny<Product>(), It.IsAny<string>())).Returns(() => true);- var product = new Product() {+ var product = new Product {Id = "1",Published = true};@@ -487,7 +487,7 @@ namespace Grand.Business.Checkout.Tests.Validatorsvar result = await shoppingCartStandardValidator.ValidateAsync(new ShoppingCartStandardValidatorRecord(customer,product,- new ShoppingCartItem() { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new ShoppingCartItem { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }));//Assert@@ -501,7 +501,7 @@ namespace Grand.Business.Checkout.Tests.Validators_aclServiceMock.Setup(x => x.Authorize(It.IsAny<Product>(), It.IsAny<Customer>())).Returns(() => false);_aclServiceMock.Setup(x => x.Authorize(It.IsAny<Product>(), It.IsAny<string>())).Returns(() => true);- var product = new Product() {+ var product = new Product {Id = "1",Published = true};@@ -510,7 +510,7 @@ namespace Grand.Business.Checkout.Tests.Validatorsvar result = await shoppingCartStandardValidator.ValidateAsync(new ShoppingCartStandardValidatorRecord(customer,product,- new ShoppingCartItem() { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }+ new ShoppingCartItem { ProductId = "1", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" }));//Assert@@ -526,20 +526,19 @@ namespace Grand.Business.Checkout.Tests.Validators_productServiceMock.Setup(x => x.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product()));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };- var mapping = new ProductAttributeMapping() { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };- mapping.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "1", Name = "a" });+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var mapping = new ProductAttributeMapping { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };+ mapping.ProductAttributeValues.Add(new ProductAttributeValue { Id = "1", Name = "a" });product.ProductAttributeMappings.Add(mapping);- var attributes = new List<CustomAttribute>() { new CustomAttribute() { Key = "1", Value = "1" } };+ var attributes = new List<CustomAttribute> { new CustomAttribute { Key = "1", Value = "1" } };//Actvar result = await shoppingCartWarningsValidator.ValidateAsync(new ShoppingCartWarningsValidatorRecord(new Domain.Customers.Customer(),new Domain.Stores.Store(),- new List<ShoppingCartItem>()- {- new ShoppingCartItem() { ProductId = "1", Quantity = 1, Attributes = attributes }+ new List<ShoppingCartItem> {+ new ShoppingCartItem { ProductId = "1", Quantity = 1, Attributes = attributes }}));@@ -553,25 +552,24 @@ namespace Grand.Business.Checkout.Tests.Validatorsvar shoppingCartWarningsValidator = new ShoppingCartWarningsValidator(_translationServiceMock.Object, _productServiceMock.Object);_productServiceMock.Setup(x => x.GetProductById("1", false))- .Returns(() => Task.FromResult(new Product() { IsRecurring = true, RecurringCyclePeriodId = RecurringCyclePeriod.Weeks }));+ .Returns(() => Task.FromResult(new Product { IsRecurring = true, RecurringCyclePeriodId = RecurringCyclePeriod.Weeks }));_productServiceMock.Setup(x => x.GetProductById("2", false))- .Returns(() => Task.FromResult(new Product() { IsRecurring = false }));+ .Returns(() => Task.FromResult(new Product { IsRecurring = false }));- var product = new Product() { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };- var mapping = new ProductAttributeMapping() { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };- mapping.ProductAttributeValues.Add(new ProductAttributeValue() { Id = "1", Name = "a" });+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };+ var mapping = new ProductAttributeMapping { Id = "1", ProductAttributeId = "1", AttributeControlTypeId = AttributeControlType.DropdownList, IsRequired = true };+ mapping.ProductAttributeValues.Add(new ProductAttributeValue { Id = "1", Name = "a" });product.ProductAttributeMappings.Add(mapping);- var attributes = new List<CustomAttribute>() { new CustomAttribute() { Key = "1", Value = "1" } };+ var attributes = new List<CustomAttribute> { new CustomAttribute { Key = "1", Value = "1" } };//Actvar result = await shoppingCartWarningsValidator.ValidateAsync(new ShoppingCartWarningsValidatorRecord(new Domain.Customers.Customer(),new Domain.Stores.Store(),- new List<ShoppingCartItem>()- {- new ShoppingCartItem() { ProductId = "1", Quantity = 1, Attributes = attributes },- new ShoppingCartItem() { ProductId = "2", Quantity = 1, Attributes = attributes }+ new List<ShoppingCartItem> {+ new ShoppingCartItem { ProductId = "1", Quantity = 1, Attributes = attributes },+ new ShoppingCartItem { ProductId = "2", Quantity = 1, Attributes = attributes }}));diff --git a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.csindex 04cda2b29..8a14a20e5 100644--- a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs@@ -11,14 +11,13 @@ namespace Grand.Business.Cms.Tests.Extensions[TestInitialize()]public void Init(){- _blogPosts = new List<BlogPost>()- {- new BlogPost(){StartDateUtc=DateTime.Now.AddDays(4),Id="5"},- new BlogPost(){StartDateUtc=DateTime.Now.AddDays(3),Id="4"},- new BlogPost(){StartDateUtc=DateTime.Now.AddDays(2),Id="3"},- new BlogPost(){StartDateUtc=DateTime.Now.AddDays(1),Id="2"},- new BlogPost(){StartDateUtc=DateTime.Now,Id="1"}- };+ _blogPosts = [+ new BlogPost { StartDateUtc = DateTime.Now.AddDays(4), Id = "5" },+ new BlogPost { StartDateUtc = DateTime.Now.AddDays(3), Id = "4" },+ new BlogPost { StartDateUtc = DateTime.Now.AddDays(2), Id = "3" },+ new BlogPost { StartDateUtc = DateTime.Now.AddDays(1), Id = "2" },+ new BlogPost { StartDateUtc = DateTime.Now, Id = "1" }+ ];}[TestMethod()]diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/CookiePreferenceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/CookiePreferenceTests.csindex 1a9cc5372..cf3a9cafe 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/CookiePreferenceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/CookiePreferenceTests.cs@@ -26,7 +26,7 @@ namespace Grand.Business.Cms.Tests.Servicescookie2.Setup(c => c.SystemName).Returns("cookie2");_userFieldServiceMock = new Mock<IUserFieldService>();- _cookiePreferences = new CookiePreference(_userFieldServiceMock.Object, new List<IConsentCookie>() { cookie1.Object, cookie2.Object });+ _cookiePreferences = new CookiePreference(_userFieldServiceMock.Object, new List<IConsentCookie> { cookie1.Object, cookie2.Object });}[TestMethod()]diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/KnowledgebaseServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/KnowledgebaseServiceTests.csindex fbc52d0da..3c5838ba4 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/KnowledgebaseServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/KnowledgebaseServiceTests.cs@@ -36,10 +36,10 @@ namespace Grand.Business.Cms.Tests.Services_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_knowledgebaseService = new KnowledgebaseService(_repositoryKnowledgebaseCategory, _repositoryKnowledgebaseArticle, _repositoryKnowledgebaseArticleComment, _mediatorMock.Object,_workContextMock.Object, _cacheBase, new AccessControlConfig());}@@ -86,7 +86,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseCategoryTest(){//Arrange- var knowledgebaseCategory = new KnowledgebaseCategory() { Published = true };+ var knowledgebaseCategory = new KnowledgebaseCategory { Published = true };await _repositoryKnowledgebaseCategory.InsertAsync(knowledgebaseCategory);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseCategory(knowledgebaseCategory.Id);@@ -110,7 +110,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetKnowledgebaseCategoriesTest(){//Arrange- var knowledgebaseCategory = new KnowledgebaseCategory() { Published = true };+ var knowledgebaseCategory = new KnowledgebaseCategory { Published = true };await _repositoryKnowledgebaseCategory.InsertAsync(knowledgebaseCategory);//Actvar result = await _knowledgebaseService.GetKnowledgebaseCategories();@@ -122,7 +122,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetKnowledgebaseArticleTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _repositoryKnowledgebaseArticle.InsertAsync(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetKnowledgebaseArticle(knowledgebaseArticle.Id);@@ -134,7 +134,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetKnowledgebaseArticlesTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _repositoryKnowledgebaseArticle.InsertAsync(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetKnowledgebaseArticles();@@ -146,7 +146,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task InsertKnowledgebaseArticleTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };//Actawait _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Assert@@ -157,7 +157,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task UpdateKnowledgebaseArticleTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//ActknowledgebaseArticle.Name = "test";@@ -170,7 +170,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeleteKnowledgebaseArticleTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actawait _knowledgebaseService.DeleteKnowledgebaseArticle(knowledgebaseArticle);@@ -182,7 +182,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetKnowledgebaseArticlesByCategoryIdTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, ParentCategoryId = "1" };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, ParentCategoryId = "1" };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetKnowledgebaseArticlesByCategoryId("1");@@ -194,7 +194,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseCategoriesTest(){//Arrange- var knowledgebaseCategory = new KnowledgebaseCategory() { Published = true };+ var knowledgebaseCategory = new KnowledgebaseCategory { Published = true };await _repositoryKnowledgebaseCategory.InsertAsync(knowledgebaseCategory);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseCategories();@@ -206,7 +206,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseArticlesTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseArticles();@@ -218,7 +218,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseArticleTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseArticle(knowledgebaseArticle.Id);@@ -230,7 +230,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseArticlesByCategoryTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, ParentCategoryId = "1" };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, ParentCategoryId = "1" };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseArticlesByCategory(knowledgebaseArticle.ParentCategoryId);@@ -242,7 +242,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseArticlesByKeywordTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, Name = "test" };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, Name = "test" };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseArticlesByKeyword("test");@@ -254,7 +254,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPublicKnowledgebaseCategoriesByKeywordTest(){//Arrange- var knowledgebaseCategory = new KnowledgebaseCategory() { Published = true, Name = "test" };+ var knowledgebaseCategory = new KnowledgebaseCategory { Published = true, Name = "test" };await _repositoryKnowledgebaseCategory.InsertAsync(knowledgebaseCategory);//Actvar result = await _knowledgebaseService.GetPublicKnowledgebaseCategoriesByKeyword("test");@@ -266,7 +266,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetHomepageKnowledgebaseArticlesTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, Name = "test", ShowOnHomepage = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, Name = "test", ShowOnHomepage = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetHomepageKnowledgebaseArticles();@@ -278,7 +278,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetKnowledgebaseArticlesByNameTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, Name = "test", ShowOnHomepage = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, Name = "test", ShowOnHomepage = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);//Actvar result = await _knowledgebaseService.GetKnowledgebaseArticlesByName(knowledgebaseArticle.Name);@@ -290,7 +290,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetRelatedKnowledgebaseArticlesTest(){//Arrange- var knowledgebaseArticle = new KnowledgebaseArticle() { Published = true, Name = "test", ShowOnHomepage = true };+ var knowledgebaseArticle = new KnowledgebaseArticle { Published = true, Name = "test", ShowOnHomepage = true };await _knowledgebaseService.InsertKnowledgebaseArticle(knowledgebaseArticle);var knowledgebaseArticle1 = new KnowledgebaseArticle();knowledgebaseArticle1.RelatedArticles.Add(knowledgebaseArticle.Id);@@ -316,7 +316,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetAllCommentsTest(){//Arrange- var knowledgebaseArticleComment = new KnowledgebaseArticleComment() { CustomerId = "1" };+ var knowledgebaseArticleComment = new KnowledgebaseArticleComment { CustomerId = "1" };await _knowledgebaseService.InsertArticleComment(knowledgebaseArticleComment);//Actvar result = await _knowledgebaseService.GetAllComments("1");@@ -328,7 +328,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetArticleCommentByIdTest(){//Arrange- var knowledgebaseArticleComment = new KnowledgebaseArticleComment() { CustomerId = "1" };+ var knowledgebaseArticleComment = new KnowledgebaseArticleComment { CustomerId = "1" };await _knowledgebaseService.InsertArticleComment(knowledgebaseArticleComment);//Actvar result = await _knowledgebaseService.GetArticleCommentById(knowledgebaseArticleComment.Id);@@ -340,10 +340,10 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetArticleCommentsByIdsTest(){//Arrange- var knowledgebaseArticleComment = new KnowledgebaseArticleComment() { CustomerId = "1" };+ var knowledgebaseArticleComment = new KnowledgebaseArticleComment { CustomerId = "1" };await _knowledgebaseService.InsertArticleComment(knowledgebaseArticleComment);//Act- var result = await _knowledgebaseService.GetArticleCommentsByIds(new[] { knowledgebaseArticleComment.Id });+ var result = await _knowledgebaseService.GetArticleCommentsByIds([knowledgebaseArticleComment.Id]);//AssertAssert.IsTrue(result.Any());@@ -353,7 +353,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetArticleCommentsByArticleIdTest(){//Arrange- var knowledgebaseArticleComment = new KnowledgebaseArticleComment() { CustomerId = "1", ArticleId = "1" };+ var knowledgebaseArticleComment = new KnowledgebaseArticleComment { CustomerId = "1", ArticleId = "1" };await _knowledgebaseService.InsertArticleComment(knowledgebaseArticleComment);//Actvar result = await _knowledgebaseService.GetArticleCommentsByArticleId(knowledgebaseArticleComment.ArticleId);@@ -365,7 +365,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeleteArticleCommentTest(){//Arrange- var knowledgebaseArticleComment = new KnowledgebaseArticleComment() { CustomerId = "1" };+ var knowledgebaseArticleComment = new KnowledgebaseArticleComment { CustomerId = "1" };await _knowledgebaseService.InsertArticleComment(knowledgebaseArticleComment);//Actawait _knowledgebaseService.DeleteArticleComment(knowledgebaseArticleComment);diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/NewsServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/NewsServiceTests.csindex 6fbae83c3..f52dc831e 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/NewsServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/NewsServiceTests.cs@@ -28,7 +28,7 @@ namespace Grand.Business.Cms.Tests.Services_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_newsService = new NewsService(_repository, _mediatorMock.Object, _workContextMock.Object, new AccessControlConfig());@@ -50,7 +50,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetAllNewsTest(){//Arrange- var newsItem = new NewsItem() { Published = true };+ var newsItem = new NewsItem { Published = true };await _repository.InsertAsync(newsItem);//Actvar result = await _newsService.GetAllNews();@@ -73,7 +73,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task UpdateNewsTest(){//Arrange- var newsItem = new NewsItem() { Published = true };+ var newsItem = new NewsItem { Published = true };await _repository.InsertAsync(newsItem);//ActnewsItem.Title = "test";@@ -86,7 +86,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeleteNewsTest(){//Arrange- var newsItem = new NewsItem() { Published = true };+ var newsItem = new NewsItem { Published = true };await _repository.InsertAsync(newsItem);//Actawait _newsService.DeleteNews(newsItem);@@ -98,8 +98,8 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetAllCommentsTest(){//Arrange- var newsItem = new NewsItem() { Published = true };- newsItem.NewsComments.Add(new NewsComment() { CustomerId = "1" });+ var newsItem = new NewsItem { Published = true };+ newsItem.NewsComments.Add(new NewsComment { CustomerId = "1" });await _repository.InsertAsync(newsItem);//Actvar result = await _newsService.GetAllComments("1");diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/PageLayoutServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/PageLayoutServiceTests.csindex e4755c642..c15a5cccb 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/PageLayoutServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/PageLayoutServiceTests.cs@@ -31,9 +31,9 @@ namespace Grand.Business.Cms.Tests.Services_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_pageLayoutService = new PageLayoutService(_repository, _cacheBase, _mediatorMock.Object);@@ -43,7 +43,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetAllPageLayoutsTest(){//Arrange- var pageLayout = new PageLayout() { };+ var pageLayout = new PageLayout { };await _repository.InsertAsync(pageLayout);//Actvar result = await _pageLayoutService.GetAllPageLayouts();@@ -55,7 +55,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPageLayoutByIdTest(){//Arrange- var pageLayout = new PageLayout() { };+ var pageLayout = new PageLayout { };await _repository.InsertAsync(pageLayout);//Actvar result = await _pageLayoutService.GetPageLayoutById(pageLayout.Id);@@ -67,7 +67,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task InsertPageLayoutTest(){//Arrange- var pageLayout = new PageLayout() { };+ var pageLayout = new PageLayout { };//Actawait _pageLayoutService.InsertPageLayout(pageLayout);//Assert@@ -78,7 +78,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task UpdatePageLayoutTest(){//Arrange- var pageLayout = new PageLayout() { };+ var pageLayout = new PageLayout { };await _pageLayoutService.InsertPageLayout(pageLayout);//ActpageLayout.Name = "test";@@ -91,7 +91,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeletePageLayoutTest(){//Arrange- var pageLayout = new PageLayout() { };+ var pageLayout = new PageLayout { };await _pageLayoutService.InsertPageLayout(pageLayout);//Actawait _pageLayoutService.DeletePageLayout(pageLayout);diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/PageServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/PageServiceTests.csindex 2638c7199..7926c2132 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/PageServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/PageServiceTests.cs@@ -34,11 +34,11 @@ namespace Grand.Business.Cms.Tests.Services_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_aclService = new AclService(new AccessControlConfig());- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_pageService = new PageService(_repository, _workContextMock.Object, _aclService, _mediatorMock.Object, _cacheBase, new AccessControlConfig());@@ -48,7 +48,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPageByIdTest(){//Arrange- var page = new Page() { };+ var page = new Page { };await _repository.InsertAsync(page);//Actvar result = await _pageService.GetPageById(page.Id);@@ -60,7 +60,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetPageBySystemNameTest(){//Arrange- var page = new Page() { SystemName = "test" };+ var page = new Page { SystemName = "test" };await _repository.InsertAsync(page);//Actvar result = await _pageService.GetPageBySystemName(page.SystemName);@@ -72,7 +72,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetAllPagesTest(){//Arrange- var page = new Page() { SystemName = "test", Published = true };+ var page = new Page { SystemName = "test", Published = true };await _repository.InsertAsync(page);//Actvar result = await _pageService.GetAllPages("");@@ -84,7 +84,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task InsertPageTest(){//Arrange- var page = new Page() { };+ var page = new Page { };//Actawait _pageService.InsertPage(page);//Assert@@ -95,7 +95,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task UpdatePageTest(){//Arrange- var page = new Page() { };+ var page = new Page { };await _pageService.InsertPage(page);//Actpage.SystemName = "test";@@ -108,7 +108,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeletePageTest(){//Arrange- var page = new Page() { };+ var page = new Page { };await _pageService.InsertPage(page);//Actawait _pageService.DeletePage(page);diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/RobotsTxtServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/RobotsTxtServiceTests.csindex 1a5e22593..5d743864b 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/RobotsTxtServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/RobotsTxtServiceTests.cs@@ -31,9 +31,9 @@ namespace Grand.Business.Cms.Tests.Services_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "", Name = "test store" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "", Name = "test store" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());_robotsTxtService = new RobotsTxtService(_repository, _mediatorMock.Object, _cacheBase);@@ -43,7 +43,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task GetRobotsTxtTest(){//Arrange- var robotsTxt = new RobotsTxt() { StoreId = "1" };+ var robotsTxt = new RobotsTxt { StoreId = "1" };await _repository.InsertAsync(robotsTxt);//Actvar result = await _robotsTxtService.GetRobotsTxt(robotsTxt.StoreId);@@ -55,7 +55,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task InsertRobotsTxtTest(){//Arrange- var robotsTxt = new RobotsTxt() { StoreId = "1" };+ var robotsTxt = new RobotsTxt { StoreId = "1" };//Actawait _robotsTxtService.InsertRobotsTxt(robotsTxt);//Assert@@ -66,7 +66,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task UpdateRobotsTxtTest(){//Arrange- var robotsTxt = new RobotsTxt() { StoreId = "1" };+ var robotsTxt = new RobotsTxt { StoreId = "1" };await _robotsTxtService.InsertRobotsTxt(robotsTxt);//ActrobotsTxt.Text = "test";@@ -79,7 +79,7 @@ namespace Grand.Business.Cms.Tests.Servicespublic async Task DeleteRobotsTxtTest(){//Arrange- var robotsTxt = new RobotsTxt() { StoreId = "1" };+ var robotsTxt = new RobotsTxt { StoreId = "1" };await _robotsTxtService.InsertRobotsTxt(robotsTxt);//Actawait _robotsTxtService.DeleteRobotsTxt(robotsTxt);diff --git a/src/Tests/Grand.Business.Cms.Tests/Services/WidgetServiceTests.cs b/src/Tests/Grand.Business.Cms.Tests/Services/WidgetServiceTests.csindex b2b16761d..7e8b0609a 100644--- a/src/Tests/Grand.Business.Cms.Tests/Services/WidgetServiceTests.cs+++ b/src/Tests/Grand.Business.Cms.Tests/Services/WidgetServiceTests.cs@@ -19,11 +19,11 @@ namespace Grand.Business.Cms.Tests.Services{_widgetProvider1 = new Mock<IWidgetProvider>();_widgetProvider1.Setup(c => c.SystemName).Returns("name1");- _widgetProvider1.Setup(c => c.GetWidgetZones().Result).Returns(new List<string>() { "widgetzone1" });+ _widgetProvider1.Setup(c => c.GetWidgetZones().Result).Returns(new List<string> { "widgetzone1" });_widgetProvider2 = new Mock<IWidgetProvider>();_widgetProvider2.Setup(c => c.SystemName).Returns("name2");- _widgetProvider2.Setup(c => c.GetWidgetZones().Result).Returns(new List<string>() { "widgetzone2" });- var providers = new List<IWidgetProvider>() { _widgetProvider1.Object, _widgetProvider2.Object };+ _widgetProvider2.Setup(c => c.GetWidgetZones().Result).Returns(new List<string> { "widgetzone2" });+ var providers = new List<IWidgetProvider> { _widgetProvider1.Object, _widgetProvider2.Object };_settings = new WidgetSettings();_widgedService = new WidgetService(providers, _settings);}@@ -31,7 +31,7 @@ namespace Grand.Business.Cms.Tests.Services[TestMethod()]public void LoadActiveWidgets_SettingsNotContainsSystemName_ReturnEmptyList(){- _settings.ActiveWidgetSystemNames = new List<string>();+ _settings.ActiveWidgetSystemNames = [];var result = _widgedService.LoadActiveWidgets();Assert.IsTrue(result.Count == 0);}@@ -39,7 +39,7 @@ namespace Grand.Business.Cms.Tests.Services[TestMethod()]public void LoadActiveWidgets_SettingsContainsSystemName_ReturnList(){- _settings.ActiveWidgetSystemNames = new List<string>() { "name1", "name2" };+ _settings.ActiveWidgetSystemNames = ["name1", "name2"];var result = _widgedService.LoadActiveWidgets();Assert.IsTrue(result.Count == _settings.ActiveWidgetSystemNames.Count);}@@ -54,7 +54,7 @@ namespace Grand.Business.Cms.Tests.Services[TestMethod()]public async Task LoadActiveWidgetsByWidgetZone(){- _settings.ActiveWidgetSystemNames = new List<string>() { "name1", "name2" };+ _settings.ActiveWidgetSystemNames = ["name1", "name2"];var result = await _widgedService.LoadActiveWidgetsByWidgetZone("widgetZone1");Assert.IsTrue(result.Count == 1);}diff --git a/src/Tests/Grand.Business.Common.Tests/Events/GroupDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Common.Tests/Events/GroupDeletedEventHandlerTests.csindex 280eae2d6..97cafdf62 100644--- a/src/Tests/Grand.Business.Common.Tests/Events/GroupDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Events/GroupDeletedEventHandlerTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Common.Tests.Events{_repository = new MongoDBRepositoryTest<Customer>();_product = new MongoDBRepositoryTest<Product>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), new Mock<IMediator>().Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), new Mock<IMediator>().Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_handler = new GroupDeletedEventHandler(_repository, _product, _cacheBase);}@@ -45,7 +45,7 @@ namespace Grand.Business.Common.Tests.Eventscustomer2.Groups.Add("3");await _repository.InsertAsync(customer2);//Act- var notification = new Infrastructure.Events.EntityDeleted<CustomerGroup>(new CustomerGroup() { Id = "1" });+ var notification = new Infrastructure.Events.EntityDeleted<CustomerGroup>(new CustomerGroup { Id = "1" });await _handler.Handle(notification, CancellationToken.None);//Assertdiff --git a/src/Tests/Grand.Business.Common.Tests/Events/LanguageDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Common.Tests/Events/LanguageDeletedEventHandlerTests.csindex 4672776cd..45107d10f 100644--- a/src/Tests/Grand.Business.Common.Tests/Events/LanguageDeletedEventHandlerTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Events/LanguageDeletedEventHandlerTests.cs@@ -22,7 +22,7 @@ namespace Grand.Business.Common.Tests.Events{_languageServiceMock = new Mock<ILanguageService>();_settingServiceMock = new Mock<ISettingService>();- _languageSettings = new LanguageSettings() { DefaultAdminLanguageId = "1" };+ _languageSettings = new LanguageSettings { DefaultAdminLanguageId = "1" };_handler = new LanguageDeletedEventHandler(_languageServiceMock.Object, _settingServiceMock.Object,_languageSettings);}@@ -34,7 +34,7 @@ namespace Grand.Business.Common.Tests.Events_languageServiceMock.Setup(x => x.GetAllLanguages(It.IsAny<bool>(), It.IsAny<string>())).Returns(Task.FromResult(new List<Language> { new Language { Name = "English" }, new Language { Name = "Polish" } } as IList<Language>));- var notification = new Infrastructure.Events.EntityDeleted<Language>(new Language() { Id = "1" });+ var notification = new Infrastructure.Events.EntityDeleted<Language>(new Language { Id = "1" });//Actawait _handler.Handle(notification, CancellationToken.None);diff --git a/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs b/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.csindex e3dbcb5c2..f5898cd4a 100644--- a/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs@@ -36,8 +36,8 @@ namespace Grand.Business.Common.Tests.Extensionsproduct.SeName = "se-name";//if lang id null , return global se nameAssert.AreEqual("se-name", product.GetSeName<Product>(null));- product.Locales.Add(new Domain.Localization.TranslationEntity() { LocaleKey = "SeName", LocaleValue = "se-name-1", LanguageId = "1" });- product.Locales.Add(new Domain.Localization.TranslationEntity() { LocaleKey = "SeName", LocaleValue = "se-name-2", LanguageId = "2" });+ product.Locales.Add(new Domain.Localization.TranslationEntity { LocaleKey = "SeName", LocaleValue = "se-name-1", LanguageId = "1" });+ product.Locales.Add(new Domain.Localization.TranslationEntity { LocaleKey = "SeName", LocaleValue = "se-name-2", LanguageId = "2" });Assert.AreEqual("se-name-1", product.GetSeName<Product>("1"));Assert.AreEqual("se-name-2", product.GetSeName<Product>("2"));}diff --git a/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs b/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.csindex bb24610be..c0d19728d 100644--- a/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs@@ -16,8 +16,8 @@ namespace Grand.Business.Common.Tests.Extensions//prepare ITranslationEntityvar product = new Product();product.Name = "stname";- product.Locales.Add(new Domain.Localization.TranslationEntity() { LanguageId = "PL", LocaleKey = "Name", LocaleValue = "PLName" });- product.Locales.Add(new Domain.Localization.TranslationEntity() { LanguageId = "UK", LocaleKey = "Name", LocaleValue = "UKName" });+ product.Locales.Add(new Domain.Localization.TranslationEntity { LanguageId = "PL", LocaleKey = "Name", LocaleValue = "PLName" });+ product.Locales.Add(new Domain.Localization.TranslationEntity { LanguageId = "UK", LocaleKey = "Name", LocaleValue = "UKName" });Assert.AreEqual(product.GetTranslation(c => c.Name, "PL"), "PLName");Assert.AreEqual(product.GetTranslation(c => c.Name, "UK"), "UKName");diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeParserTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeParserTests.csindex acf092835..2d535fe31 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeParserTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeParserTests.cs@@ -21,20 +21,19 @@ namespace Grand.Business.Common.Tests.Services.Addresses_atrService = new Mock<IAddressAttributeService>();_translationService = new Mock<ITranslationService>();_parser = new AddressAttributeParser(_atrService.Object);- customAtr = new List<CustomAttribute>()- {- new CustomAttribute(){Key="key1",Value="value1" },- new CustomAttribute(){Key="key2",Value="value2" },- new CustomAttribute(){Key="key3",Value="value3" },- new CustomAttribute(){Key="key4",Value="value4" }- };+ customAtr = [+ new CustomAttribute { Key = "key1", Value = "value1" },+ new CustomAttribute { Key = "key2", Value = "value2" },+ new CustomAttribute { Key = "key3", Value = "value3" },+ new CustomAttribute { Key = "key4", Value = "value4" }+ ];}[TestMethod()]public async Task ParseAddressAttributes_ReturnExpectedValues(){- _atrService.Setup(c => c.GetAddressAttributeById("key1")).Returns(Task.FromResult(new AddressAttribute() { Id = "key1" }));- _atrService.Setup(c => c.GetAddressAttributeById("key2")).Returns(Task.FromResult(new AddressAttribute() { Id = "key2" }));+ _atrService.Setup(c => c.GetAddressAttributeById("key1")).Returns(Task.FromResult(new AddressAttribute { Id = "key1" }));+ _atrService.Setup(c => c.GetAddressAttributeById("key2")).Returns(Task.FromResult(new AddressAttribute { Id = "key2" }));var result = await _parser.ParseAddressAttributes(customAtr);Assert.IsTrue(result.Count == 2);Assert.IsTrue(result.First().Id.Equals("key1"));@@ -43,7 +42,7 @@ namespace Grand.Business.Common.Tests.Services.Addresses[TestMethod()]public void AddAddressAttribute_ReturnExpectedValues(){- var atr = new AddressAttribute() { Id = "added" };+ var atr = new AddressAttribute { Id = "added" };var result = _parser.AddAddressAttribute(customAtr, atr, "new-added-value");Assert.IsTrue(result.Count == 5);Assert.IsTrue(result.Any(c => c.Key.Equals("added")));diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeServiceTests.csindex 01c488034..0e702f586 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Addresses/AddressAttributeServiceTests.cs@@ -59,7 +59,7 @@ namespace Grand.Business.Common.Tests.Services.Addresses[TestMethod()]public async Task InsertAddressAttributeValue_ValidArgument_InvokeExpectedMethod(){- await _service.InsertAddressAttributeValue(new AddressAttributeValue() { AddressAttributeId = "id" });+ await _service.InsertAddressAttributeValue(new AddressAttributeValue { AddressAttributeId = "id" });_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<AddressAttributeValue>>(), default), Times.Once);_cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), It.IsAny<bool>()));}@@ -67,7 +67,7 @@ namespace Grand.Business.Common.Tests.Services.Addresses[TestMethod()]public async Task DeleteAddressAttributeValue_ValidArgument_InvokeExpectedMethod(){- await _service.DeleteAddressAttributeValue(new AddressAttributeValue() { AddressAttributeId = "id" });+ await _service.DeleteAddressAttributeValue(new AddressAttributeValue { AddressAttributeId = "id" });_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityDeleted<AddressAttributeValue>>(), default), Times.Once);_cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), It.IsAny<bool>()));}@@ -75,7 +75,7 @@ namespace Grand.Business.Common.Tests.Services.Addresses[TestMethod()]public async Task UpdateAddressAttributeValue_ValidArgument_InvokeExpectedMethod(){- await _service.UpdateAddressAttributeValue(new AddressAttributeValue() { AddressAttributeId = "id" });+ await _service.UpdateAddressAttributeValue(new AddressAttributeValue { AddressAttributeId = "id" });_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityUpdated<AddressAttributeValue>>(), default), Times.Once);_cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), It.IsAny<bool>()));}diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/CountryServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/CountryServiceTests.csindex d516192f4..9785a7bdc 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/CountryServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/CountryServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Common.Tests.Services.Directory_repository = new MongoDBRepositoryTest<Country>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_countryService = new CountryService(_repository, _mediatorMock.Object, _cacheBase, new AccessControlConfig());}@@ -33,8 +33,8 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetAllCountriesTest(){//Arrange- await _countryService.InsertCountry(new Country() { Published = true });- await _countryService.InsertCountry(new Country() { Published = true });+ await _countryService.InsertCountry(new Country { Published = true });+ await _countryService.InsertCountry(new Country { Published = true });//Actvar result = await _countryService.GetAllCountries();//Assert@@ -45,8 +45,8 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetAllCountriesForBillingTest(){//Arrange- await _countryService.InsertCountry(new Country() { Published = true, AllowsBilling = true });- await _countryService.InsertCountry(new Country() { Published = true });+ await _countryService.InsertCountry(new Country { Published = true, AllowsBilling = true });+ await _countryService.InsertCountry(new Country { Published = true });//Actvar result = await _countryService.GetAllCountriesForBilling();//Assert@@ -57,8 +57,8 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetAllCountriesForShippingTest(){//Arrange- await _countryService.InsertCountry(new Country() { Published = true, AllowsShipping = true });- await _countryService.InsertCountry(new Country() { Published = true });+ await _countryService.InsertCountry(new Country { Published = true, AllowsShipping = true });+ await _countryService.InsertCountry(new Country { Published = true });//Actvar result = await _countryService.GetAllCountriesForShipping();//Assert@@ -71,8 +71,8 @@ namespace Grand.Business.Common.Tests.Services.Directory//Arrangevar country = new Country();await _repository.InsertAsync(country);- await _repository.InsertAsync(new Country() { Published = true, AllowsShipping = true });- await _repository.InsertAsync(new Country() { Published = true });+ await _repository.InsertAsync(new Country { Published = true, AllowsShipping = true });+ await _repository.InsertAsync(new Country { Published = true });//Actvar result = await _countryService.GetCountryById(country.Id);//Assert@@ -85,10 +85,10 @@ namespace Grand.Business.Common.Tests.Services.Directory//Arrangevar country = new Country();await _repository.InsertAsync(country);- await _repository.InsertAsync(new Country() { Published = true, AllowsShipping = true });- await _repository.InsertAsync(new Country() { Published = true });+ await _repository.InsertAsync(new Country { Published = true, AllowsShipping = true });+ await _repository.InsertAsync(new Country { Published = true });//Act- var result = await _countryService.GetCountriesByIds(new[] { country.Id });+ var result = await _countryService.GetCountriesByIds([country.Id]);//AssertAssert.IsTrue(result.Count == 1);}@@ -97,10 +97,10 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetCountryByTwoLetterIsoCodeTest(){//Arrange- var country = new Country() { TwoLetterIsoCode = "US" };+ var country = new Country { TwoLetterIsoCode = "US" };await _repository.InsertAsync(country);- await _repository.InsertAsync(new Country() { Published = true, AllowsShipping = true });- await _repository.InsertAsync(new Country() { Published = true });+ await _repository.InsertAsync(new Country { Published = true, AllowsShipping = true });+ await _repository.InsertAsync(new Country { Published = true });//Actvar result = await _countryService.GetCountryByTwoLetterIsoCode(country.TwoLetterIsoCode);//Assert@@ -111,10 +111,10 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetCountryByThreeLetterIsoCodeTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA" };+ var country = new Country { ThreeLetterIsoCode = "USA" };await _repository.InsertAsync(country);- await _repository.InsertAsync(new Country() { Published = true, AllowsShipping = true });- await _repository.InsertAsync(new Country() { Published = true });+ await _repository.InsertAsync(new Country { Published = true, AllowsShipping = true });+ await _repository.InsertAsync(new Country { Published = true });//Actvar result = await _countryService.GetCountryByThreeLetterIsoCode(country.ThreeLetterIsoCode);//Assert@@ -134,7 +134,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task UpdateCountryTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };await _repository.InsertAsync(country);//Actcountry.Name = "USA";@@ -147,7 +147,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task DeleteCountryTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };await _repository.InsertAsync(country);//Actawait _countryService.DeleteCountry(country);@@ -159,7 +159,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetStateProvincesByCountryIdTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };country.StateProvinces.Add(new StateProvince());await _repository.InsertAsync(country);//Act@@ -172,7 +172,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task InsertStateProvinceTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };await _repository.InsertAsync(country);//Actawait _countryService.InsertStateProvince(new StateProvince(), country.Id);@@ -185,7 +185,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task UpdateStateProvinceTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };await _repository.InsertAsync(country);var state = new StateProvince();await _countryService.InsertStateProvince(state, country.Id);@@ -202,7 +202,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task DeleteStateProvinceTest(){//Arrange- var country = new Country() { ThreeLetterIsoCode = "USA", Name = "United States" };+ var country = new Country { ThreeLetterIsoCode = "USA", Name = "United States" };await _repository.InsertAsync(country);var state = new StateProvince();await _countryService.InsertStateProvince(state, country.Id);diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/ExchangeRateServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/ExchangeRateServiceTests.csindex ba2a8c79e..3f328185a 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/ExchangeRateServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/ExchangeRateServiceTests.cs@@ -23,7 +23,7 @@ namespace Grand.Business.Common.Tests.Services.Directoryvar provider = new Mock<IExchangeRateProvider>();provider.Setup(c => c.SystemName).Returns("sysname");_settings.ActiveExchangeRateProviderSystemName = "sysname";- var exchangeRateService = new ExchangeRateService(new List<IExchangeRateProvider>() { provider.Object }, _settings);+ var exchangeRateService = new ExchangeRateService(new List<IExchangeRateProvider> { provider.Object }, _settings);await exchangeRateService.GetCurrencyLiveRates("rate");provider.Verify(c => c.GetCurrencyLiveRates(It.IsAny<string>()), Times.Once);}@@ -33,7 +33,7 @@ namespace Grand.Business.Common.Tests.Services.Directory{var provider = new Mock<IExchangeRateProvider>();provider.Setup(c => c.SystemName).Returns("sysname");- var exchangeRateService = new ExchangeRateService(new List<IExchangeRateProvider>() { provider.Object }, _settings);+ var exchangeRateService = new ExchangeRateService(new List<IExchangeRateProvider> { provider.Object }, _settings);var result = exchangeRateService.LoadExchangeRateProviderBySystemName("sysname");Assert.IsNotNull(result);Assert.AreEqual(result.SystemName, "sysname");diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/GroupServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/GroupServiceTests.csindex eabb0fcd6..db8ee436d 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/GroupServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/GroupServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Common.Tests.Services.Directory_repository = new MongoDBRepositoryTest<CustomerGroup>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_groupService = new GroupService(_repository, _cacheBase, _mediatorMock.Object);}@@ -47,7 +47,7 @@ namespace Grand.Business.Common.Tests.Services.Directory{//Arrangeconst string systemName = "system";- var customerGroup = new CustomerGroup() { SystemName = systemName };+ var customerGroup = new CustomerGroup { SystemName = systemName };await _repository.InsertAsync(customerGroup);//Actvar result = await _groupService.GetCustomerGroupBySystemName(systemName);@@ -59,7 +59,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task GetAllCustomerGroupsTest(){//Arrange- var customerGroup = new CustomerGroup() { Active = true };+ var customerGroup = new CustomerGroup { Active = true };await _repository.InsertAsync(customerGroup);//Actvar result = await _groupService.GetAllCustomerGroups();@@ -108,7 +108,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsStaffTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.Staff, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.Staff, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -123,7 +123,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsAdminTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.Administrators, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.Administrators, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -138,7 +138,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsSalesManagerTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.SalesManager, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.SalesManager, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -152,7 +152,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsVendorTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.Vendors, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.Vendors, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -166,7 +166,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsOwnerTest(){//Arrange- var customer = new Customer() { OwnerId = ""};+ var customer = new Customer { OwnerId = ""};//Actvar result = await _groupService.IsOwner(customer);//Assert@@ -177,7 +177,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsGuestTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.Guests, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.Guests, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -191,7 +191,7 @@ namespace Grand.Business.Common.Tests.Services.Directorypublic async Task IsRegisteredTest(){//Arrange- var customerGroup = new CustomerGroup() { IsSystem = true, SystemName = SystemCustomerGroupNames.Registered, Active = true };+ var customerGroup = new CustomerGroup { IsSystem = true, SystemName = SystemCustomerGroupNames.Registered, Active = true };await _groupService.InsertCustomerGroup(customerGroup);var customer = new Customer();customer.Groups.Add(customerGroup.Id);@@ -208,7 +208,7 @@ namespace Grand.Business.Common.Tests.Services.Directoryvar customerGroup = new CustomerGroup();await _repository.InsertAsync(customerGroup);//Act- var result = await _groupService.GetAllByIds(new[] { customerGroup.Id });+ var result = await _groupService.GetAllByIds([customerGroup.Id]);//AssertAssert.AreEqual(1, result.Count);}diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/HistoryServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/HistoryServiceTests.csindex dccbd042b..d93fc6a5b 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/HistoryServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/HistoryServiceTests.cs@@ -30,7 +30,7 @@ namespace Grand.Business.Common.Tests.Services.Directory[TestMethod()]public async Task SaveObject_InvokeRepositoryWithCorrectObject(){- var product = new Product() { Id = "1" };+ var product = new Product { Id = "1" };await _historyService.SaveObject<Product>(product);_mockHistoryRepository.Verify(c => c.InsertAsync(It.Is<HistoryObject>(h => h.Object.Id.Equals(product.Id))), Times.Once);}diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/UserFieldServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/UserFieldServiceTests.csindex 8e5336a84..f1c554a73 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/UserFieldServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/UserFieldServiceTests.cs@@ -46,7 +46,7 @@ namespace Grand.Business.Common.Tests.Services.Directory{//Arrangevar customer = new Customer();- customer.UserFields.Add(new UserField() { Key = "Field", Value = "empty", StoreId = "" });+ customer.UserFields.Add(new UserField { Key = "Field", Value = "empty", StoreId = "" });_repositoryCustomer.Insert(customer);//Actawait _userFieldService.SaveField(customer, "Field", "Value");@@ -60,7 +60,7 @@ namespace Grand.Business.Common.Tests.Services.Directory{//Arrangevar customer = new Customer();- customer.UserFields.Add(new UserField() { Key = "Field", Value = "Value", StoreId = "" });+ customer.UserFields.Add(new UserField { Key = "Field", Value = "Value", StoreId = "" });_repositoryCustomer.Insert(customer);//Actawait _userFieldService.SaveField(customer, "Field", String.Empty);diff --git a/src/Tests/Grand.Business.Common.Tests/Services/ExportImport/CountryImportDataObjectTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/ExportImport/CountryImportDataObjectTests.csindex b7d858f16..cb3138a5a 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/ExportImport/CountryImportDataObjectTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/ExportImport/CountryImportDataObjectTests.cs@@ -30,7 +30,7 @@ namespace Grand.Business.Common.Tests.Services.ExportImport_repository = new MongoDBRepositoryTest<Country>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});var accessControlConfig = new AccessControlConfig();_countryService = new CountryService(_repository, _mediatorMock.Object, _cacheBase, accessControlConfig);_countryImportDataObject = new CountryImportDataObject(_countryService);@@ -40,11 +40,11 @@ namespace Grand.Business.Common.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_NewStates(){//Arrange- var country = new Country() { TwoLetterIsoCode = "US", Name = "USA" };+ var country = new Country { TwoLetterIsoCode = "US", Name = "USA" };await _repository.InsertAsync(country);- var states = new List<CountryStatesDto>() {- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 }+ var states = new List<CountryStatesDto> {+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 }};//Actawait _countryImportDataObject.Execute(states);@@ -57,14 +57,14 @@ namespace Grand.Business.Common.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Update_States(){//Arrange- var country = new Country() { TwoLetterIsoCode = "US", Name = "USA" };- country.StateProvinces.Add(new StateProvince() { Abbreviation = "AK" });- country.StateProvinces.Add(new StateProvince() { Abbreviation = "CA" });+ var country = new Country { TwoLetterIsoCode = "US", Name = "USA" };+ country.StateProvinces.Add(new StateProvince { Abbreviation = "AK" });+ country.StateProvinces.Add(new StateProvince { Abbreviation = "CA" });await _repository.InsertAsync(country);- var states = new List<CountryStatesDto>() {- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 }+ var states = new List<CountryStatesDto> {+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 }};//Actawait _countryImportDataObject.Execute(states);@@ -78,15 +78,15 @@ namespace Grand.Business.Common.Tests.Services.ExportImportpublic async Task ExecuteTest_Import_Insert_Update_States(){//Arrange- var country = new Country() { TwoLetterIsoCode = "US", Name = "USA" };- country.StateProvinces.Add(new StateProvince() { Abbreviation = "AK" });- country.StateProvinces.Add(new StateProvince() { Abbreviation = "CA" });+ var country = new Country { TwoLetterIsoCode = "US", Name = "USA" };+ country.StateProvinces.Add(new StateProvince { Abbreviation = "AK" });+ country.StateProvinces.Add(new StateProvince { Abbreviation = "CA" });await _repository.InsertAsync(country);- var states = new List<CountryStatesDto>() {- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 },- new CountryStatesDto() { Country = country.TwoLetterIsoCode, Abbreviation = "HI", StateProvinceName = "Hawaii", Published = true, DisplayOrder = 1 }+ var states = new List<CountryStatesDto> {+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "AK", StateProvinceName = "Alaska", Published = true },+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "CA", StateProvinceName = "California", Published = true, DisplayOrder = 1 },+ new CountryStatesDto { Country = country.TwoLetterIsoCode, Abbreviation = "HI", StateProvinceName = "Hawaii", Published = true, DisplayOrder = 1 }};//Actawait _countryImportDataObject.Execute(states);diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Localization/LanguageServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Localization/LanguageServiceTests.csindex 867c441ee..7556e971f 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Localization/LanguageServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Localization/LanguageServiceTests.cs@@ -26,7 +26,7 @@ namespace Grand.Business.Common.Tests.Services.Localization_repository = new MongoDBRepositoryTest<Language>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_languageService = new LanguageService(_cacheBase, _repository, _mediatorMock.Object);}@@ -34,9 +34,9 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetAllLanguagesTest(){//Arrange- await _repository.InsertAsync(new Language() { Published = true });- await _repository.InsertAsync(new Language() { Published = true });- await _repository.InsertAsync(new Language() { Published = true });+ await _repository.InsertAsync(new Language { Published = true });+ await _repository.InsertAsync(new Language { Published = true });+ await _repository.InsertAsync(new Language { Published = true });//Actvar result = await _languageService.GetAllLanguages();//Assert@@ -48,10 +48,10 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetLanguageByIdTest(){//Arrange- var language = new Language() { Published = true, Id = "1" };+ var language = new Language { Published = true, Id = "1" };await _repository.InsertAsync(language);- await _repository.InsertAsync(new Language() { Published = true });- await _repository.InsertAsync(new Language() { Published = true });+ await _repository.InsertAsync(new Language { Published = true });+ await _repository.InsertAsync(new Language { Published = true });//Actvar result = await _languageService.GetLanguageById(language.Id);//Assert@@ -62,10 +62,10 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetLanguageByCodeTest(){//Arrange- var language = new Language() { Published = true, Id = "1", UniqueSeoCode = "en" };+ var language = new Language { Published = true, Id = "1", UniqueSeoCode = "en" };await _repository.InsertAsync(language);- await _repository.InsertAsync(new Language() { Published = true });- await _repository.InsertAsync(new Language() { Published = true });+ await _repository.InsertAsync(new Language { Published = true });+ await _repository.InsertAsync(new Language { Published = true });//Actvar result = await _languageService.GetLanguageByCode(language.UniqueSeoCode);//Assert@@ -76,7 +76,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task InsertLanguageTest(){//Arrange- var language = new Language() { Published = true, Id = "1", UniqueSeoCode = "en" };+ var language = new Language { Published = true, Id = "1", UniqueSeoCode = "en" };//Actawait _languageService.InsertLanguage(language);//Assert@@ -87,7 +87,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task UpdateLanguageTest(){//Arrange- var language = new Language() { Published = true, Id = "1", UniqueSeoCode = "en" };+ var language = new Language { Published = true, Id = "1", UniqueSeoCode = "en" };await _languageService.InsertLanguage(language);//Actlanguage.FlagImageFileName = "en.png";@@ -100,7 +100,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task DeleteLanguageTest(){//Arrange- var language = new Language() { Published = true, Id = "1", UniqueSeoCode = "en" };+ var language = new Language { Published = true, Id = "1", UniqueSeoCode = "en" };await _languageService.InsertLanguage(language);//Actawait _languageService.DeleteLanguage(language);diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.csindex 5ed519f97..9d86b0fcc 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs@@ -29,11 +29,11 @@ namespace Grand.Business.Common.Tests.Services.Localization_repository = new MongoDBRepositoryTest<TranslationResource>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_workContextMock = new Mock<IWorkContext>();_workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store());_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());- _workContextMock.Setup(c => c.WorkingLanguage).Returns(() => new Language() { Id = "1" });+ _workContextMock.Setup(c => c.WorkingLanguage).Returns(() => new Language { Id = "1" });_translationService = new TranslationService(_cacheBase, _workContextMock.Object, _repository, _mediatorMock.Object);}@@ -56,7 +56,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetTranslateResourceByNameTest(){//Arrange- var translationResource = new TranslationResource() { Name = "name", LanguageId = "1" };+ var translationResource = new TranslationResource { Name = "name", LanguageId = "1" };await _repository.InsertAsync(translationResource);//Act@@ -70,9 +70,9 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetAllResourcesTest(){//Arrange- await _repository.InsertAsync(new TranslationResource() { LanguageId = "1" });- await _repository.InsertAsync(new TranslationResource() { LanguageId = "1" });- await _repository.InsertAsync(new TranslationResource() { LanguageId = "2" });+ await _repository.InsertAsync(new TranslationResource { LanguageId = "1" });+ await _repository.InsertAsync(new TranslationResource { LanguageId = "1" });+ await _repository.InsertAsync(new TranslationResource { LanguageId = "2" });//Actvar result = _translationService.GetAllResources("1");@@ -85,7 +85,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task InsertTranslateResourceTest(){//Arrange- var translationResource = new TranslationResource() { Name = "name", LanguageId = "1" };+ var translationResource = new TranslationResource { Name = "name", LanguageId = "1" };//Actawait _translationService.InsertTranslateResource(translationResource);@@ -98,7 +98,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task UpdateTranslateResourceTest(){//Arrange- var translationResource = new TranslationResource() { Name = "name", Value = "value", LanguageId = "1" };+ var translationResource = new TranslationResource { Name = "name", Value = "value", LanguageId = "1" };await _translationService.InsertTranslateResource(translationResource);//Act@@ -113,7 +113,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task DeleteTranslateResourceTest(){//Arrange- var translationResource = new TranslationResource() { Name = "name", Value = "value", LanguageId = "1" };+ var translationResource = new TranslationResource { Name = "name", Value = "value", LanguageId = "1" };await _translationService.InsertTranslateResource(translationResource);//Act@@ -127,9 +127,9 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task GetResourceTest(){//Arrange- await _repository.InsertAsync(new TranslationResource() { Name = "name1", Value = "value1", LanguageId = "1" });- await _repository.InsertAsync(new TranslationResource() { Name = "name2", Value = "value2", LanguageId = "1" });- await _repository.InsertAsync(new TranslationResource() { Name = "name3", Value = "value3", LanguageId = "2" });+ await _repository.InsertAsync(new TranslationResource { Name = "name1", Value = "value1", LanguageId = "1" });+ await _repository.InsertAsync(new TranslationResource { Name = "name2", Value = "value2", LanguageId = "1" });+ await _repository.InsertAsync(new TranslationResource { Name = "name3", Value = "value3", LanguageId = "2" });//Actvar result = _translationService.GetResource("name1");@@ -143,10 +143,10 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task ExportResourcesToXmlTest(){//Arrange- await _repository.InsertAsync(new TranslationResource() { Name = "name1", Value = "value1", LanguageId = "1" });+ await _repository.InsertAsync(new TranslationResource { Name = "name1", Value = "value1", LanguageId = "1" });//Act- var result = await _translationService.ExportResourcesToXml(new Language() { Id = "1", Name = "en"});+ var result = await _translationService.ExportResourcesToXml(new Language { Id = "1", Name = "en"});//AssertAssert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?><Language Name=\"en\"><Resource Name=\"name1\" Area=\"Common\"><Value>value1</Value></Resource></Language>", result);@@ -156,7 +156,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task ImportResourcesFromXmlTest(){//Act- await _translationService.ImportResourcesFromXml(new Language() { Id = "1", Name = "en" }, "<?xml version=\"1.0\" encoding=\"utf-16\"?><Language Name=\"en\"><Resource Name=\"name1\" Area=\"Common\"><Value>value1</Value></Resource></Language>");+ await _translationService.ImportResourcesFromXml(new Language { Id = "1", Name = "en" }, "<?xml version=\"1.0\" encoding=\"utf-16\"?><Language Name=\"en\"><Resource Name=\"name1\" Area=\"Common\"><Value>value1</Value></Resource></Language>");//AssertAssert.IsTrue(_repository.Table.Any());@@ -166,7 +166,7 @@ namespace Grand.Business.Common.Tests.Services.Localizationpublic async Task ImportResourcesFromXmlInstallTest(){//Act- await _translationService.ImportResourcesFromXmlInstall(new Language() { Id = "1", Name = "en" }, "<?xml version=\"1.0\" encoding=\"utf-16\"?><Language Name=\"en\"><Resource Name=\"name1\" Area=\"Common\"><Value>value1</Value></Resource></Language>");+ await _translationService.ImportResourcesFromXmlInstall(new Language { Id = "1", Name = "en" }, "<?xml version=\"1.0\" encoding=\"utf-16\"?><Language Name=\"en\"><Resource Name=\"name1\" Area=\"Common\"><Value>value1</Value></Resource></Language>");//AssertAssert.IsTrue(_repository.Table.Any());diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Security/PermissionServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Security/PermissionServiceTests.csindex 18d2444f8..18b8353ca 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Security/PermissionServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Security/PermissionServiceTests.cs@@ -35,12 +35,12 @@ namespace Grand.Business.Common.Tests.Services.Security[TestMethod]public async Task Authorize_ReturnTrue(){- Permission permission = new Permission() { SystemName = "permistion" };+ Permission permission = new Permission { SystemName = "permistion" };var fakeCustomer = new Customer();fakeCustomer.Groups.Add("group1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(fakeCustomer);_cacheMock.Setup(c => c.GetAsync<bool>(It.IsAny<string>(), It.IsAny<Func<Task<bool>>>())).Returns(Task.FromResult(true));- _groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(new List<CustomerGroup>() { new CustomerGroup() }));+ _groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(new List<CustomerGroup> { new CustomerGroup() }));Assert.IsTrue(await _service.Authorize(permission));}@@ -52,7 +52,7 @@ namespace Grand.Business.Common.Tests.Services.SecurityfakeCustomer.Groups.Add("group1");_workContextMock.Setup(c => c.CurrentCustomer).Returns(fakeCustomer);_cacheMock.Setup(c => c.GetAsync<bool>(It.IsAny<string>(), It.IsAny<Func<Task<bool>>>())).Returns(Task.FromResult(true));- _groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(new List<CustomerGroup>() { new CustomerGroup() }));+ _groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(new List<CustomerGroup> { new CustomerGroup() }));Assert.IsFalse(await _service.Authorize(permission));}diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Seo/SlugServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Seo/SlugServiceTests.csindex 84d9f1585..2f23e9291 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Seo/SlugServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Seo/SlugServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Common.Tests.Services.Seo_repository = new MongoDBRepositoryTest<EntityUrl>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_slugService = new SlugService(_cacheBase, _repository);}@@ -35,7 +35,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task GetEntityUrlByIdTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };await _repository.InsertAsync(entity);//Actvar result = _slugService.GetEntityUrlById(entity.Id);@@ -47,7 +47,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task InsertEntityUrlTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };//Actawait _slugService.InsertEntityUrl(entity);//Assert@@ -58,7 +58,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task UpdateEntityUrlTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };await _slugService.InsertEntityUrl(entity);//Actentity.Slug = "slug2";@@ -71,7 +71,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task DeleteEntityUrlTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };await _slugService.InsertEntityUrl(entity);//Actawait _slugService.DeleteEntityUrl(entity);@@ -83,7 +83,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task GetBySlugTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };await _slugService.InsertEntityUrl(entity);//Actvar result = await _slugService.GetBySlug(entity.Slug);@@ -95,7 +95,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task GetBySlugCachedTest(){//Arrange- var entity = new EntityUrl() { Slug = "slug" };+ var entity = new EntityUrl { Slug = "slug" };await _slugService.InsertEntityUrl(entity);//Actvar result = await _slugService.GetBySlugCached(entity.Slug);@@ -120,7 +120,7 @@ namespace Grand.Business.Common.Tests.Services.Seopublic async Task GetActiveSlugTest(){//Arrange- await _slugService.InsertEntityUrl(new EntityUrl() { IsActive = true });+ await _slugService.InsertEntityUrl(new EntityUrl { IsActive = true });//Actvar result = await _slugService.GetAllEntityUrl();//Assertdiff --git a/src/Tests/Grand.Business.Common.Tests/Services/Stores/StoreServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Stores/StoreServiceTests.csindex 7135fd14f..ea3d68f4c 100644--- a/src/Tests/Grand.Business.Common.Tests/Services/Stores/StoreServiceTests.cs+++ b/src/Tests/Grand.Business.Common.Tests/Services/Stores/StoreServiceTests.cs@@ -48,7 +48,7 @@ namespace Grand.Business.Common.Tests.Services.Storespublic async Task DeleteStore_ValidArgument_InvokeExpectedMethods(){_cacheMock.Setup(c => c.GetAsync<List<Store>>(It.IsAny<string>(), It.IsAny<Func<Task<List<Store>>>>()))- .Returns(Task.FromResult(new List<Store>() { new Store(), new Store() }));+ .Returns(Task.FromResult(new List<Store> { new Store(), new Store() }));await _service.DeleteStore(new Store());_repository.Verify(c => c.DeleteAsync(It.IsAny<Store>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityDeleted<Store>>(), default), Times.Once);@@ -60,7 +60,7 @@ namespace Grand.Business.Common.Tests.Services.Stores{//can not remove store if it is only one_cacheMock.Setup(c => c.GetAsync<List<Store>>(It.IsAny<string>(), It.IsAny<Func<Task<List<Store>>>>()))- .Returns(Task.FromResult(new List<Store>() { new Store() }));+ .Returns(Task.FromResult(new List<Store> { new Store() }));Assert.ThrowsExceptionAsync<Exception>(async () => await _service.DeleteStore(new Store()));}}diff --git a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.csindex 572f8792b..30766f9b9 100644--- a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs@@ -36,7 +36,7 @@ namespace Grand.Business.Customers.Tests.Extensions{var firstName = "Test name";Affiliate affiliate = new Affiliate {- Address = new Domain.Common.Address() { FirstName = firstName }+ Address = new Domain.Common.Address { FirstName = firstName }};Assert.AreEqual(firstName, affiliate.GetFullName());}@@ -46,7 +46,7 @@ namespace Grand.Business.Customers.Tests.Extensions{var lastName = "Test name";Affiliate affiliate = new Affiliate {- Address = new Domain.Common.Address() { LastName = lastName }+ Address = new Domain.Common.Address { LastName = lastName }};Assert.AreEqual(lastName, affiliate.GetFullName());}@@ -56,7 +56,7 @@ namespace Grand.Business.Customers.Tests.Extensions{var fullName = string.Format("{0} {1}", "first name", "lastName");Affiliate affiliate = new Affiliate {- Address = new Domain.Common.Address() { LastName = "lastName", FirstName = "first name" }+ Address = new Domain.Common.Address { LastName = "lastName", FirstName = "first name" }};Assert.AreEqual(fullName, affiliate.GetFullName());}@@ -79,10 +79,10 @@ namespace Grand.Business.Customers.Tests.Extensionspublic void GenerateUrl_NullFriendlyUrlName_UseId(){var id = "id";- Affiliate affiliate = new Affiliate() {+ Affiliate affiliate = new Affiliate {Id = id};- _workContextMock.Setup(c => c.CurrentStore).Returns(new Domain.Stores.Store() { Url = _fakeStoreUrl });+ _workContextMock.Setup(c => c.CurrentStore).Returns(new Domain.Stores.Store { Url = _fakeStoreUrl });Assert.AreEqual(string.Format(_expectedFormat, "affiliateid", id), affiliate.GenerateUrl("http://localhost/"));//_webHelperMock.Verify(c => c.ModifyQueryString(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once);}@@ -91,10 +91,10 @@ namespace Grand.Business.Customers.Tests.Extensionspublic void GenerateUrl_ValideParameters(){var friendlyUrl = "friendlyurl";- Affiliate affiliate = new Affiliate() {+ Affiliate affiliate = new Affiliate {FriendlyUrlName = friendlyUrl};- _workContextMock.Setup(c => c.CurrentStore).Returns(new Domain.Stores.Store() { Url = _fakeStoreUrl });+ _workContextMock.Setup(c => c.CurrentStore).Returns(new Domain.Stores.Store { Url = _fakeStoreUrl });Assert.AreEqual(string.Format(_expectedFormat, "affiliate", friendlyUrl), affiliate.GenerateUrl("http://localhost/"));}@@ -105,7 +105,7 @@ namespace Grand.Business.Customers.Tests.Extensions_affiliateServiceMock.Setup(c => c.GetAffiliateByFriendlyUrlName(It.IsAny<string>())).Returns(() => Task.FromResult<Affiliate>(null));var friendlyUrl = "macbool-pro";- Affiliate affiliate = new Affiliate() {+ Affiliate affiliate = new Affiliate {FriendlyUrlName = friendlyUrl};var result = await affiliate.ValidateFriendlyUrlName(_affiliateServiceMock.Object, new Domain.Seo.SeoSettings(), friendlyUrl, "");@@ -125,7 +125,7 @@ namespace Grand.Business.Customers.Tests.Extensions}).Callback(() => invokeNumber++);var friendlyUrl = "macbool-pro";var expectedUrl = "macbool-pro-3";- Affiliate affiliate = new Affiliate() {+ Affiliate affiliate = new Affiliate {FriendlyUrlName = friendlyUrl};var result = await affiliate.ValidateFriendlyUrlName(_affiliateServiceMock.Object, new Domain.Seo.SeoSettings(), friendlyUrl, "");diff --git a/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.csindex e90c56ca2..c259fe686 100644--- a/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs@@ -32,10 +32,10 @@ namespace Grand.Business.Customers.Tests.Handler[TestMethod()]public async Task Handle_ValidArguments_InsertCustomerGroupInCustomer(){- var command = new ActiveVendorCommand() { CustomerIds = new List<string>() { "id" } };+ var command = new ActiveVendorCommand { CustomerIds = new List<string> { "id" } };command.Active = true;command.Vendor = new Domain.Vendors.Vendor();- _cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = true }));+ _cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));_groupServiceMock.Setup(c => c.IsAdmin(It.IsAny<Customer>())).Returns(() => Task.FromResult(false));_groupServiceMock.Setup(c => c.GetCustomerGroupBySystemName(It.IsAny<string>())).Returns(() => Task.FromResult(new CustomerGroup()));await _handler.Handle(command, default);@@ -47,10 +47,10 @@ namespace Grand.Business.Customers.Tests.Handler[TestMethod()]public async Task Handle_ValidArguments_DeleteCustomerGroupInCustomer(){- var command = new ActiveVendorCommand() { CustomerIds = new List<string>() { "id" } };+ var command = new ActiveVendorCommand { CustomerIds = new List<string> { "id" } };command.Active = false;command.Vendor = new Domain.Vendors.Vendor();- _cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer() { Active = true }));+ _cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));_groupServiceMock.Setup(c => c.IsAdmin(It.IsAny<Customer>())).Returns(() => Task.FromResult(false));_groupServiceMock.Setup(c => c.IsVendor(It.IsAny<Customer>())).Returns(() => Task.FromResult(true));_groupServiceMock.Setup(c => c.GetCustomerGroupBySystemName(It.IsAny<string>())).Returns(() => Task.FromResult(new CustomerGroup()));diff --git a/src/Tests/Grand.Business.Customers.Tests/Handler/CustomerLoginFailedNotificationHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Handler/CustomerLoginFailedNotificationHandlerTests.csindex 2d2802b12..e37c37b92 100644--- a/src/Tests/Grand.Business.Customers.Tests/Handler/CustomerLoginFailedNotificationHandlerTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Handler/CustomerLoginFailedNotificationHandlerTests.cs@@ -18,7 +18,7 @@ namespace Grand.Business.Customers.Tests.Handlerpublic void Init(){_customerServiceMock = new Mock<ICustomerService>();- _customerSettings = new CustomerSettings(){ FailedPasswordAllowedAttempts = 10 };+ _customerSettings = new CustomerSettings { FailedPasswordAllowedAttempts = 10 };_handler = new CustomerLoginFailedEventHandler(_customerServiceMock.Object, _customerSettings);}diff --git a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.csindex df12e05b2..bcf833ae0 100644--- a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.cs@@ -16,20 +16,20 @@ namespace Grand.Business.Customers.Tests.Queries.Handlerspublic void Init(){_groupServiceMock = new Mock<IGroupService>();- handler = new GetPasswordIsExpiredQueryHandler(_groupServiceMock.Object, new Domain.Customers.CustomerSettings() { PasswordLifetime = 10 });+ handler = new GetPasswordIsExpiredQueryHandler(_groupServiceMock.Object, new Domain.Customers.CustomerSettings { PasswordLifetime = 10 });}[TestMethod()]public async Task HandleTest(){//Assert- var cr = new CustomerGroup() { Active = true, EnablePasswordLifetime = true };- var cgs = new List<CustomerGroup>() { cr };+ var cr = new CustomerGroup { Active = true, EnablePasswordLifetime = true };+ var cgs = new List<CustomerGroup> { cr };_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(cgs));var passwordIsExpiredQuery = new Core.Queries.Customers.GetPasswordIsExpiredQuery();- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };customer.Groups.Add(cr.Id);passwordIsExpiredQuery.Customer = customer;//Actdiff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.csindex c9a7f3a3b..d7963094b 100644--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs@@ -26,23 +26,23 @@ namespace Grand.Business.Customers.Tests.Services}_parser = new CustomerAttributeParser(_customerAtrServiceMock.Object);- customAtr = new List<CustomAttribute>()- {- new CustomAttribute(){Key="key1",Value="value1" },- new CustomAttribute(){Key="key2",Value="value2" },- new CustomAttribute(){Key="key3",Value="value3" },- new CustomAttribute(){Key="key4",Value="value4" }- };+ customAtr = [+ new CustomAttribute { Key = "key1", Value = "value1" },+ new CustomAttribute { Key = "key2", Value = "value2" },+ new CustomAttribute { Key = "key3", Value = "value3" },+ new CustomAttribute { Key = "key4", Value = "value4" }+ ];- _customerAtr = new List<CustomerAttribute>()- {- new CustomerAttribute(){Id="key1", Name="name1", AttributeControlTypeId = Domain.Catalog.AttributeControlType.TextBox},- new CustomerAttribute(){Id="key2", Name="name2"},- new CustomerAttribute(){Id="key3", Name="name3"},- new CustomerAttribute(){Id="key4", Name="name4"},- new CustomerAttribute(){Id="key5", Name="name5"}- };- _customerAtr.ForEach(c => c.CustomerAttributeValues.Add(new CustomerAttributeValue() { Id = "value" + c.Id.Last() }));+ _customerAtr = [+ new CustomerAttribute {+ Id = "key1", Name = "name1", AttributeControlTypeId = Domain.Catalog.AttributeControlType.TextBox+ },+ new CustomerAttribute { Id = "key2", Name = "name2" },+ new CustomerAttribute { Id = "key3", Name = "name3" },+ new CustomerAttribute { Id = "key4", Name = "name4" },+ new CustomerAttribute { Id = "key5", Name = "name5" }+ ];+ _customerAtr.ForEach(c => c.CustomerAttributeValues.Add(new CustomerAttributeValue { Id = "value" + c.Id.Last() }));}[TestMethod()]@@ -85,7 +85,7 @@ namespace Grand.Business.Customers.Tests.Services{//not exist- var result = _parser.AddCustomerAttribute(customAtr, new CustomerAttribute() { Id = "key7" }, "value7");+ var result = _parser.AddCustomerAttribute(customAtr, new CustomerAttribute { Id = "key7" }, "value7");Assert.IsTrue(result.Count == 5);Assert.IsTrue(result.Any(c => c.Key.Equals("key7")));}@@ -113,8 +113,8 @@ namespace Grand.Business.Customers.Tests.Services_customerAtrServiceMock.Setup(c => c.GetAllCustomerAttributes()).Returns(() => Task.FromResult((IList<CustomerAttribute>)_customerAtr));_customerAtrServiceMock.Setup(c => c.GetCustomerAttributeById(It.IsAny<string>())).Returns((string w) => Task.FromResult(_customerAtr.FirstOrDefault(a => a.Id.Equals(w))));var result = await _parser.FormatAttributes(new Domain.Localization.Language(),- new List<CustomAttribute>() {- new CustomAttribute(){Key="key1",Value="value1" }+ new List<CustomAttribute> {+ new CustomAttribute {Key="key1",Value="value1" }});Assert.IsTrue(result == "name1: value1");}diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.csindex 22b1081c3..f9e6107fa 100644--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs@@ -37,8 +37,8 @@ namespace Grand.Business.Customers.Tests.Services{//Arrange//Act- await _customerHistoryPasswordService.InsertCustomerPassword(new Customer() {Id = "1" });- await _customerHistoryPasswordService.InsertCustomerPassword(new Customer() { Id = "1" });+ await _customerHistoryPasswordService.InsertCustomerPassword(new Customer {Id = "1" });+ await _customerHistoryPasswordService.InsertCustomerPassword(new Customer { Id = "1" });//Actvar result = await _customerHistoryPasswordService.GetPasswords("1", 1);diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.csindex d6b55344b..48cbcb60d 100644--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs@@ -45,7 +45,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task LoginCustomerTest_WrongPassword(){//Arrange- var customer = new Customer() { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "12345" };+ var customer = new Customer { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "12345" };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult<Customer>(customer));_groupServiceMock.Setup(c => c.IsRegistered(It.IsAny<Customer>())).Returns(() => Task.FromResult(true));//Act@@ -57,7 +57,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task LoginCustomerTest_Successful(){//Arrange- var customer = new Customer() { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "123456" };+ var customer = new Customer { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "123456" };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult<Customer>(customer));_groupServiceMock.Setup(c => c.IsRegistered(It.IsAny<Customer>())).Returns(() => Task.FromResult(true));//Act@@ -70,7 +70,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task ChangePasswordTest_Success(){//Arrange- var customer = new Customer() { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "123456" };+ var customer = new Customer { Active = true, PasswordFormatId = PasswordFormat.Clear, Password = "123456" };_customerServiceMock.Setup(c => c.GetCustomerByEmail(It.IsAny<string>())).Returns(() => Task.FromResult<Customer>(customer));var changepassword = new Core.Utilities.Customers.ChangePasswordRequest("[email protected]",diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.csindex 363238094..6c9ff7d98 100644--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs@@ -35,9 +35,9 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task GetOnlineCustomersTest(){//Assert- await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });- await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });- await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });+ await _repository.InsertAsync(new Customer { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });+ await _repository.InsertAsync(new Customer { LastActivityDateUtc = DateTime.UtcNow });+ await _repository.InsertAsync(new Customer { LastActivityDateUtc = DateTime.UtcNow });//Actvar result = await _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-1), null);//Assert@@ -48,10 +48,10 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task GetCountOnlineShoppingCartTest(){//Assert- await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });- await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });- var customer = new Customer() { LastUpdateCartDateUtc = DateTime.UtcNow, Active = true };- customer.ShoppingCartItems.Add(new Domain.Orders.ShoppingCartItem() { CreatedOnUtc = DateTime.UtcNow, ShoppingCartTypeId = Domain.Orders.ShoppingCartType.ShoppingCart });+ await _repository.InsertAsync(new Customer { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });+ await _repository.InsertAsync(new Customer { LastActivityDateUtc = DateTime.UtcNow });+ var customer = new Customer { LastUpdateCartDateUtc = DateTime.UtcNow, Active = true };+ customer.ShoppingCartItems.Add(new Domain.Orders.ShoppingCartItem { CreatedOnUtc = DateTime.UtcNow, ShoppingCartTypeId = Domain.Orders.ShoppingCartType.ShoppingCart });await _repository.InsertAsync(customer);//Actvar result = await _customerService.GetCountOnlineShoppingCart(DateTime.UtcNow.AddMinutes(-1), null);@@ -63,7 +63,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task GetCustomerByIdTest(){//Assert- await _repository.InsertAsync(new Customer() { Id = "1" });+ await _repository.InsertAsync(new Customer { Id = "1" });//Actvar result = await _customerService.GetCustomerById("1");//Assert@@ -74,11 +74,11 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task GetCustomersByIdsTest(){//Assert- await _repository.InsertAsync(new Customer() { Id = "1" });- await _repository.InsertAsync(new Customer() { Id = "2" });- await _repository.InsertAsync(new Customer() { Id = "3" });+ await _repository.InsertAsync(new Customer { Id = "1" });+ await _repository.InsertAsync(new Customer { Id = "2" });+ await _repository.InsertAsync(new Customer { Id = "3" });//Act- var result = await _customerService.GetCustomersByIds(new[] { "1", "2" });+ var result = await _customerService.GetCustomersByIds(["1", "2"]);//AssertAssert.AreEqual(2, result.Count);}@@ -88,7 +88,7 @@ namespace Grand.Business.Customers.Tests.Services{//Assertvar guid = Guid.NewGuid();- await _repository.InsertAsync(new Customer() { CustomerGuid = guid });+ await _repository.InsertAsync(new Customer { CustomerGuid = guid });//Actvar result = await _customerService.GetCustomerByGuid(guid);//Assert@@ -100,7 +100,7 @@ namespace Grand.Business.Customers.Tests.Services{//Assertvar email = "[email protected]";- await _repository.InsertAsync(new Customer() { Email = email });+ await _repository.InsertAsync(new Customer { Email = email });//Actvar result = await _customerService.GetCustomerByEmail(email);//Assert@@ -112,7 +112,7 @@ namespace Grand.Business.Customers.Tests.Services{//Assertvar systemName = "sample";- await _repository.InsertAsync(new Customer() { SystemName = systemName });+ await _repository.InsertAsync(new Customer { SystemName = systemName });//Actvar result = await _customerService.GetCustomerBySystemName(systemName);//Assert@@ -124,7 +124,7 @@ namespace Grand.Business.Customers.Tests.Services{//Assertvar userName = "user";- await _repository.InsertAsync(new Customer() { Username = userName });+ await _repository.InsertAsync(new Customer { Username = userName });//Actvar result = await _customerService.GetCustomerByUsername(userName);//Assert@@ -140,7 +140,7 @@ namespace Grand.Business.Customers.Tests.Services.Returns(Task.FromResult(cg));//Act- await _customerService.InsertGuestCustomer(new Domain.Stores.Store() { Id = "1" });+ await _customerService.InsertGuestCustomer(new Domain.Stores.Store { Id = "1" });//AssertAssert.IsTrue(_repository.Table.Any());Assert.IsTrue(_repository.Table.Where(x => x.StoreId == "1").Any());@@ -159,7 +159,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateCustomerFieldTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actawait _customerService.UpdateCustomerField(customer, x => x.Email, "[email protected]");@@ -171,7 +171,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateCustomerFieldTest_Type(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actawait _customerService.UpdateCustomerField<string>(customer, x => x.Username, "username");@@ -183,7 +183,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateCustomerTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actcustomer.Email = "[email protected]";@@ -196,7 +196,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task DeleteCustomerTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actawait _customerService.DeleteCustomer(customer);@@ -208,7 +208,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task DeleteCustomerTest_Hard(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actawait _customerService.DeleteCustomer(customer, true);@@ -220,7 +220,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateCustomerLastLoginDateTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actvar date = DateTime.UtcNow;@@ -234,7 +234,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateCustomerinAdminPanelTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actcustomer.AdminComment = "test";@@ -248,7 +248,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateActiveTest(){//Assert- var customer = new Customer() { Email = "[email protected]", Active = true };+ var customer = new Customer { Email = "[email protected]", Active = true };await _repository.InsertAsync(customer);//Actcustomer.Active = false;@@ -261,7 +261,7 @@ namespace Grand.Business.Customers.Tests.Servicespublic async Task UpdateContributionsTest(){//Assert- var customer = new Customer() { Email = "[email protected]" };+ var customer = new Customer { Email = "[email protected]" };await _repository.InsertAsync(customer);//Actcustomer.Active = false;@@ -278,10 +278,10 @@ namespace Grand.Business.Customers.Tests.Services_mediatorMock.Setup(x => x.Send(It.IsAny<GetGroupBySystemNameQuery>(), default)).Returns(Task.FromResult(cg));- var customer = new Customer() { };+ var customer = new Customer { };customer.Groups.Add(cg.Id);await _repository.InsertAsync(customer);- var customer2 = new Customer() { };+ var customer2 = new Customer { };customer2.Groups.Add("1");await _repository.InsertAsync(customer2);//Act@@ -413,7 +413,7 @@ namespace Grand.Business.Customers.Tests.Servicescustomer.ShoppingCartItems.Add(cart2);await _repository.InsertAsync(customer);//Act- await _customerService.ClearShoppingCartItem(customer.Id, new List<ShoppingCartItem>() { cart });+ await _customerService.ClearShoppingCartItem(customer.Id, new List<ShoppingCartItem> { cart });//AssertAssert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShoppingCartItems.Count);}diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.csindex c44385d68..213870127 100644--- a/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.cs+++ b/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.cs@@ -25,7 +25,7 @@ namespace Grand.Business.Customers.Tests.Services_repository = new MongoDBRepositoryTest<SalesEmployee>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_salesEmployeeService = new SalesEmployeeService(_repository, _mediatorMock.Object, _cacheBase);}diff --git a/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.csindex 8e5e493e8..cfd0bfd0c 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Extensions/ContactAttributeExtensionsTests.cs@@ -11,11 +11,11 @@ namespace Grand.Business.Marketing.Tests.Extensions[TestMethod()]public void ShouldHaveValues_ReturnExpentedResult(){- var ca = new ContactAttribute() { AttributeControlType = AttributeControlType.TextBox };- var ca2 = new ContactAttribute() { AttributeControlType = AttributeControlType.MultilineTextbox };- var ca3 = new ContactAttribute() { AttributeControlType = AttributeControlType.Datepicker };- var ca4 = new ContactAttribute() { AttributeControlType = AttributeControlType.FileUpload };- var ca5 = new ContactAttribute() { AttributeControlType = AttributeControlType.DropdownList };+ var ca = new ContactAttribute { AttributeControlType = AttributeControlType.TextBox };+ var ca2 = new ContactAttribute { AttributeControlType = AttributeControlType.MultilineTextbox };+ var ca3 = new ContactAttribute { AttributeControlType = AttributeControlType.Datepicker };+ var ca4 = new ContactAttribute { AttributeControlType = AttributeControlType.FileUpload };+ var ca5 = new ContactAttribute { AttributeControlType = AttributeControlType.DropdownList };ContactAttribute ca6 = null;Assert.AreEqual(false, ca.ShouldHaveValues());Assert.AreEqual(false, ca6.ShouldHaveValues());@@ -28,11 +28,11 @@ namespace Grand.Business.Marketing.Tests.Extensions[TestMethod()]public void CanBeUsedAsCondition_ReturnExpentedResult(){- var ca = new ContactAttribute() { AttributeControlType = AttributeControlType.TextBox };- var ca2 = new ContactAttribute() { AttributeControlType = AttributeControlType.MultilineTextbox };- var ca3 = new ContactAttribute() { AttributeControlType = AttributeControlType.Datepicker };- var ca4 = new ContactAttribute() { AttributeControlType = AttributeControlType.FileUpload };- var ca5 = new ContactAttribute() { AttributeControlType = AttributeControlType.DropdownList };+ var ca = new ContactAttribute { AttributeControlType = AttributeControlType.TextBox };+ var ca2 = new ContactAttribute { AttributeControlType = AttributeControlType.MultilineTextbox };+ var ca3 = new ContactAttribute { AttributeControlType = AttributeControlType.Datepicker };+ var ca4 = new ContactAttribute { AttributeControlType = AttributeControlType.FileUpload };+ var ca5 = new ContactAttribute { AttributeControlType = AttributeControlType.DropdownList };ContactAttribute ca6 = null;Assert.AreEqual(false, ca.CanBeUsedAsCondition());Assert.AreEqual(false, ca6.CanBeUsedAsCondition());diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Campaigns/CampaignServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Campaigns/CampaignServiceTests.csindex ba43fcfed..e2f1db331 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Campaigns/CampaignServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Campaigns/CampaignServiceTests.cs@@ -100,7 +100,7 @@ namespace Grand.Business.Marketing.Tests.Services.Campaignspublic async Task GetCampaignByIdTest(){//Arrange- var campaign = new Campaign() {+ var campaign = new Campaign {Name = "test"};await _campaignRepository.InsertAsync(campaign);@@ -132,12 +132,12 @@ namespace Grand.Business.Marketing.Tests.Services.Campaignspublic async Task GetCampaignHistoryTest(){//Arrange- var campaign = new Campaign() {+ var campaign = new Campaign {Name = "test"};await _campaignRepository.InsertAsync(campaign);- await _campaignHistoryRepository.InsertAsync(new CampaignHistory() { CampaignId = campaign.Id });- await _campaignHistoryRepository.InsertAsync(new CampaignHistory() { CampaignId = campaign.Id });+ await _campaignHistoryRepository.InsertAsync(new CampaignHistory { CampaignId = campaign.Id });+ await _campaignHistoryRepository.InsertAsync(new CampaignHistory { CampaignId = campaign.Id });//Actvar result = await _campaignService.GetCampaignHistory(campaign);@@ -150,12 +150,12 @@ namespace Grand.Business.Marketing.Tests.Services.Campaignspublic async Task CustomerSubscriptionsTest(){//Arrange- var campaign = new Campaign() {+ var campaign = new Campaign {Name = "test",StoreId = "1"};await _campaignRepository.InsertAsync(campaign);- await _newsLetterSubscriptionRepository.InsertAsync(new NewsLetterSubscription() { StoreId = "1", Active = true });+ await _newsLetterSubscriptionRepository.InsertAsync(new NewsLetterSubscription { StoreId = "1", Active = true });//Actvar result = await _campaignService.CustomerSubscriptions(campaign);@@ -167,12 +167,12 @@ namespace Grand.Business.Marketing.Tests.Services.Campaignspublic async Task SendCampaignTest(){//Arrange- var campaign = new Campaign() {+ var campaign = new Campaign {Name = "test",StoreId = "1"};await _campaignRepository.InsertAsync(campaign);- await _newsLetterSubscriptionRepository.InsertAsync(new NewsLetterSubscription() { StoreId = "1", Active = true, Email = "[email protected]" });+ await _newsLetterSubscriptionRepository.InsertAsync(new NewsLetterSubscription { StoreId = "1", Active = true, Email = "[email protected]" });_languageServiceMock.Setup(x => x.GetLanguageById(It.IsAny<string>())).Returns(Task.FromResult(new Language()));@@ -180,7 +180,7 @@ namespace Grand.Business.Marketing.Tests.Services.Campaigns.Returns(Task.FromResult(new Domain.Stores.Store()));//Act- await _campaignService.SendCampaign(campaign, new EmailAccount() { Host = "host.com" }, "[email protected]");+ await _campaignService.SendCampaign(campaign, new EmailAccount { Host = "host.com" }, "[email protected]");//Assert_emailSenderMock.Verify(c => c.SendEmail(It.IsAny<EmailAccount>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), null,null, null, null, null, null, null), Times.Once);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.csindex 119bcb838..511c4689d 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs@@ -30,23 +30,21 @@ namespace Grand.Business.Marketing.Tests.Services.Contacts}_parser = new ContactAttributeParser(_contactAttributeServiceMock.Object, _workContextMock.Object);- customAtr = new List<CustomAttribute>()- {- new CustomAttribute(){Key="key1",Value="value1" },- new CustomAttribute(){Key="key2",Value="value2" },- new CustomAttribute(){Key="key3",Value="value3" },- new CustomAttribute(){Key="key4",Value="value4" }- };+ customAtr = [+ new CustomAttribute { Key = "key1", Value = "value1" },+ new CustomAttribute { Key = "key2", Value = "value2" },+ new CustomAttribute { Key = "key3", Value = "value3" },+ new CustomAttribute { Key = "key4", Value = "value4" }+ ];- _contactAtr = new List<ContactAttribute>()- {- new ContactAttribute(){Id="key1", Name="name1", AttributeControlType = Domain.Catalog.AttributeControlType.TextBox},- new ContactAttribute(){Id="key2", Name="name2"},- new ContactAttribute(){Id="key3", Name="name3"},- new ContactAttribute(){Id="key4", Name="name4"},- new ContactAttribute(){Id="key5", Name="name5"}- };- _contactAtr.ForEach(c => c.ContactAttributeValues.Add(new ContactAttributeValue() { Id = "value" + c.Id.Last() }));+ _contactAtr = [+ new ContactAttribute { Id = "key1", Name = "name1", AttributeControlType = Domain.Catalog.AttributeControlType.TextBox },+ new ContactAttribute { Id = "key2", Name = "name2" },+ new ContactAttribute { Id = "key3", Name = "name3" },+ new ContactAttribute { Id = "key4", Name = "name4" },+ new ContactAttribute { Id = "key5", Name = "name5" }+ ];+ _contactAtr.ForEach(c => c.ContactAttributeValues.Add(new ContactAttributeValue { Id = "value" + c.Id.Last() }));}[TestMethod()]@@ -77,7 +75,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contacts[TestMethod()]public void AddContactAttributeTest(){- var result = _parser.AddContactAttribute(customAtr, new ContactAttribute() { Id = "key7" }, "value7");+ var result = _parser.AddContactAttribute(customAtr, new ContactAttribute { Id = "key7" }, "value7");Assert.IsTrue(result.Count == 5);Assert.IsTrue(result.Any(c => c.Key.Equals("key7")));}@@ -86,9 +84,9 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task IsConditionMetTest_IsConditionMet_True(){_contactAttributeServiceMock.Setup(c => c.GetContactAttributeById(It.IsAny<string>())).Returns((string w) => Task.FromResult(_contactAtr.FirstOrDefault(a => a.Id.Equals(w))));- var contactAttribute = new ContactAttribute() { };- contactAttribute.ConditionAttribute.Add(new CustomAttribute() { Key = "key2", Value = "2" });- var result = await _parser.IsConditionMet(contactAttribute, new List<CustomAttribute>() { new CustomAttribute() { Key = "key2", Value = "2" } });+ var contactAttribute = new ContactAttribute { };+ contactAttribute.ConditionAttribute.Add(new CustomAttribute { Key = "key2", Value = "2" });+ var result = await _parser.IsConditionMet(contactAttribute, new List<CustomAttribute> { new CustomAttribute { Key = "key2", Value = "2" } });Assert.IsTrue(result);}@@ -96,16 +94,16 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task IsConditionMetTest_IsConditionMet_False(){_contactAttributeServiceMock.Setup(c => c.GetContactAttributeById(It.IsAny<string>())).Returns((string w) => Task.FromResult(_contactAtr.FirstOrDefault(a => a.Id.Equals(w))));- var contactAttribute = new ContactAttribute() { };- contactAttribute.ConditionAttribute.Add(new CustomAttribute() { Key = "key2", Value = "2" });- var result = await _parser.IsConditionMet(contactAttribute, new List<CustomAttribute>() { new CustomAttribute() { Key = "key3", Value = "2" } });+ var contactAttribute = new ContactAttribute { };+ contactAttribute.ConditionAttribute.Add(new CustomAttribute { Key = "key2", Value = "2" });+ var result = await _parser.IsConditionMet(contactAttribute, new List<CustomAttribute> { new CustomAttribute { Key = "key3", Value = "2" } });Assert.IsFalse(result);}[TestMethod()]public void RemoveContactAttributeTest(){- var result = _parser.RemoveContactAttribute(customAtr, new ContactAttribute() { Id = "key1" });+ var result = _parser.RemoveContactAttribute(customAtr, new ContactAttribute { Id = "key1" });Assert.IsTrue(result.Count == 3);Assert.IsFalse(result.Any(c => c.Key.Equals("key1")));}@@ -116,8 +114,8 @@ namespace Grand.Business.Marketing.Tests.Services.Contacts_contactAttributeServiceMock.Setup(c => c.GetAllContactAttributes("", false)).Returns(() => Task.FromResult((IList<ContactAttribute>)_contactAtr));_contactAttributeServiceMock.Setup(c => c.GetContactAttributeById(It.IsAny<string>())).Returns((string w) => Task.FromResult(_contactAtr.FirstOrDefault(a => a.Id.Equals(w))));var result = await _parser.FormatAttributes(new Domain.Localization.Language(),- new List<CustomAttribute>() {- new CustomAttribute(){Key="key1",Value="value1" }+ new List<CustomAttribute> {+ new CustomAttribute {Key="key1",Value="value1" }}, new Customer());Assert.IsTrue(result == "name1: value1");}diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeServiceTests.csindex a51c61b7c..408a11da6 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeServiceTests.cs@@ -28,10 +28,10 @@ namespace Grand.Business.Marketing.Tests.Services.Contacts_repository = new MongoDBRepositoryTest<ContactAttribute>();_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => new Customer());var accessControlConfig = new AccessControlConfig();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_contactAttributeService = new ContactAttributeService(_cacheBase, _repository, _mediatorMock.Object, _workContextMock.Object, accessControlConfig);}@@ -39,7 +39,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task DeleteContactAttributeTest(){//Arrange- var contactAttribute = new ContactAttribute() {+ var contactAttribute = new ContactAttribute {Name = "test"};await _contactAttributeService.InsertContactAttribute(contactAttribute);@@ -71,7 +71,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task GetContactAttributeByIdTest(){//Arrange- var contactAttribute = new ContactAttribute() {+ var contactAttribute = new ContactAttribute {Name = "test"};await _contactAttributeService.InsertContactAttribute(contactAttribute);@@ -88,7 +88,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task InsertContactAttributeTest(){//Act- var contactAttribute = new ContactAttribute() {+ var contactAttribute = new ContactAttribute {Name = "test"};await _contactAttributeService.InsertContactAttribute(contactAttribute);@@ -101,7 +101,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task UpdateContactAttributeTest(){//Arrange- var contactAttribute = new ContactAttribute() {+ var contactAttribute = new ContactAttribute {Name = "test"};await _contactAttributeService.InsertContactAttribute(contactAttribute);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactUsServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactUsServiceTests.csindex 351b13e4e..f949fcd28 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactUsServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactUsServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task DeleteContactUsTest(){//Arrange- var contactUs = new ContactUs() {+ var contactUs = new ContactUs {FullName = "test"};await _contactUsService.InsertContactUs(contactUs);@@ -74,7 +74,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task GetContactUsByIdTest(){//Arrange- var contactUs = new ContactUs() {+ var contactUs = new ContactUs {FullName = "test"};await _contactUsService.InsertContactUs(contactUs);@@ -91,7 +91,7 @@ namespace Grand.Business.Marketing.Tests.Services.Contactspublic async Task InsertContactUsTest(){//Act- var contactUs = new ContactUs() {+ var contactUs = new ContactUs {FullName = "test"};await _contactUsService.InsertContactUs(contactUs);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.csindex 24a06a7ca..e40278525 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task DeleteTest(){//Arrange- var courseLesson = new CourseLesson() {+ var courseLesson = new CourseLesson {Name = "test"};await _courseLessonService.Insert(courseLesson);@@ -44,7 +44,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task GetByCourseIdTest(){//Arrange- var courseLesson = new CourseLesson() {+ var courseLesson = new CourseLesson {Name = "test",CourseId = "1"};@@ -62,7 +62,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task GetByIdTest(){//Arrange- var courseLesson = new CourseLesson() {+ var courseLesson = new CourseLesson {Name = "test"};await _courseLessonService.Insert(courseLesson);@@ -79,7 +79,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task InsertTest(){//Act- var courseLesson = new CourseLesson() {+ var courseLesson = new CourseLesson {Name = "test"};await _courseLessonService.Insert(courseLesson);@@ -92,7 +92,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task UpdateTest(){//Arrange- var courseLesson = new CourseLesson() {+ var courseLesson = new CourseLesson {Name = "test"};await _courseLessonService.Insert(courseLesson);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLevelServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLevelServiceTests.csindex c00bc0346..b56aef238 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLevelServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLevelServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task DeleteTest(){//Arrange- var courseLevel = new CourseLevel() {+ var courseLevel = new CourseLevel {Name = "test"};await _courseLevelService.Insert(courseLevel);@@ -59,7 +59,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task GetByIdTest(){//Arrange- var courseLevel = new CourseLevel() {+ var courseLevel = new CourseLevel {Name = "test"};await _courseLevelService.Insert(courseLevel);@@ -76,7 +76,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task InsertTest(){//Act- var courseLevel = new CourseLevel() {+ var courseLevel = new CourseLevel {Name = "test"};await _courseLevelService.Insert(courseLevel);@@ -89,7 +89,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task UpdateTest(){//Arrange- var courseLevel = new CourseLevel() {+ var courseLevel = new CourseLevel {Name = "test"};await _courseLevelService.Insert(courseLevel);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseSubjectServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseSubjectServiceTests.csindex d19292cc1..a55f13390 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseSubjectServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseSubjectServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task DeleteTest(){//Arrange- var courseSubject = new CourseSubject() {+ var courseSubject = new CourseSubject {Name = "test"};await _courseSubjectService.Insert(courseSubject);@@ -44,7 +44,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task GetByCourseIdTest(){//Arrange- var courseSubject = new CourseSubject() {+ var courseSubject = new CourseSubject {Name = "test",CourseId = "1"};@@ -62,7 +62,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task GetByIdTest(){//Arrange- var courseSubject = new CourseSubject() {+ var courseSubject = new CourseSubject {Name = "test"};await _courseSubjectService.Insert(courseSubject);@@ -79,7 +79,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task InsertTest(){//Act- var courseSubject = new CourseSubject() {+ var courseSubject = new CourseSubject {Name = "test"};await _courseSubjectService.Insert(courseSubject);@@ -92,7 +92,7 @@ namespace Grand.Business.Marketing.Tests.Services.Coursespublic async Task UpdateTest(){//Arrange- var courseSubject = new CourseSubject() {+ var courseSubject = new CourseSubject {Name = "test"};await _courseSubjectService.Insert(courseSubject);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerCoordinatesServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerCoordinatesServiceTests.csindex 8835cbef2..54eaae886 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerCoordinatesServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerCoordinatesServiceTests.cs@@ -24,7 +24,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customers_repository = new MongoDBRepositoryTest<Customer>();_mediatorMock = new Mock<IMediator>();_workContextMock = new Mock<IWorkContext>();- _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store() { Id = "" });+ _workContextMock.Setup(c => c.CurrentStore).Returns(() => new Domain.Stores.Store { Id = "" });_customer = new Customer();_workContextMock.Setup(c => c.CurrentCustomer).Returns(() => _customer);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerProductServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerProductServiceTests.csindex 51ba92b13..4c1c6e437 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerProductServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerProductServiceTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customers_repositoryCustomerProduct = new MongoDBRepositoryTest<CustomerProduct>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_customerProductService = new CustomerProductService(_repositoryCustomerProductPrice, _repositoryCustomerProduct, _cacheBase, _mediatorMock.Object);}@@ -35,7 +35,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerProductPriceByIdTest(){//Arrange- var customerProductPrice = new CustomerProductPrice() { Price = 10 };+ var customerProductPrice = new CustomerProductPrice { Price = 10 };await _repositoryCustomerProductPrice.InsertAsync(customerProductPrice);@@ -51,7 +51,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetPriceByCustomerProductTest(){//Arrange- var customerProductPrice = new CustomerProductPrice() { Price = 10, CustomerId = "1", ProductId = "1" };+ var customerProductPrice = new CustomerProductPrice { Price = 10, CustomerId = "1", ProductId = "1" };await _repositoryCustomerProductPrice.InsertAsync(customerProductPrice);@@ -67,7 +67,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task InsertCustomerProductPriceTest(){//Act- var customerProductPrice = new CustomerProductPrice() { Price = 10, CustomerId = "1", ProductId = "1" };+ var customerProductPrice = new CustomerProductPrice { Price = 10, CustomerId = "1", ProductId = "1" };await _customerProductService.InsertCustomerProductPrice(customerProductPrice);//Assert@@ -78,7 +78,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task UpdateCustomerProductPriceTest(){//Arrange- var customerProductPrice = new CustomerProductPrice() { Price = 10, CustomerId = "1", ProductId = "1" };+ var customerProductPrice = new CustomerProductPrice { Price = 10, CustomerId = "1", ProductId = "1" };await _repositoryCustomerProductPrice.InsertAsync(customerProductPrice);@@ -96,7 +96,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task DeleteCustomerProductPriceTest(){//Arrange- var customerProductPrice = new CustomerProductPrice() { Price = 10, CustomerId = "1", ProductId = "1" };+ var customerProductPrice = new CustomerProductPrice { Price = 10, CustomerId = "1", ProductId = "1" };await _repositoryCustomerProductPrice.InsertAsync(customerProductPrice);@@ -112,9 +112,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetProductsPriceByCustomerTest(){//Arrange- await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice() { CustomerId = "1" });- await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice() { CustomerId = "1" });- await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice() { CustomerId = "1" });+ await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice { CustomerId = "1" });+ await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice { CustomerId = "1" });+ await _repositoryCustomerProductPrice.InsertAsync(new CustomerProductPrice { CustomerId = "1" });//Actvar result = await _customerProductService.GetProductsPriceByCustomer("1");@@ -127,7 +127,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerProductTest(){//Arrange- var customerProduct = new CustomerProduct() { CustomerId = "1" };+ var customerProduct = new CustomerProduct { CustomerId = "1" };await _repositoryCustomerProduct.InsertAsync(customerProduct);@@ -143,7 +143,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerProductTest_Customer_Product(){//Arrange- var customerProduct = new CustomerProduct() { CustomerId = "1", ProductId = "1" };+ var customerProduct = new CustomerProduct { CustomerId = "1", ProductId = "1" };await _repositoryCustomerProduct.InsertAsync(customerProduct);@@ -159,7 +159,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task InsertCustomerProductTest(){//Act- var customerProduct = new CustomerProduct() { CustomerId = "1", ProductId = "1" };+ var customerProduct = new CustomerProduct { CustomerId = "1", ProductId = "1" };await _customerProductService.InsertCustomerProduct(customerProduct);//Assert@@ -170,7 +170,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task UpdateCustomerProductTest(){//Arrange- var customerProduct = new CustomerProduct() { CustomerId = "1", ProductId = "1", DisplayOrder = 1 };+ var customerProduct = new CustomerProduct { CustomerId = "1", ProductId = "1", DisplayOrder = 1 };await _repositoryCustomerProduct.InsertAsync(customerProduct);@@ -188,7 +188,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task DeleteCustomerProductTest(){//Arrange- var customerProduct = new CustomerProduct() { CustomerId = "1", ProductId = "1" };+ var customerProduct = new CustomerProduct { CustomerId = "1", ProductId = "1" };await _repositoryCustomerProduct.InsertAsync(customerProduct);@@ -204,9 +204,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetProductsByCustomerTest(){//Arrange- await _repositoryCustomerProduct.InsertAsync(new CustomerProduct() { CustomerId = "1" });- await _repositoryCustomerProduct.InsertAsync(new CustomerProduct() { CustomerId = "1" });- await _repositoryCustomerProduct.InsertAsync(new CustomerProduct() { CustomerId = "1" });+ await _repositoryCustomerProduct.InsertAsync(new CustomerProduct { CustomerId = "1" });+ await _repositoryCustomerProduct.InsertAsync(new CustomerProduct { CustomerId = "1" });+ await _repositoryCustomerProduct.InsertAsync(new CustomerProduct { CustomerId = "1" });//Actvar result = await _customerProductService.GetProductsByCustomer("1");diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerTagServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerTagServiceTests.csindex a5ff915d7..d46624c55 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerTagServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Customers/CustomerTagServiceTests.cs@@ -30,7 +30,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customers_repositoryCustomer = new MongoDBRepositoryTest<Customer>();_mediatorMock = new Mock<IMediator>();- _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig(){ DefaultCacheTimeMinutes = 1});+ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object, new CacheConfig { DefaultCacheTimeMinutes = 1});_customerTagService = new CustomerTagService(_repositoryCustomerTag, _repositoryCustomerTagProduct, _repositoryCustomer, _mediatorMock.Object, _cacheBase);}@@ -70,7 +70,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerscustomer3.CustomerTags.Add("1");await _repositoryCustomer.InsertAsync(customer3);- var customerTag = new CustomerTag() { Id = "1" };+ var customerTag = new CustomerTag { Id = "1" };await _repositoryCustomerTag.InsertAsync(customerTag);//Act@@ -103,7 +103,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagByIdTest(){//Assert- var customerTag = new CustomerTag() { Id = "1", Name = "test" };+ var customerTag = new CustomerTag { Id = "1", Name = "test" };await _repositoryCustomerTag.InsertAsync(customerTag);await _repositoryCustomerTag.InsertAsync(new CustomerTag());await _repositoryCustomerTag.InsertAsync(new CustomerTag());@@ -121,7 +121,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagByNameTest(){//Assert- var customerTag = new CustomerTag() { Id = "1", Name = "test" };+ var customerTag = new CustomerTag { Id = "1", Name = "test" };await _repositoryCustomerTag.InsertAsync(customerTag);await _repositoryCustomerTag.InsertAsync(new CustomerTag());await _repositoryCustomerTag.InsertAsync(new CustomerTag());@@ -139,9 +139,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagsByNameTest(){//Assert- var customerTag = new CustomerTag() { Id = "1", Name = "test" };+ var customerTag = new CustomerTag { Id = "1", Name = "test" };await _repositoryCustomerTag.InsertAsync(customerTag);- await _repositoryCustomerTag.InsertAsync(new CustomerTag() { Name = "test" });+ await _repositoryCustomerTag.InsertAsync(new CustomerTag { Name = "test" });await _repositoryCustomerTag.InsertAsync(new CustomerTag());await _repositoryCustomerTag.InsertAsync(new CustomerTag());@@ -156,7 +156,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task InsertCustomerTagTest(){//Assert- var customerTag = new CustomerTag() { Id = "1", Name = "test" };+ var customerTag = new CustomerTag { Id = "1", Name = "test" };//Actawait _customerTagService.InsertCustomerTag(customerTag);@@ -169,10 +169,10 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task InsertTagToCustomerTest(){//Arrange- var customer = new Customer() {Id = "1" };+ var customer = new Customer {Id = "1" };await _repositoryCustomer.InsertAsync(customer);- var customerTag = new CustomerTag() { Id = "1" };+ var customerTag = new CustomerTag { Id = "1" };await _repositoryCustomerTag.InsertAsync(customerTag);//Act@@ -186,11 +186,11 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task DeleteTagFromCustomerTest(){//Arrange- var customer = new Customer() { Id = "1" };+ var customer = new Customer { Id = "1" };customer.CustomerTags.Add("1");await _repositoryCustomer.InsertAsync(customer);- var customerTag = new CustomerTag() { Id = "1" };+ var customerTag = new CustomerTag { Id = "1" };await _repositoryCustomerTag.InsertAsync(customerTag);//Act@@ -204,7 +204,7 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task UpdateCustomerTagTest(){//Assert- var customerTag = new CustomerTag() { Id = "1", Name = "test" };+ var customerTag = new CustomerTag { Id = "1", Name = "test" };await _customerTagService.InsertCustomerTag(customerTag);//Act@@ -240,9 +240,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagProductsTest(){//Assert- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "2" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "2" });//Actvar result = await _customerTagService.GetCustomerTagProducts("1");@@ -255,9 +255,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagProductTest(){//Assert- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "1", ProductId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "2" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "1", ProductId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "2" });//Actvar result = await _customerTagService.GetCustomerTagProduct("1", "1");@@ -270,9 +270,9 @@ namespace Grand.Business.Marketing.Tests.Services.Customerspublic async Task GetCustomerTagProductByIdTest(){//Assert- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "1", ProductId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { Id = "1", CustomerTagId = "1" });- await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct() { CustomerTagId = "2" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "1", ProductId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { Id = "1", CustomerTagId = "1" });+ await _repositoryCustomerTagProduct.InsertAsync(new CustomerTagProduct { CustomerTagId = "2" });//Actvar result = await _customerTagService.GetCustomerTagProductById("1");diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Documents/DocumentTypeServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Documents/DocumentTypeServiceTests.csindex 1396277b0..dcf48563d 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Documents/DocumentTypeServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Documents/DocumentTypeServiceTests.cs@@ -27,11 +27,10 @@ namespace Grand.Business.Marketing.Tests.Services.Documents_mediatorMock = new Mock<IMediator>();_documentTypeRepositoryMock = new Mock<IRepository<DocumentType>>();var _mongoQueryableMock = new Mock<MongoRepository<DocumentType>>(Mock.Of<IAuditInfoProvider>());- _expected = new List<DocumentType>- {- new DocumentType() {Name = "name1", Description = "t1", DisplayOrder = 0},- new DocumentType() {Name = "name2", Description = "t2", DisplayOrder = 1}- };+ _expected = [+ new DocumentType { Name = "name1", Description = "t1", DisplayOrder = 0 },+ new DocumentType { Name = "name2", Description = "t2", DisplayOrder = 1 }+ ];_expectedQueryable = _expected.AsQueryable();//_mongoQueryableMock.Setup(x => x.ElementType).Returns(_expectedQueryable.ElementType);//_mongoQueryableMock.Setup(x => x.Expression).Returns(_expectedQueryable.Expression);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.csindex ca671c44b..b3890270a 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs@@ -44,7 +44,7 @@ namespace Grand.Business.Marketing.Tests.Services.Newsletterspublic async Task InsertNewsLetterSubscription_ActiveSubcription_InvokeRepositoryAndPublishSubscriptionEvent(){var email = "[email protected]";- var newsLetterSubscription = new NewsLetterSubscription() { Email = email, Active = true };+ var newsLetterSubscription = new NewsLetterSubscription { Email = email, Active = true };await _newsLetterSubscriptionService.InsertNewsLetterSubscription(newsLetterSubscription);_subscriptionRepository.Verify(r => r.InsertAsync(newsLetterSubscription), Times.Once);_historyServiceMock.Verify(h => h.SaveObject(It.IsAny<BaseEntity>()), Times.Once);@@ -56,7 +56,7 @@ namespace Grand.Business.Marketing.Tests.Services.Newsletterspublic async Task InsertNewsLetterSubscription_InactiveSubcription_InvokeRepository(){var email = "[email protected]";- var newsLetterSubscription = new NewsLetterSubscription() { Email = email, Active = false };+ var newsLetterSubscription = new NewsLetterSubscription { Email = email, Active = false };await _newsLetterSubscriptionService.InsertNewsLetterSubscription(newsLetterSubscription);_subscriptionRepository.Verify(r => r.InsertAsync(newsLetterSubscription), Times.Once);_historyServiceMock.Verify(h => h.SaveObject(It.IsAny<BaseEntity>()), Times.Once);@@ -68,7 +68,7 @@ namespace Grand.Business.Marketing.Tests.Services.Newsletterspublic async Task UpdateNewsLetterSubscription_InvokeRepository(){var email = "[email protected]";- var newsLetterSubscription = new NewsLetterSubscription() { Email = email, Active = false };+ var newsLetterSubscription = new NewsLetterSubscription { Email = email, Active = false };await _newsLetterSubscriptionService.UpdateNewsLetterSubscription(newsLetterSubscription);_subscriptionRepository.Verify(r => r.UpdateAsync(newsLetterSubscription), Times.Once);_historyServiceMock.Verify(h => h.SaveObject(It.IsAny<BaseEntity>()), Times.Once);@@ -79,7 +79,7 @@ namespace Grand.Business.Marketing.Tests.Services.Newsletterspublic async Task DeleteNewsLetterSubscription_InvokeRepositoryAndEmailUnsubscribedEvent(){var email = "[email protected]";- var newsLetterSubscription = new NewsLetterSubscription() { Email = email, Active = false };+ var newsLetterSubscription = new NewsLetterSubscription { Email = email, Active = false };await _newsLetterSubscriptionService.DeleteNewsLetterSubscription(newsLetterSubscription);_subscriptionRepository.Verify(r => r.DeleteAsync(newsLetterSubscription), Times.Once);_mediatorMock.Verify(m => m.Publish<EmailUnsubscribedEvent>(It.IsAny<EmailUnsubscribedEvent>(), default(CancellationToken)), Times.Once);diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/PushNotifications/PushNotificationsServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/PushNotifications/PushNotificationsServiceTests.csindex 8f0168328..87407ce0b 100644--- a/src/Tests/Grand.Business.Marketing.Tests/Services/PushNotifications/PushNotificationsServiceTests.cs+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/PushNotifications/PushNotificationsServiceTests.cs@@ -34,7 +34,7 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationsvar mockMessageHandler = new Mock<HttpMessageHandler>();- var output = JsonConvert.SerializeObject(new JsonResponse() { success = 1, failure = 0, canonical_ids = 1 });+ var output = JsonConvert.SerializeObject(new JsonResponse { success = 1, failure = 0, canonical_ids = 1 });mockMessageHandler.Protected().Setup<Task<HttpResponseMessage>>("SendAsync", ItExpr.IsAny<HttpRequestMessage>(), ItExpr.IsAny<CancellationToken>())@@ -75,7 +75,7 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task GetPushReceiverByCustomerIdTest(){//Arrange- var pushRegistration = new PushRegistration() { CustomerId = "1" };+ var pushRegistration = new PushRegistration { CustomerId = "1" };await _pushNotificationsService.InsertPushReceiver(pushRegistration);//Act@@ -90,7 +90,7 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task UpdatePushReceiverTest(){//Arrange- var pushRegistration = new PushRegistration() { CustomerId = "1" };+ var pushRegistration = new PushRegistration { CustomerId = "1" };await _pushNotificationsService.InsertPushReceiver(pushRegistration);//Act@@ -105,8 +105,8 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task GetPushReceiversTest(){//Arrange- await _pushNotificationsService.InsertPushReceiver(new PushRegistration() { Allowed = true });- await _pushNotificationsService.InsertPushReceiver(new PushRegistration() { Allowed = true });+ await _pushNotificationsService.InsertPushReceiver(new PushRegistration { Allowed = true });+ await _pushNotificationsService.InsertPushReceiver(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.GetPushReceivers();@@ -120,7 +120,7 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotifications{//Arrangeawait _pushNotificationsService.InsertPushReceiver(new PushRegistration());- await _pushNotificationsService.InsertPushReceiver(new PushRegistration() { Allowed = true });+ await _pushNotificationsService.InsertPushReceiver(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.GetAllowedReceivers();@@ -134,7 +134,7 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotifications{//Arrangeawait _pushNotificationsService.InsertPushReceiver(new PushRegistration());- await _pushNotificationsService.InsertPushReceiver(new PushRegistration() { Allowed = true });+ await _pushNotificationsService.InsertPushReceiver(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.GetDeniedReceivers();@@ -171,9 +171,9 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task GetPushReceiversTest1(){//Arrange- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.GetPushReceivers();@@ -186,9 +186,9 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task SendPushNotificationTest(){//Arrange- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.SendPushNotification("my title", "sample text", "", "");//Assert@@ -200,9 +200,9 @@ namespace Grand.Business.Marketing.Tests.Services.PushNotificationspublic async Task GetPushReceiverTest(){//Arrange- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Id = "1", Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });- await _repositoryPushRegistration.InsertAsync(new PushRegistration() { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Id = "1", Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });+ await _repositoryPushRegistration.InsertAsync(new PushRegistration { Allowed = true });//Actvar result = await _pushNotificationsService.GetPushReceiver("1");diff --git a/src/Tests/Grand.Business.Messages.Tests/Commands/InsertContactUsCommandHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Commands/InsertContactUsCommandHandlerTests.csindex 495dfb49d..b5619bf83 100644--- a/src/Tests/Grand.Business.Messages.Tests/Commands/InsertContactUsCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Commands/InsertContactUsCommandHandlerTests.cs@@ -24,7 +24,7 @@ namespace Grand.Business.Messages.Tests.Commands[TestMethod]public async Task Handler_InsertEntity(){- var command = new InsertContactUsCommand() {+ var command = new InsertContactUsCommand {ContactAttributeDescription = "d",Email = "[email protected]",ContactAttributes = new List<CustomAttribute>()diff --git a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetBidsByProductIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetBidsByProductIdQueryHandlerTests.csindex d715a998a..6f072b4df 100644--- a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetBidsByProductIdQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetBidsByProductIdQueryHandlerTests.cs@@ -15,7 +15,7 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic void Init(){var _repository = new MongoDBRepositoryTest<Bid>();- _repository.Insert(new Bid() { Id = "1", ProductId = "1" });+ _repository.Insert(new Bid { Id = "1", ProductId = "1" });_repository.Insert(new Bid());_repository.Insert(new Bid());_repository.Insert(new Bid());@@ -27,7 +27,7 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic async Task HandleTest(){//Act- var result = await handler.Handle(new Core.Queries.Messages.GetBidsByProductIdQuery() { ProductId = "1" }, CancellationToken.None);+ var result = await handler.Handle(new Core.Queries.Messages.GetBidsByProductIdQuery { ProductId = "1" }, CancellationToken.None);//AssertAssert.IsNotNull(result);}diff --git a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.csindex d50aa50ae..bbb7fc00c 100644--- a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs@@ -14,7 +14,7 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic void Init(){var _repository = new MongoDBRepositoryTest<Customer>();- _repository.Insert(new Customer() { Id = "1" });+ _repository.Insert(new Customer { Id = "1" });_repository.Insert(new Customer());_repository.Insert(new Customer());_repository.Insert(new Customer());diff --git a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetProductByIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetProductByIdQueryHandlerTests.csindex 99331b57e..cdcd0b6ee 100644--- a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetProductByIdQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetProductByIdQueryHandlerTests.cs@@ -14,7 +14,7 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic void Init(){var _repository = new MongoDBRepositoryTest<Product>();- _repository.Insert(new Product() { Id = "1" });+ _repository.Insert(new Product { Id = "1" });_repository.Insert(new Product());_repository.Insert(new Product());_repository.Insert(new Product());@@ -26,7 +26,7 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic async Task HandleTest(){//Act- var result = await handler.Handle(new Core.Queries.Messages.GetProductByIdQuery() { Id = "1" }, CancellationToken.None);+ var result = await handler.Handle(new Core.Queries.Messages.GetProductByIdQuery { Id = "1" }, CancellationToken.None);//AssertAssert.IsNotNull(result);}diff --git a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.csindex db765a558..272659359 100644--- a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetVendorByIdQueryHandlerTests.cs@@ -22,9 +22,9 @@ namespace Grand.Business.Messages.Tests.Queries.Handlerspublic async Task HandleTest(){//Arrange- await _repository.InsertAsync(new Vendor() { Id = "1" });+ await _repository.InsertAsync(new Vendor { Id = "1" });//Act- var result = await handler.Handle(new Core.Queries.Messages.GetVendorByIdQuery() { Id = "1" }, CancellationToken.None);+ var result = await handler.Handle(new Core.Queries.Messages.GetVendorByIdQuery { Id = "1" }, CancellationToken.None);//ArrangeAssert.IsNotNull(result);}diff --git a/src/Tests/Grand.Business.Messages.Tests/Services/EmailAccountServiceTests.cs b/src/Tests/Grand.Business.Messages.Tests/Services/EmailAccountServiceTests.csindex 822fddc32..c617b22f6 100644--- a/src/Tests/Grand.Business.Messages.Tests/Services/EmailAccountServiceTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Services/EmailAccountServiceTests.cs@@ -50,7 +50,7 @@ namespace Grand.Business.Messages.Tests.Services{_cacheMock.Setup(c => c.GetAsync<List<EmailAccount>>(It.IsAny<string>(), It.IsAny<Func<Task<List<EmailAccount>>>>()))- .Returns(Task.FromResult(new List<EmailAccount>() { new EmailAccount(), new EmailAccount() }));+ .Returns(Task.FromResult(new List<EmailAccount> { new EmailAccount(), new EmailAccount() }));await _service.DeleteEmailAccount(new EmailAccount());_repository.Verify(c => c.DeleteAsync(It.IsAny<EmailAccount>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityDeleted<EmailAccount>>(), default), Times.Once);@@ -62,7 +62,7 @@ namespace Grand.Business.Messages.Tests.Services{//we can't delete account if exist only one_cacheMock.Setup(c => c.GetAsync<List<EmailAccount>>(It.IsAny<string>(), It.IsAny<Func<Task<List<EmailAccount>>>>()))- .Returns(Task.FromResult(new List<EmailAccount>() { new EmailAccount() }));+ .Returns(Task.FromResult(new List<EmailAccount> { new EmailAccount() }));Assert.ThrowsExceptionAsync<GrandException>(async () => await _service.DeleteEmailAccount(new EmailAccount()));}}diff --git a/src/Tests/Grand.Business.Messages.Tests/Services/EmailSenderTests.cs b/src/Tests/Grand.Business.Messages.Tests/Services/EmailSenderTests.csindex 997bd658a..911247ae2 100644--- a/src/Tests/Grand.Business.Messages.Tests/Services/EmailSenderTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Services/EmailSenderTests.cs@@ -26,7 +26,7 @@ namespace Grand.Business.Messages.Tests.Services[TestMethod()]public void SendEmailTest(){- Assert.ThrowsExceptionAsync<SocketException>(async () => await _sender.SendEmail(new Domain.Messages.EmailAccount() { Host = "[email protected]" }, "subject", "body", "[email protected]", "admin store", "[email protected]", "Customer name"));+ Assert.ThrowsExceptionAsync<SocketException>(async () => await _sender.SendEmail(new Domain.Messages.EmailAccount { Host = "[email protected]" }, "subject", "body", "[email protected]", "admin store", "[email protected]", "Customer name"));}}}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Messages.Tests/Services/LiquidObjectBuilderTests.cs b/src/Tests/Grand.Business.Messages.Tests/Services/LiquidObjectBuilderTests.csindex 2c876e773..6e4c13269 100644--- a/src/Tests/Grand.Business.Messages.Tests/Services/LiquidObjectBuilderTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Services/LiquidObjectBuilderTests.cs@@ -24,15 +24,15 @@ namespace Grand.Business.Messages.Tests.Servicespublic async Task BuilderTest(){var builder = new LiquidObjectBuilder(_mediatorMock.Object);- var vendor = new Vendor() { Id = "VendorId", Name = "vendorName" };- var product = new Product() { Id = "productId", Name = "ProductName" };- var vendorReview = new VendorReview() { Id = "RevId" };+ var vendor = new Vendor { Id = "VendorId", Name = "vendorName" };+ var product = new Product { Id = "productId", Name = "ProductName" };+ var vendorReview = new VendorReview { Id = "RevId" };_mediatorMock.Setup(c => c.Send<LiquidVendor>(It.IsAny<IRequest<LiquidVendor>>(), default)).ReturnsAsync(new LiquidVendor(vendor));var liquidObject = await builder.AddVendorReviewTokens(vendor, vendorReview).AddVendorTokens(vendor, new Language())- .AddOutOfStockTokens(product, new OutOfStockSubscription(), new Store(), new DomainHost() { Url = "https://localhost:44350/" }, new Language())+ .AddOutOfStockTokens(product, new OutOfStockSubscription(), new Store(), new DomainHost { Url = "https://localhost:44350/" }, new Language()).BuildAsync();diff --git a/src/Tests/Grand.Business.Messages.Tests/Services/MessageProviderServiceTest.cs b/src/Tests/Grand.Business.Messages.Tests/Services/MessageProviderServiceTest.csindex 6332a621c..4e4befc94 100644--- a/src/Tests/Grand.Business.Messages.Tests/Services/MessageProviderServiceTest.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Services/MessageProviderServiceTest.cs@@ -56,7 +56,7 @@ namespace Grand.Business.Messages.Tests.Services_messageTokenProviderMock = new Mock<IMessageTokenProvider>();_storeServiceMock = new Mock<IStoreService>();- _storeServiceMock.Setup(x => x.GetStoreById(It.IsAny<string>())).Returns(Task.FromResult(new Store() { Url = "https://localhost:44350/" }));+ _storeServiceMock.Setup(x => x.GetStoreById(It.IsAny<string>())).Returns(Task.FromResult(new Store { Url = "https://localhost:44350/" }));_storeServiceMock.Setup(x => x.GetAllStores()).Returns(Task.FromResult(new List<Store>() as IList<Store>));_storeHelperServiceMock = new Mock<IStoreHelper>();@@ -100,7 +100,7 @@ namespace Grand.Business.Messages.Tests.Services[TestMethod()]public async Task SendNewVendorAccountApplyStoreOwnerNotificationRetunsCorrectResult(){- var result = await _messageService.SendNewVendorAccountApplyStoreOwnerMessage(new Customer(), new Vendor(), new Store() { Url = "https://localhost:44350/" }, "123");+ var result = await _messageService.SendNewVendorAccountApplyStoreOwnerMessage(new Customer(), new Vendor(), new Store { Url = "https://localhost:44350/" }, "123");Assert.AreEqual(result, 1);}diff --git a/src/Tests/Grand.Business.Messages.Tests/Services/MessageTemplateServiceTests.cs b/src/Tests/Grand.Business.Messages.Tests/Services/MessageTemplateServiceTests.csindex b28c86dac..65cd7bc5f 100644--- a/src/Tests/Grand.Business.Messages.Tests/Services/MessageTemplateServiceTests.cs+++ b/src/Tests/Grand.Business.Messages.Tests/Services/MessageTemplateServiceTests.cs@@ -43,7 +43,7 @@ namespace Grand.Business.Messages.Tests.Services[TestMethod]public async Task CopyMessageTemplate_InsertCopyEntity(){- var template = new MessageTemplate() {+ var template = new MessageTemplate {Id = "id1",Name = "Name"};diff --git a/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs b/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.csindex 74827eb08..170c52539 100644--- a/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs+++ b/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs@@ -28,7 +28,7 @@ namespace Grand.Business.Storage.Tests.Services[TestMethod]public async Task GetDownloadById_InvokeExpectedMethod(){- _repositoryMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Download() { DownloadUrl = "url", UseDownloadUrl = true }));+ _repositoryMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Download { DownloadUrl = "url", UseDownloadUrl = true }));var result = await _service.GetDownloadById("id");_repositoryMock.Verify(c => c.GetByIdAsync(It.IsAny<string>()), Times.Once);Assert.AreEqual(result.DownloadUrl, "url");@@ -37,7 +37,7 @@ namespace Grand.Business.Storage.Tests.Services[TestMethod]public async Task InsertDownload_InvokeExpectedMethod(){- await _service.InsertDownload(new Download() { UseDownloadUrl = true });+ await _service.InsertDownload(new Download { UseDownloadUrl = true });_repositoryMock.Verify(c => c.InsertAsync(It.IsAny<Download>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<Download>>(), default), Times.Once);}@@ -51,7 +51,7 @@ namespace Grand.Business.Storage.Tests.Services[TestMethod]public async Task UpdateDownload_InvokeExpectedMethod(){- await _service.UpdateDownload(new Download() { UseDownloadUrl = true });+ await _service.UpdateDownload(new Download { UseDownloadUrl = true });_repositoryMock.Verify(c => c.UpdateAsync(It.IsAny<Download>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityUpdated<Download>>(), default), Times.Once);}@@ -65,7 +65,7 @@ namespace Grand.Business.Storage.Tests.Services[TestMethod]public async Task DeleteDownload_InvokeExpectedMethod(){- await _service.DeleteDownload(new Download() { UseDownloadUrl = true });+ await _service.DeleteDownload(new Download { UseDownloadUrl = true });_repositoryMock.Verify(c => c.DeleteAsync(It.IsAny<Download>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityDeleted<Download>>(), default), Times.Once);}diff --git a/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs b/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.csindex 1aceb7fe1..1ba832ff4 100644--- a/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs+++ b/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs@@ -52,7 +52,9 @@ namespace Grand.Business.Storage.Tests.Servicespublic async Task LoadPictureBinary_FromDb(){_storagesettings.PictureStoreInDb = true;- _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture() { PictureBinary = new byte[] { } }));+ _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture { PictureBinary =+ []+ }));await _service.LoadPictureBinary(new Picture());_repoMock.Verify(c => c.GetByIdAsync(It.IsAny<string>()), Times.Once);}@@ -60,7 +62,9 @@ namespace Grand.Business.Storage.Tests.Services[TestMethod]public async Task LoadPictureBinary_FromDb_InvokeRepository(){- _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture() { PictureBinary = new byte[] { } }));+ _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture { PictureBinary =+ []+ }));await _service.LoadPictureBinary(new Picture(), true);_repoMock.Verify(c => c.GetByIdAsync(It.IsAny<string>()), Times.Once);}@@ -70,7 +74,7 @@ namespace Grand.Business.Storage.Tests.Servicespublic async Task LoadPictureBinary_FromFile_ReturnEmptyBytes(){_webHostMock.Setup(c => c.WebRootPath).Returns("~root/");- var result = await _service.LoadPictureBinary(new Picture() { Id = "id", MimeType = "image/jpeg" }, false);+ var result = await _service.LoadPictureBinary(new Picture { Id = "id", MimeType = "image/jpeg" }, false);//we can't mock static class like File.Exist so, should return empty arrayAssert.IsTrue(result.Length == 0);}@@ -86,7 +90,7 @@ namespace Grand.Business.Storage.Tests.Servicespublic async Task InsertPicture_InvokeExpectedMethods(){_storagesettings.PictureStoreInDb = true;- await _service.InsertPicture(new byte[] { }, "image/jpeg", "image", validateBinary: false);+ await _service.InsertPicture([], "image/jpeg", "image", validateBinary: false);_repoMock.Verify(c => c.InsertAsync(It.IsAny<Picture>()), Times.Once);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<Picture>>(), default), Times.Once);}@@ -95,8 +99,10 @@ namespace Grand.Business.Storage.Tests.Services{_storagesettings.PictureStoreInDb = true;_cacheMock.Setup(c => c.GetAsync<Picture>(It.IsAny<string>(), It.IsAny<Func<Task<Picture>>>())).Returns(Task.FromResult(new Picture()));- _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture() { PictureBinary = new byte[] { } }));- await _service.UpdatePicture("1", new byte[] { }, "image/jpeg", "image", validateBinary: false);+ _repoMock.Setup(c => c.GetByIdAsync(It.IsAny<string>())).Returns(Task.FromResult(new Picture { PictureBinary =+ []+ }));+ await _service.UpdatePicture("1", [], "image/jpeg", "image", validateBinary: false);_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityUpdated<Picture>>(), default), Times.Once);}[TestMethod]diff --git a/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs b/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.csindex 01e554724..0f9c81229 100644--- a/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs@@ -23,7 +23,7 @@ namespace Grand.Business.System.Tests.Commands[TestMethod]public async Task Handle_InvokeExpectedMethod(){- var command = new SendOutBidCustomerCommand() {+ var command = new SendOutBidCustomerCommand {Product = new Domain.Catalog.Product(),Bid = new Domain.Catalog.Bid(),Language = new Domain.Localization.Language()diff --git a/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.cs b/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.csindex 7606f8ae1..a0420a823 100644--- a/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.cs+++ b/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.cs@@ -27,7 +27,7 @@ namespace Grand.Business.System.Tests.Commandspublic async Task Handle_InvokeExpectedMethods(){_settings.DefaultAdminLanguageId = "1";- var command = new SendQuantityBelowStoreOwnerCommand() {+ var command = new SendQuantityBelowStoreOwnerCommand {Product = new Domain.Catalog.Product(),ProductAttributeCombination = null};diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.csindex 925ac9844..0f7ed5f1a 100644--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs@@ -43,7 +43,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService[TestMethod]public async Task Execute_NotBids_InvokeExpectedMethos(){- _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product>() { new Product() { Id = "id" } });+ _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product> { new Product { Id = "id" } });_auctionMock.Setup(c => c.GetBidsByProductId(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<Bid>());await _task.Execute();_auctionMock.Verify(c => c.UpdateAuctionEnded(It.IsAny<Product>(), It.IsAny<bool>(), It.IsAny<bool>()), Times.Once);@@ -54,13 +54,13 @@ namespace Grand.Business.System.Tests.Services.BackgroundService[TestMethod]public async Task Execute_HasWarnings_InvokeExpectedMethos(){- _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product>() { new Product() { Id = "id" } });- _auctionMock.Setup(c => c.GetBidsByProductId(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<Bid>() { new Bid() });+ _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product> { new Product { Id = "id" } });+ _auctionMock.Setup(c => c.GetBidsByProductId(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<Bid> { new Bid() });_shoppingCartMock.Setup(c => c.AddToCart(It.IsAny<Customer>(), It.IsAny<string>(), It.IsAny<ShoppingCartType>(), It.IsAny<string>(),It.IsAny<string>(), It.IsAny<IList<CustomAttribute>>(), It.IsAny<double?>(), It.IsAny<DateTime?>(),It.IsAny<DateTime?>(), It.IsAny<int>(), It.IsAny<bool>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),It.IsAny<ShoppingCartValidatorOptions>()))- .ReturnsAsync((new List<string>() { "warning" }, null));+ .ReturnsAsync((new List<string> { "warning" }, null));await _task.Execute();_loggerMock.Verify(c => c.Log(@@ -74,8 +74,8 @@ namespace Grand.Business.System.Tests.Services.BackgroundService[TestMethod]public async Task Execute_Valid_InvokeExpectedMethos(){- _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product>() { new Product() { Id = "id" } });- _auctionMock.Setup(c => c.GetBidsByProductId(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<Bid>() { new Bid() });+ _auctionMock.Setup(c => c.GetAuctionsToEnd()).ReturnsAsync(new List<Product> { new Product { Id = "id" } });+ _auctionMock.Setup(c => c.GetBidsByProductId(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<Bid> { new Bid() });_shoppingCartMock.Setup(c => c.AddToCart(It.IsAny<Customer>(), It.IsAny<string>(), It.IsAny<ShoppingCartType>(), It.IsAny<string>(),It.IsAny<string>(), It.IsAny<IList<CustomAttribute>>(), It.IsAny<double?>(), It.IsAny<DateTime?>(),It.IsAny<DateTime?>(), It.IsAny<int>(), It.IsAny<bool>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ShoppingCartValidatorOptions>()))diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.csindex d299a4a25..b8627f668 100644--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs@@ -33,7 +33,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService{_queuedEmailServiceMock.Setup(c => c.SearchEmails(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<DateTime?>(),It.IsAny<DateTime?>(), It.IsAny<bool>(), It.IsAny<bool>(), It.IsAny<int>(), It.IsAny<bool>(), It.IsAny<int>(), It.IsAny<string>(),- It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<QueuedEmail>() { new QueuedEmail() { Bcc = "bcc", CC = "cc", EmailAccountId = "id" } });+ It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<QueuedEmail> { new QueuedEmail { Bcc = "bcc", CC = "cc", EmailAccountId = "id" } });_emailAccountServiceMock.Setup(c => c.GetEmailAccountById(It.IsAny<string>())).ReturnsAsync(new EmailAccount());await _task.Execute();@@ -50,7 +50,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService{_queuedEmailServiceMock.Setup(c => c.SearchEmails(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<DateTime?>(),It.IsAny<DateTime?>(), It.IsAny<bool>(), It.IsAny<bool>(), It.IsAny<int>(), It.IsAny<bool>(), It.IsAny<int>(), It.IsAny<string>(),- It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<QueuedEmail>() { new QueuedEmail() { Bcc = "bcc", CC = "cc", EmailAccountId = "id" } });+ It.IsAny<int>(), It.IsAny<int>())).ReturnsAsync(() => new PagedList<QueuedEmail> { new QueuedEmail { Bcc = "bcc", CC = "cc", EmailAccountId = "id" } });_emailAccountServiceMock.Setup(c => c.GetEmailAccountById(It.IsAny<string>())).ReturnsAsync(new EmailAccount());_emailSenderMock.Setup(c => c.SendEmail(It.IsAny<EmailAccount>(), It.IsAny<string>(), It.IsAny<string>(),It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.csindex 2316d10f1..4685511de 100644--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs@@ -27,10 +27,10 @@ namespace Grand.Business.System.Tests.Services.BackgroundServicepublic async Task Execute_InvokeExpectedMethods(){_settings.AutoUpdateEnabled = true;- _currencyServiceMock.Setup(c => c.GetPrimaryExchangeRateCurrency()).ReturnsAsync(new Currency() { CurrencyCode = "EU" });+ _currencyServiceMock.Setup(c => c.GetPrimaryExchangeRateCurrency()).ReturnsAsync(new Currency { CurrencyCode = "EU" });_exchangeRateServiceMock.Setup(c => c.GetCurrencyLiveRates(It.IsAny<string>()))- .ReturnsAsync(new List<ExchangeRate>() { new ExchangeRate() { CurrencyCode = "PL", Rate = 10 } });- _currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).ReturnsAsync(new Currency() { Rate = 10 });+ .ReturnsAsync(new List<ExchangeRate> { new ExchangeRate { CurrencyCode = "PL", Rate = 10 } });+ _currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).ReturnsAsync(new Currency { Rate = 10 });await _task.Execute();_currencyServiceMock.Verify(c => c.UpdateCurrency(It.IsAny<Currency>()), Times.Once);diff --git a/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs b/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.csindex 8e79d9743..fe42299f8 100644--- a/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs+++ b/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs@@ -21,7 +21,7 @@ namespace Grand.Data.Tests.LiteDbpublic void Insert_LiteRepository_Success(){//Arrange- var product = new SampleCollection(){Id = "1"};+ var product = new SampleCollection {Id = "1"};//Act_myRepository.Insert(product);//Assert@@ -33,7 +33,7 @@ namespace Grand.Data.Tests.LiteDbpublic async Task InsertAsync_LiteRepository_Success(){//Arrange- var product = new SampleCollection(){ Id = "11"};+ var product = new SampleCollection { Id = "11"};//Actawait _myRepository.InsertAsync(product);var p = _myRepository.GetById("11");@@ -46,7 +46,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task GetById_LiteRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);var p = _myRepository.GetById("1");@@ -57,7 +57,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task GetByIdAsync_LiteRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);var p = await _myRepository.GetByIdAsync("1");@@ -68,7 +68,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task ClearAsync_LiteRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);await _myRepository.ClearAsync();@@ -80,15 +80,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task AddToSet_LiteRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);await _myRepository.AddToSet("1", x => x.UserFields,- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" });+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" });//Actawait _myRepository.AddToSet("1", x => x.UserFields,- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" });+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" });var p = _myRepository.GetById("1");//Assert@@ -101,7 +101,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task Delete_LiteRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);_myRepository.Delete(product);@@ -114,7 +114,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task DeleteAsync_LiteRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);await _myRepository.DeleteAsync(product);@@ -126,9 +126,9 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task DeleteManyAsync_LiteRepository_Success(){- await _myRepository.InsertAsync(new SampleCollection(){ Id = "1", Name = "Test" });- await _myRepository.InsertAsync(new SampleCollection(){ Id = "2", Name = "Test" });- await _myRepository.InsertAsync(new SampleCollection(){ Id = "3", Name = "Test2" });+ await _myRepository.InsertAsync(new SampleCollection { Id = "1", Name = "Test" });+ await _myRepository.InsertAsync(new SampleCollection { Id = "2", Name = "Test" });+ await _myRepository.InsertAsync(new SampleCollection { Id = "3", Name = "Test2" });await _myRepository.DeleteManyAsync(x => x.Name == "Test");@@ -139,14 +139,14 @@ namespace Grand.Data.Tests.LiteDbpublic async Task Pull_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "2", Name = "Test2",+ new SampleCollection { Id = "2", Name = "Test2",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -163,14 +163,14 @@ namespace Grand.Data.Tests.LiteDbpublic async Task Pull_Many_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "2", Name = "Test2",+ new SampleCollection { Id = "2", Name = "Test2",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -193,16 +193,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task PullFilter_1_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value1", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value1", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -222,16 +221,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task PullFilter_2_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -251,23 +249,21 @@ namespace Grand.Data.Tests.LiteDbpublic async Task PullFilter_2_Many_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value1", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ new SampleCollection { Id = "2", Name = "Test2",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value1", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }}},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -289,16 +285,15 @@ namespace Grand.Data.Tests.LiteDbpublic void Update_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -321,16 +316,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateAsync_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -351,16 +345,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateField_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -378,7 +371,7 @@ namespace Grand.Data.Tests.LiteDb[TestMethod()]public async Task IncField_MongoRepository_Success(){- var sample = new SampleCollection() { Id = "1", Name = "Test" };+ var sample = new SampleCollection { Id = "1", Name = "Test" };await _myRepository.InsertAsync(sample);await _myRepository.IncField("1", x => x.Count, 1);@@ -393,16 +386,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateManyAsync_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -424,16 +416,15 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateOneAsync_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -453,22 +444,21 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateToSet_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));//Act- await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key, "key", new Domain.Common.UserField() { Key = "key", Value = "update", StoreId = "1" });+ await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key, "key", new Domain.Common.UserField { Key = "key", Value = "update", StoreId = "1" });var p = _myRepository.GetById("1");//Assert@@ -482,21 +472,20 @@ namespace Grand.Data.Tests.LiteDbpublic async Task UpdateToSet_2_LiteRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));//Act- await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key == "key", new Domain.Common.UserField() { Key = "key", Value = "update", StoreId = "1" });+ await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key == "key", new Domain.Common.UserField { Key = "key", Value = "update", StoreId = "1" });var p = _myRepository.GetById("1");diff --git a/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs b/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.csindex 708180621..da8e72bc7 100644--- a/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs+++ b/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs@@ -37,7 +37,7 @@ namespace Grand.Data.Tests.MongoDbpublic async Task GetById_MongoRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);//Act@@ -51,7 +51,7 @@ namespace Grand.Data.Tests.MongoDbpublic async Task GetByIdAsync_MongoRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);//Actvar p = await _myRepository.GetByIdAsync("1");@@ -64,7 +64,7 @@ namespace Grand.Data.Tests.MongoDb[TestMethod()]public async Task ClearAsync_MongoRepository_Success(){- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);await _myRepository.ClearAsync();@@ -76,15 +76,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task AddToSet_MongoRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);await _myRepository.AddToSet("1", x => x.UserFields,- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" });+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" });//Actawait _myRepository.AddToSet("1", x => x.UserFields,- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" });+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" });var p = _myRepository.GetById("1");@@ -100,7 +100,7 @@ namespace Grand.Data.Tests.MongoDbpublic async Task Delete_MongoRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);//Act@@ -115,7 +115,7 @@ namespace Grand.Data.Tests.MongoDbpublic async Task DeleteAsync_MongoRepository_Success(){//Arrange- var product = new SampleCollection() { Id = "1" };+ var product = new SampleCollection { Id = "1" };await _myRepository.InsertAsync(product);//Act@@ -129,10 +129,10 @@ namespace Grand.Data.Tests.MongoDbpublic async Task DeleteManyAsync_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test" },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test2" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test" },+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test2" }};products.ForEach(x=>_myRepository.Insert(x));@@ -148,14 +148,14 @@ namespace Grand.Data.Tests.MongoDbpublic async Task Pull_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "2", Name = "Test2",+ new SampleCollection { Id = "2", Name = "Test2",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -176,14 +176,14 @@ namespace Grand.Data.Tests.MongoDbpublic async Task Pull_Many_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "2", Name = "Test2",+ new SampleCollection { Id = "2", Name = "Test2",Phones = new [] { "Phone1", "Phone2", "Phone3" }},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -207,16 +207,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task PullFilter_1_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -239,16 +238,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task PullFilter_2_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -270,23 +268,21 @@ namespace Grand.Data.Tests.MongoDbpublic async Task PullFilter_2_Many_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value1", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ new SampleCollection { Id = "2", Name = "Test2",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value1", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }}},- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -311,16 +307,15 @@ namespace Grand.Data.Tests.MongoDbpublic void Update_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -342,16 +337,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task UpdateAsync_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -372,16 +366,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task UpdateField_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test2" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test2" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -399,7 +392,7 @@ namespace Grand.Data.Tests.MongoDb[TestMethod()]public async Task IncField_MongoRepository_Success(){- var sample = new SampleCollection() { Id = "1", Name = "Test" };+ var sample = new SampleCollection { Id = "1", Name = "Test" };await _myRepository.InsertAsync(sample);await _myRepository.IncField("1", x => x.Count, 1);@@ -415,16 +408,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task UpdateManyAsync_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -444,16 +436,15 @@ namespace Grand.Data.Tests.MongoDbpublic async Task UpdateOneAsync_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));@@ -474,21 +465,20 @@ namespace Grand.Data.Tests.MongoDbpublic async Task UpdateToSet_MongoRepository_Success(){//Arrange- var products = new List<SampleCollection>() {- new SampleCollection(){ Id = "1", Name = "Test",- UserFields = new List<Domain.Common.UserField>()- {- new Domain.Common.UserField() { Key = "key", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key1", Value = "value", StoreId = "" },- new Domain.Common.UserField() { Key = "key2", Value = "value2", StoreId = "" }+ var products = new List<SampleCollection> {+ new SampleCollection { Id = "1", Name = "Test",+ UserFields = new List<Domain.Common.UserField> {+ new Domain.Common.UserField { Key = "key", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key1", Value = "value", StoreId = "" },+ new Domain.Common.UserField { Key = "key2", Value = "value2", StoreId = "" }} },- new SampleCollection(){ Id = "2", Name = "Test" },- new SampleCollection(){ Id = "3", Name = "Test3" }+ new SampleCollection { Id = "2", Name = "Test" },+ new SampleCollection { Id = "3", Name = "Test3" }};products.ForEach(x=>_myRepository.Insert(x));//Act- await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key, "key", new Domain.Common.UserField() { Key = "key", Value = "update", StoreId = "1" });+ await _myRepository.UpdateToSet("1", x => x.UserFields, z => z.Key, "key", new Domain.Common.UserField { Key = "key", Value = "update", StoreId = "1" });var p = _myRepository.GetById("1");//Assertdiff --git a/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.csindex 3604aee08..18a19ab63 100644--- a/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs@@ -9,7 +9,7 @@ namespace Grand.Domain.Tests.Blogs[TestMethod()]public void ParseTagsTest(){- var blogPost = new BlogPost() {+ var blogPost = new BlogPost {Tags = "e-commerce, blog, moey"};@@ -19,10 +19,10 @@ namespace Grand.Domain.Tests.Blogs[TestMethod()]public void GetPostsByDateTest(){- var blogPosts = new List<BlogPost>() {- new BlogPost(){ StartDateUtc = new DateTime(2010,01,01) },- new BlogPost(){ StartDateUtc = new DateTime(2010,02,01) },- new BlogPost(){ StartDateUtc = new DateTime(2010,03,01) }+ var blogPosts = new List<BlogPost> {+ new BlogPost { StartDateUtc = new DateTime(2010,01,01) },+ new BlogPost { StartDateUtc = new DateTime(2010,02,01) },+ new BlogPost { StartDateUtc = new DateTime(2010,03,01) }};Assert.AreEqual(2, blogPosts.GetPostsByDate(new DateTime(2010, 01, 01), new DateTime(2010, 02, 28)).Count());}diff --git a/src/Tests/Grand.Domain.Tests/Catalog/TierPriceExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Catalog/TierPriceExtensionsTests.csindex 32f1ce26b..06ff38a8c 100644--- a/src/Tests/Grand.Domain.Tests/Catalog/TierPriceExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Catalog/TierPriceExtensionsTests.cs@@ -11,21 +11,21 @@ namespace Grand.Domain.Tests.Catalogpublic TierPriceExtensionsTests(){_tierPrices = new List<TierPrice>();- _tierPrices.Add(new TierPrice() {+ _tierPrices.Add(new TierPrice {CurrencyCode = "USD",CustomerGroupId = null,Price = 10,Quantity = 1,StoreId = "1"});- _tierPrices.Add(new TierPrice() {+ _tierPrices.Add(new TierPrice {CurrencyCode = "USD",CustomerGroupId = "1",Price = 12,Quantity = 1,StoreId = "1"});- _tierPrices.Add(new TierPrice() {+ _tierPrices.Add(new TierPrice {CurrencyCode = "USD",CustomerGroupId = "2",Price = 10,@@ -33,7 +33,7 @@ namespace Grand.Domain.Tests.CatalogStoreId = "2",EndDateTimeUtc = DateTime.UtcNow.AddDays(1)});- _tierPrices.Add(new TierPrice() {+ _tierPrices.Add(new TierPrice {CurrencyCode = "EUR",CustomerGroupId = "3",Price = 10,diff --git a/src/Tests/Grand.Domain.Tests/Common/AddressAttributeExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Common/AddressAttributeExtensionsTests.csindex f18da581d..cd608d622 100644--- a/src/Tests/Grand.Domain.Tests/Common/AddressAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Common/AddressAttributeExtensionsTests.cs@@ -17,10 +17,10 @@ namespace Grand.Domain.Tests.Common[TestMethod()]public void ShouldHaveValues__ReturnFalse(){- AddressAttribute addressAttribute = new AddressAttribute() { AttributeControlType = AttributeControlType.TextBox };- AddressAttribute addressAttribute2 = new AddressAttribute() { AttributeControlType = AttributeControlType.MultilineTextbox };- AddressAttribute addressAttribute3 = new AddressAttribute() { AttributeControlType = AttributeControlType.Datepicker };- AddressAttribute addressAttribute4 = new AddressAttribute() { AttributeControlType = AttributeControlType.FileUpload };+ AddressAttribute addressAttribute = new AddressAttribute { AttributeControlType = AttributeControlType.TextBox };+ AddressAttribute addressAttribute2 = new AddressAttribute { AttributeControlType = AttributeControlType.MultilineTextbox };+ AddressAttribute addressAttribute3 = new AddressAttribute { AttributeControlType = AttributeControlType.Datepicker };+ AddressAttribute addressAttribute4 = new AddressAttribute { AttributeControlType = AttributeControlType.FileUpload };Assert.IsFalse(addressAttribute.ShouldHaveValues());Assert.IsFalse(addressAttribute2.ShouldHaveValues());Assert.IsFalse(addressAttribute3.ShouldHaveValues());@@ -31,10 +31,10 @@ namespace Grand.Domain.Tests.Common[TestMethod()]public void ShouldHaveValues__ReturnTrue(){- AddressAttribute addressAttribute = new AddressAttribute() { AttributeControlType = AttributeControlType.DropdownList };- AddressAttribute addressAttribute2 = new AddressAttribute() { AttributeControlType = AttributeControlType.ImageSquares };- AddressAttribute addressAttribute3 = new AddressAttribute() { AttributeControlType = AttributeControlType.RadioList };- AddressAttribute addressAttribute4 = new AddressAttribute() { AttributeControlType = AttributeControlType.ReadonlyCheckboxes };+ AddressAttribute addressAttribute = new AddressAttribute { AttributeControlType = AttributeControlType.DropdownList };+ AddressAttribute addressAttribute2 = new AddressAttribute { AttributeControlType = AttributeControlType.ImageSquares };+ AddressAttribute addressAttribute3 = new AddressAttribute { AttributeControlType = AttributeControlType.RadioList };+ AddressAttribute addressAttribute4 = new AddressAttribute { AttributeControlType = AttributeControlType.ReadonlyCheckboxes };Assert.IsTrue(addressAttribute.ShouldHaveValues());Assert.IsTrue(addressAttribute2.ShouldHaveValues());Assert.IsTrue(addressAttribute3.ShouldHaveValues());diff --git a/src/Tests/Grand.Domain.Tests/Common/AddressExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Common/AddressExtensionsTests.csindex 532d58de2..dc94c6d98 100644--- a/src/Tests/Grand.Domain.Tests/Common/AddressExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Common/AddressExtensionsTests.cs@@ -9,11 +9,11 @@ namespace Grand.Domain.Tests.Common[TestMethod()]public void FindAddressTest_NotNull(){- var addresses = new List<Address>() {- new Address(){ Address1 = "address1", Address2 = "address11", FirstName = "name1", LastName = "namelast1" },- new Address(){ Address1 = "address2", Address2 = "address12", FirstName = "name2", LastName = "namelast2" },- new Address(){ Address1 = "address3", Address2 = "address13", FirstName = "name3", LastName = "namelast3" },- new Address(){ Address1 = "address4", Address2 = "address14", FirstName = "name4", LastName = "namelast4" }+ var addresses = new List<Address> {+ new Address { Address1 = "address1", Address2 = "address11", FirstName = "name1", LastName = "namelast1" },+ new Address { Address1 = "address2", Address2 = "address12", FirstName = "name2", LastName = "namelast2" },+ new Address { Address1 = "address3", Address2 = "address13", FirstName = "name3", LastName = "namelast3" },+ new Address { Address1 = "address4", Address2 = "address14", FirstName = "name4", LastName = "namelast4" }};var address = addresses.FindAddress("name1", "namelast1", string.Empty, string.Empty, string.Empty,string.Empty, "address1", "address11", string.Empty, string.Empty, string.Empty, string.Empty);@@ -22,11 +22,11 @@ namespace Grand.Domain.Tests.Common[TestMethod()]public void FindAddressTest_IsNull(){- var addresses = new List<Address>() {- new Address(){ Address1 = "address1", Address2 = "address11", FirstName = "name1", LastName = "namelast1" },- new Address(){ Address1 = "address2", Address2 = "address12", FirstName = "name2", LastName = "namelast2" },- new Address(){ Address1 = "address3", Address2 = "address13", FirstName = "name3", LastName = "namelast3" },- new Address(){ Address1 = "address4", Address2 = "address14", FirstName = "name4", LastName = "namelast4" }+ var addresses = new List<Address> {+ new Address { Address1 = "address1", Address2 = "address11", FirstName = "name1", LastName = "namelast1" },+ new Address { Address1 = "address2", Address2 = "address12", FirstName = "name2", LastName = "namelast2" },+ new Address { Address1 = "address3", Address2 = "address13", FirstName = "name3", LastName = "namelast3" },+ new Address { Address1 = "address4", Address2 = "address14", FirstName = "name4", LastName = "namelast4" }};var address = addresses.FindAddress("name1", "namelast1", string.Empty, string.Empty, string.Empty,string.Empty, "address1", "address2", "city", string.Empty, string.Empty, string.Empty);diff --git a/src/Tests/Grand.Domain.Tests/Common/UserFieldExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Common/UserFieldExtensionsTests.csindex ac5b64efa..37d796033 100644--- a/src/Tests/Grand.Domain.Tests/Common/UserFieldExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Common/UserFieldExtensionsTests.cs@@ -11,9 +11,9 @@ namespace Grand.Domain.Tests.Commonpublic UserFieldExtensionsTests(){entity = new Domain.Customers.Customer();- entity.UserFields.Add(new UserField() { Key = "FirstName", Value = "Sara", StoreId = "" });- entity.UserFields.Add(new UserField() { Key = "LastName", Value = "Name", StoreId = "" });- entity.UserFields.Add(new UserField() { Key = "Registered", Value = "1", StoreId = "1" });+ entity.UserFields.Add(new UserField { Key = "FirstName", Value = "Sara", StoreId = "" });+ entity.UserFields.Add(new UserField { Key = "LastName", Value = "Name", StoreId = "" });+ entity.UserFields.Add(new UserField { Key = "Registered", Value = "1", StoreId = "1" });}[TestMethod()]diff --git a/src/Tests/Grand.Domain.Tests/Customers/CustomerAttributeExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Customers/CustomerAttributeExtensionsTests.csindex 7694d7458..7c1337b93 100644--- a/src/Tests/Grand.Domain.Tests/Customers/CustomerAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Customers/CustomerAttributeExtensionsTests.cs@@ -17,10 +17,10 @@ namespace Grand.Domain.Tests.Customers[TestMethod()]public void ShouldHaveValues__ReturnFalse(){- var customerAttribute1 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.TextBox };- var customerAttribute2 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var customerAttribute3 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.Datepicker };- var customerAttribute4 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.FileUpload };+ var customerAttribute1 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.TextBox };+ var customerAttribute2 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var customerAttribute3 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.Datepicker };+ var customerAttribute4 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.FileUpload };Assert.IsFalse(customerAttribute1.ShouldHaveValues());Assert.IsFalse(customerAttribute2.ShouldHaveValues());Assert.IsFalse(customerAttribute3.ShouldHaveValues());@@ -31,10 +31,10 @@ namespace Grand.Domain.Tests.Customers[TestMethod()]public void ShouldHaveValues__ReturnTrue(){- var addressAttribute1 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.DropdownList };- var addressAttribute2 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.ImageSquares };- var addressAttribute3 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.RadioList };- var addressAttribute4 = new CustomerAttribute() { AttributeControlTypeId = AttributeControlType.ReadonlyCheckboxes };+ var addressAttribute1 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.DropdownList };+ var addressAttribute2 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.ImageSquares };+ var addressAttribute3 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.RadioList };+ var addressAttribute4 = new CustomerAttribute { AttributeControlTypeId = AttributeControlType.ReadonlyCheckboxes };Assert.IsTrue(addressAttribute1.ShouldHaveValues());Assert.IsTrue(addressAttribute2.ShouldHaveValues());Assert.IsTrue(addressAttribute3.ShouldHaveValues());diff --git a/src/Tests/Grand.Domain.Tests/Data/DataSettingsManagerTests.cs b/src/Tests/Grand.Domain.Tests/Data/DataSettingsManagerTests.csindex 9f02186d8..3a495a4f7 100644--- a/src/Tests/Grand.Domain.Tests/Data/DataSettingsManagerTests.cs+++ b/src/Tests/Grand.Domain.Tests/Data/DataSettingsManagerTests.cs@@ -24,7 +24,7 @@ namespace Grand.Domain.Tests.Data[TestMethod()]public async Task SaveSettings_LoadSettings_Test(){- await DataSettingsManager.SaveSettings(new DataSettings() { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB });+ await DataSettingsManager.SaveSettings(new DataSettings { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB });var settings = DataSettingsManager.LoadSettings();Assert.IsNotNull(settings);Assert.IsTrue(DataSettingsManager.DatabaseIsInstalled());@@ -35,7 +35,7 @@ namespace Grand.Domain.Tests.Data[TestMethod()]public async Task DatabaseIsInstalledTest_True(){- await DataSettingsManager.SaveSettings(new DataSettings() { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB });+ await DataSettingsManager.SaveSettings(new DataSettings { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB });Assert.IsTrue(DataSettingsManager.DatabaseIsInstalled());}diff --git a/src/Tests/Grand.Domain.Tests/Messages/ContactAttributeExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Messages/ContactAttributeExtensionsTests.csindex 0356f910a..7783600ff 100644--- a/src/Tests/Grand.Domain.Tests/Messages/ContactAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Messages/ContactAttributeExtensionsTests.cs@@ -17,10 +17,10 @@ namespace Grand.Domain.Tests.Messages[TestMethod()]public void ShouldHaveValues__ReturnFalse(){- var contactAttribute1 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.TextBox };- var contactAttribute2 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.MultilineTextbox };- var contactAttribute3 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.Datepicker };- var contactAttribute4 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.FileUpload };+ var contactAttribute1 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.TextBox };+ var contactAttribute2 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.MultilineTextbox };+ var contactAttribute3 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.Datepicker };+ var contactAttribute4 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.FileUpload };Assert.IsFalse(contactAttribute1.ShouldHaveValues());Assert.IsFalse(contactAttribute2.ShouldHaveValues());Assert.IsFalse(contactAttribute3.ShouldHaveValues());@@ -31,10 +31,10 @@ namespace Grand.Domain.Tests.Messages[TestMethod()]public void ShouldHaveValues__ReturnTrue(){- var contactAttribute1 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.DropdownList };- var contactAttribute2 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.ImageSquares };- var contactAttribute3 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.RadioList };- var contactAttribute4 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.ReadonlyCheckboxes };+ var contactAttribute1 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.DropdownList };+ var contactAttribute2 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.ImageSquares };+ var contactAttribute3 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.RadioList };+ var contactAttribute4 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.ReadonlyCheckboxes };Assert.IsTrue(contactAttribute1.ShouldHaveValues());Assert.IsTrue(contactAttribute2.ShouldHaveValues());Assert.IsTrue(contactAttribute3.ShouldHaveValues());@@ -44,10 +44,10 @@ namespace Grand.Domain.Tests.Messages[TestMethod()]public void CanBeUsedAsConditionTest__ReturnFalse(){- var contactAttribute1 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.TextBox };- var contactAttribute2 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.MultilineTextbox };- var contactAttribute3 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.Datepicker };- var contactAttribute4 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.FileUpload };+ var contactAttribute1 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.TextBox };+ var contactAttribute2 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.MultilineTextbox };+ var contactAttribute3 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.Datepicker };+ var contactAttribute4 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.FileUpload };Assert.IsFalse(contactAttribute1.CanBeUsedAsCondition());Assert.IsFalse(contactAttribute2.CanBeUsedAsCondition());Assert.IsFalse(contactAttribute3.CanBeUsedAsCondition());@@ -57,10 +57,10 @@ namespace Grand.Domain.Tests.Messages[TestMethod()]public void CanBeUsedAsConditionTest__ReturnTruee(){- var contactAttribute1 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.DropdownList };- var contactAttribute2 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.Checkboxes };- var contactAttribute3 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.RadioList };- var contactAttribute4 = new ContactAttribute() { AttributeControlTypeId = (int)AttributeControlType.ColorSquares };+ var contactAttribute1 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.DropdownList };+ var contactAttribute2 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.Checkboxes };+ var contactAttribute3 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.RadioList };+ var contactAttribute4 = new ContactAttribute { AttributeControlTypeId = (int)AttributeControlType.ColorSquares };Assert.IsTrue(contactAttribute1.CanBeUsedAsCondition());Assert.IsTrue(contactAttribute2.CanBeUsedAsCondition());Assert.IsTrue(contactAttribute3.CanBeUsedAsCondition());diff --git a/src/Tests/Grand.Domain.Tests/Orders/CheckoutAttributeExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Orders/CheckoutAttributeExtensionsTests.csindex 5a5cedd31..bfd128613 100644--- a/src/Tests/Grand.Domain.Tests/Orders/CheckoutAttributeExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Orders/CheckoutAttributeExtensionsTests.cs@@ -17,10 +17,10 @@ namespace Grand.Domain.Tests.Orders[TestMethod()]public void ShouldHaveValues__ReturnFalse(){- var checkoutAttribute1 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.TextBox };- var checkoutAttribute2 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var checkoutAttribute3 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.Datepicker };- var checkoutAttribute4 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.FileUpload };+ var checkoutAttribute1 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.TextBox };+ var checkoutAttribute2 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var checkoutAttribute3 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.Datepicker };+ var checkoutAttribute4 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.FileUpload };Assert.IsFalse(checkoutAttribute1.ShouldHaveValues());Assert.IsFalse(checkoutAttribute2.ShouldHaveValues());Assert.IsFalse(checkoutAttribute3.ShouldHaveValues());@@ -31,10 +31,10 @@ namespace Grand.Domain.Tests.Orders[TestMethod()]public void ShouldHaveValues__ReturnTrue(){- var checkoutAttribute1 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.DropdownList };- var checkoutAttribute2 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.ImageSquares };- var checkoutAttribute3 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.RadioList };- var checkoutAttribute4 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.ReadonlyCheckboxes };+ var checkoutAttribute1 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.DropdownList };+ var checkoutAttribute2 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.ImageSquares };+ var checkoutAttribute3 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.RadioList };+ var checkoutAttribute4 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.ReadonlyCheckboxes };Assert.IsTrue(checkoutAttribute1.ShouldHaveValues());Assert.IsTrue(checkoutAttribute2.ShouldHaveValues());Assert.IsTrue(checkoutAttribute3.ShouldHaveValues());@@ -44,10 +44,10 @@ namespace Grand.Domain.Tests.Orders[TestMethod()]public void CanBeUsedAsConditionTest__ReturnFalse(){- var checkoutAttribute1 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.TextBox };- var checkoutAttribute2 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.MultilineTextbox };- var checkoutAttribute3 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.Datepicker };- var checkoutAttribute4 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.FileUpload };+ var checkoutAttribute1 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.TextBox };+ var checkoutAttribute2 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.MultilineTextbox };+ var checkoutAttribute3 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.Datepicker };+ var checkoutAttribute4 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.FileUpload };Assert.IsFalse(checkoutAttribute1.CanBeUsedAsCondition());Assert.IsFalse(checkoutAttribute2.CanBeUsedAsCondition());Assert.IsFalse(checkoutAttribute3.CanBeUsedAsCondition());@@ -57,10 +57,10 @@ namespace Grand.Domain.Tests.Orders[TestMethod()]public void CanBeUsedAsConditionTest__ReturnTruee(){- var checkoutAttribute1 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.DropdownList };- var checkoutAttribute2 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.Checkboxes };- var checkoutAttribute3 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.RadioList };- var checkoutAttribute4 = new CheckoutAttribute() { AttributeControlTypeId = AttributeControlType.ColorSquares };+ var checkoutAttribute1 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.DropdownList };+ var checkoutAttribute2 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.Checkboxes };+ var checkoutAttribute3 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.RadioList };+ var checkoutAttribute4 = new CheckoutAttribute { AttributeControlTypeId = AttributeControlType.ColorSquares };Assert.IsTrue(checkoutAttribute1.CanBeUsedAsCondition());Assert.IsTrue(checkoutAttribute2.CanBeUsedAsCondition());Assert.IsTrue(checkoutAttribute3.CanBeUsedAsCondition());diff --git a/src/Tests/Grand.Domain.Tests/Orders/GiftVoucherExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Orders/GiftVoucherExtensionsTests.csindex e7b7961cc..b2c5abdd0 100644--- a/src/Tests/Grand.Domain.Tests/Orders/GiftVoucherExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Orders/GiftVoucherExtensionsTests.cs@@ -11,7 +11,7 @@ namespace Grand.Domain.Tests.Orderspublic GiftVoucherExtensionsTests(){- giftVoucher = new GiftVoucher() {+ giftVoucher = new GiftVoucher {Amount = 10,Code = "123456",CurrencyCode = "USD",@@ -40,12 +40,12 @@ namespace Grand.Domain.Tests.Orderspublic void GetGiftVoucherAttributeTest(){IList<CustomAttribute> customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = "RecipientName", Value = "Johny" });- customAttributes.Add(new CustomAttribute() { Key = "RecipientEmail", Value = "[email protected]" });- customAttributes.Add(new CustomAttribute() { Key = "SenderName", Value = "My name" });- customAttributes.Add(new CustomAttribute() { Key = "SenderEmail", Value = "[email protected]" });- customAttributes.Add(new CustomAttribute() { Key = "Message", Value = "my sample message" });- customAttributes.Add(new CustomAttribute() { Key = "Test", Value = "my test" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientName", Value = "Johny" });+ customAttributes.Add(new CustomAttribute { Key = "RecipientEmail", Value = "[email protected]" });+ customAttributes.Add(new CustomAttribute { Key = "SenderName", Value = "My name" });+ customAttributes.Add(new CustomAttribute { Key = "SenderEmail", Value = "[email protected]" });+ customAttributes.Add(new CustomAttribute { Key = "Message", Value = "my sample message" });+ customAttributes.Add(new CustomAttribute { Key = "Test", Value = "my test" });GiftVoucherExtensions.GetGiftVoucherAttribute(customAttributes, out var giftVoucherRecipientName, out var giftVoucherRecipientEmail,out var giftVoucherSenderName, out var giftVoucherSenderEmail, out var giftVoucherMessage);@@ -60,8 +60,8 @@ namespace Grand.Domain.Tests.Orders[TestMethod()]public void GetGiftVoucherRemainingAmountTest(){- giftVoucher.GiftVoucherUsageHistory.Add(new GiftVoucherUsageHistory() { UsedValue = 3 });- giftVoucher.GiftVoucherUsageHistory.Add(new GiftVoucherUsageHistory() { UsedValue = 4 });+ giftVoucher.GiftVoucherUsageHistory.Add(new GiftVoucherUsageHistory { UsedValue = 3 });+ giftVoucher.GiftVoucherUsageHistory.Add(new GiftVoucherUsageHistory { UsedValue = 4 });Assert.IsTrue(giftVoucher.GetGiftVoucherRemainingAmount() == 3);}@@ -69,14 +69,14 @@ namespace Grand.Domain.Tests.Orderspublic void IsGiftVoucherValidTest_ValidTo_True(){giftVoucher.ValidTo = DateTime.UtcNow.AddDays(1);- Assert.IsTrue(giftVoucher.IsGiftVoucherValid(new Directory.Currency() { CurrencyCode = "USD" }, new Domain.Stores.Store()));+ Assert.IsTrue(giftVoucher.IsGiftVoucherValid(new Directory.Currency { CurrencyCode = "USD" }, new Domain.Stores.Store()));}[TestMethod()]public void IsGiftVoucherValidTest_False(){giftVoucher.ValidTo = DateTime.UtcNow.AddDays(-1);- Assert.IsFalse(giftVoucher.IsGiftVoucherValid(new Directory.Currency() { CurrencyCode = "USD" }, new Domain.Stores.Store()));+ Assert.IsFalse(giftVoucher.IsGiftVoucherValid(new Directory.Currency { CurrencyCode = "USD" }, new Domain.Stores.Store()));}}}\ No newline at end of filediff --git a/src/Tests/Grand.Domain.Tests/Orders/OrderExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Orders/OrderExtensionsTests.csindex 8ca09eaf6..7e65daa85 100644--- a/src/Tests/Grand.Domain.Tests/Orders/OrderExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Orders/OrderExtensionsTests.cs@@ -10,12 +10,12 @@ namespace Grand.Domain.Tests.Orders[TestMethod]public void IsDownloadAllowed_ReturnExpectedResult(){- var order1 = new Order() { PaymentStatusId = Domain.Payments.PaymentStatus.Paid, PaidDateUtc = DateTime.UtcNow };+ var order1 = new Order { PaymentStatusId = Domain.Payments.PaymentStatus.Paid, PaidDateUtc = DateTime.UtcNow };Order order2 = null;- var product1 = new Product() { DownloadActivationTypeId = DownloadActivationType.WhenOrderIsPaid, IsDownload = true };- var product2 = new Product() { DownloadActivationTypeId = DownloadActivationType.Manually, IsDownload = true };- var product3 = new Product() { IsDownload = false };- var orderItem = new OrderItem() { IsDownloadActivated = true };+ var product1 = new Product { DownloadActivationTypeId = DownloadActivationType.WhenOrderIsPaid, IsDownload = true };+ var product2 = new Product { DownloadActivationTypeId = DownloadActivationType.Manually, IsDownload = true };+ var product3 = new Product { IsDownload = false };+ var orderItem = new OrderItem { IsDownloadActivated = true };Assert.IsTrue(order1.IsDownloadAllowed(orderItem, product1));Assert.IsTrue(order1.IsDownloadAllowed(orderItem, product2));@@ -29,13 +29,13 @@ namespace Grand.Domain.Tests.Orders[TestMethod]public void IsLicenseDownloadAllowed_ReturnExpectedResults(){- var order1 = new Order() { PaymentStatusId = Domain.Payments.PaymentStatus.Paid, PaidDateUtc = DateTime.UtcNow };+ var order1 = new Order { PaymentStatusId = Domain.Payments.PaymentStatus.Paid, PaidDateUtc = DateTime.UtcNow };Order order2 = null;- var product1 = new Product() { DownloadActivationTypeId = DownloadActivationType.WhenOrderIsPaid, IsDownload = true };- var product2 = new Product() { DownloadActivationTypeId = DownloadActivationType.Manually, IsDownload = true };- var product3 = new Product() { IsDownload = false };- var orderItem = new OrderItem() { IsDownloadActivated = true, LicenseDownloadId = "idlicense" };- var orderItem2 = new OrderItem() { IsDownloadActivated = true, LicenseDownloadId = null };+ var product1 = new Product { DownloadActivationTypeId = DownloadActivationType.WhenOrderIsPaid, IsDownload = true };+ var product2 = new Product { DownloadActivationTypeId = DownloadActivationType.Manually, IsDownload = true };+ var product3 = new Product { IsDownload = false };+ var orderItem = new OrderItem { IsDownloadActivated = true, LicenseDownloadId = "idlicense" };+ var orderItem2 = new OrderItem { IsDownloadActivated = true, LicenseDownloadId = null };Assert.IsTrue(order1.IsLicenseDownloadAllowed(orderItem, product1));Assert.IsTrue(order1.IsLicenseDownloadAllowed(orderItem, product2));Assert.IsFalse(order1.IsLicenseDownloadAllowed(orderItem2, product1));@@ -47,9 +47,9 @@ namespace Grand.Domain.Tests.Orderspublic void HasItemsToAddToShipment_ReturnExpectedResult(){var order = new Order();- order.OrderItems.Add(new OrderItem() { IsShipEnabled = false, OpenQty = 1 });+ order.OrderItems.Add(new OrderItem { IsShipEnabled = false, OpenQty = 1 });Assert.IsFalse(order.HasItemsToAddToShipment());- order.OrderItems.Add(new OrderItem() { IsShipEnabled = true, OpenQty = 1 });+ order.OrderItems.Add(new OrderItem { IsShipEnabled = true, OpenQty = 1 });Assert.IsTrue(order.HasItemsToAddToShipment());}@@ -64,7 +64,7 @@ namespace Grand.Domain.Tests.Orderspublic void OrderTagExists_ReturnExpectedResult(){var order = new Order();- var tag = new OrderTag() { Id = "id" };+ var tag = new OrderTag { Id = "id" };order.OrderTags.Add("1");Assert.IsFalse(order.OrderTagExists(tag));order.OrderTags.Add("id");diff --git a/src/Tests/Grand.Domain.Tests/Orders/ShoppingCartExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Orders/ShoppingCartExtensionsTests.csindex aa301d6e1..c417ea7a7 100644--- a/src/Tests/Grand.Domain.Tests/Orders/ShoppingCartExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Orders/ShoppingCartExtensionsTests.cs@@ -9,27 +9,25 @@ namespace Grand.Domain.Tests.Orders[TestMethod]public void RequiresShipping_ReturnExpectedResults(){- var shoppingCartItems = new List<ShoppingCartItem>()- {- new ShoppingCartItem(){IsShipEnabled=false },- new ShoppingCartItem(){IsShipEnabled=false }+ var shoppingCartItems = new List<ShoppingCartItem> {+ new ShoppingCartItem {IsShipEnabled=false },+ new ShoppingCartItem {IsShipEnabled=false }};Assert.IsFalse(shoppingCartItems.RequiresShipping());- shoppingCartItems.Add(new ShoppingCartItem() { IsShipEnabled = true });+ shoppingCartItems.Add(new ShoppingCartItem { IsShipEnabled = true });Assert.IsTrue(shoppingCartItems.RequiresShipping());}[TestMethod]public void LimitPerStore_ReturnExpectedResults(){- var shoppingCartItems = new List<ShoppingCartItem>()- {- new ShoppingCartItem(){IsShipEnabled=false },- new ShoppingCartItem(){IsShipEnabled=false }+ var shoppingCartItems = new List<ShoppingCartItem> {+ new ShoppingCartItem {IsShipEnabled=false },+ new ShoppingCartItem {IsShipEnabled=false }};Assert.IsTrue(shoppingCartItems.LimitPerStore(false, "id").ToList().Count == 0);- shoppingCartItems.Add(new ShoppingCartItem() { StoreId = "id" });+ shoppingCartItems.Add(new ShoppingCartItem { StoreId = "id" });var result = shoppingCartItems.LimitPerStore(false, "id").ToList();Assert.IsTrue(result.Count == 1);Assert.IsTrue(result.First().StoreId.Equals("id"));diff --git a/src/Tests/Grand.Domain.Tests/Stores/StoreExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Stores/StoreExtensionsTests.csindex e10dc4fee..fb1b4f343 100644--- a/src/Tests/Grand.Domain.Tests/Stores/StoreExtensionsTests.cs+++ b/src/Tests/Grand.Domain.Tests/Stores/StoreExtensionsTests.cs@@ -12,8 +12,8 @@ namespace Grand.Domain.Tests.Storespublic void Setup(){store = new();- store.Domains.Add(new DomainHost() { HostName = "google.com", Url = "https:\\google.com" });- store.Domains.Add(new DomainHost() { HostName = "yahoo.com", Url = "https:\\yahoo.com" });+ store.Domains.Add(new DomainHost { HostName = "google.com", Url = "https:\\google.com" });+ store.Domains.Add(new DomainHost { HostName = "yahoo.com", Url = "https:\\yahoo.com" });}[TestMethod()]diff --git a/src/Tests/Grand.Infrastructure.Tests/Caching/MemoryCacheBaseTests.cs b/src/Tests/Grand.Infrastructure.Tests/Caching/MemoryCacheBaseTests.csindex 9a98b9c6b..886186af7 100644--- a/src/Tests/Grand.Infrastructure.Tests/Caching/MemoryCacheBaseTests.cs+++ b/src/Tests/Grand.Infrastructure.Tests/Caching/MemoryCacheBaseTests.cs@@ -19,7 +19,7 @@ namespace Grand.Infrastructure.Tests.Caching[TestInitialize]public void Init(){- _config = new CacheConfig() { DefaultCacheTimeMinutes = 1 };+ _config = new CacheConfig { DefaultCacheTimeMinutes = 1 };var services = new ServiceCollection();services.AddMemoryCache();services.AddSingleton<CacheConfig>(_config);diff --git a/src/Tests/Grand.Infrastructure.Tests/Extensions/ProviderExtensionsTests.cs b/src/Tests/Grand.Infrastructure.Tests/Extensions/ProviderExtensionsTests.csindex 986f70c35..36fd7802a 100644--- a/src/Tests/Grand.Infrastructure.Tests/Extensions/ProviderExtensionsTests.cs+++ b/src/Tests/Grand.Infrastructure.Tests/Extensions/ProviderExtensionsTests.cs@@ -10,45 +10,45 @@ namespace Grand.Infrastructure.Tests.Extensions[TestMethod()]public void IsAuthenticateStoreTest_True(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store1", "store2" }, new List<string> { "group1" });- Assert.IsTrue(discountProvider.IsAuthenticateStore(new Domain.Stores.Store() { Id = "store1" }));+ var discountProvider = new DiscountProviderTest(["store1", "store2"], new List<string> { "group1" });+ Assert.IsTrue(discountProvider.IsAuthenticateStore(new Domain.Stores.Store { Id = "store1" }));}[TestMethod()]public void IsAuthenticateStoreTest_True_NoStores(){- var discountProvider = new DiscountProviderTest(new List<string>() { }, new List<string> { "group1" });- Assert.IsTrue(discountProvider.IsAuthenticateStore(new Domain.Stores.Store() { Id = "store1" }));+ var discountProvider = new DiscountProviderTest([], new List<string> { "group1" });+ Assert.IsTrue(discountProvider.IsAuthenticateStore(new Domain.Stores.Store { Id = "store1" }));}[TestMethod()]public void IsAuthenticateStoreTest_False(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store2" }, new List<string> { "group1" });- Assert.IsFalse(discountProvider.IsAuthenticateStore(new Domain.Stores.Store() { Id = "store1" }));+ var discountProvider = new DiscountProviderTest(["store2"], new List<string> { "group1" });+ Assert.IsFalse(discountProvider.IsAuthenticateStore(new Domain.Stores.Store { Id = "store1" }));}[TestMethod()]public void IsAuthenticateStoreTestId_True(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store1", "store2" }, new List<string> { "group1" });+ var discountProvider = new DiscountProviderTest(["store1", "store2"], new List<string> { "group1" });Assert.IsTrue(discountProvider.IsAuthenticateStore("store1"));}[TestMethod()]public void IsAuthenticateStoreTestId_True_NoStores(){- var discountProvider = new DiscountProviderTest(new List<string>() { }, new List<string> { "group1" });+ var discountProvider = new DiscountProviderTest([], new List<string> { "group1" });Assert.IsTrue(discountProvider.IsAuthenticateStore("store1"));}[TestMethod()]public void IsAuthenticateStoreTestId_False(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store2" }, new List<string> { "group1" });+ var discountProvider = new DiscountProviderTest(["store2"], new List<string> { "group1" });Assert.IsFalse(discountProvider.IsAuthenticateStore("store1"));}[TestMethod()]public void IsAuthenticateGroupTest_True(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store2" }, new List<string> { "group1" });+ var discountProvider = new DiscountProviderTest(["store2"], new List<string> { "group1" });var customer = new Domain.Customers.Customer();customer.Groups.Add("group1");Assert.IsTrue(discountProvider.IsAuthenticateGroup(customer));@@ -57,7 +57,7 @@ namespace Grand.Infrastructure.Tests.Extensions[TestMethod()]public void IsAuthenticateGroupTest_False(){- var discountProvider = new DiscountProviderTest(new List<string>() { "store2" }, new List<string> { "group1" });+ var discountProvider = new DiscountProviderTest(["store2"], new List<string> { "group1" });var customer = new Domain.Customers.Customer();customer.Groups.Add("group2");Assert.IsFalse(discountProvider.IsAuthenticateGroup(customer));diff --git a/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs b/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.csindex 45a54ce3b..1b78bed0a 100644--- a/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs+++ b/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs@@ -7,7 +7,7 @@ namespace Grand.Infrastructure.Tests.Pluginsprivate PluginInfo _pluginInfo;public SampleBasePlugin(){- _pluginInfo = new PluginInfo() {+ _pluginInfo = new PluginInfo {Author = "grandnode",DisplayOrder = 0,FriendlyName = "sample plugin",diff --git a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.csindex 4dc4f34bd..db1ac9024 100644--- a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs+++ b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs@@ -12,7 +12,7 @@ public class CaptchaInterfaceConverter{//Arrangevar sample = new SampleClass();- sample.CaptchaValidModel = new CaptchaModel() {+ sample.CaptchaValidModel = new CaptchaModel {ReCaptchaResponse = "xxx",ReCaptchaResponseField = "yyy",ReCaptchaChallengeField = "zzz",diff --git a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CustomAttributeListTypeConverterTests.cs b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CustomAttributeListTypeConverterTests.csindex 080d8ea9c..23125f6f1 100644--- a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CustomAttributeListTypeConverterTests.cs+++ b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CustomAttributeListTypeConverterTests.cs@@ -43,9 +43,10 @@ namespace Grand.Infrastructure.Tests.TypeConverters.Converter[TestMethod()]public void ConvertToTest(){- List<CustomAttribute> customAttributes = new List<CustomAttribute>();- customAttributes.Add(new CustomAttribute() { Key = "FirstName", Value = "Lucas" });- customAttributes.Add(new CustomAttribute() { Key = "LastName", Value = "Scott" });+ List<CustomAttribute> customAttributes = [+ new CustomAttribute { Key = "FirstName", Value = "Lucas" },+ new CustomAttribute { Key = "LastName", Value = "Scott" }+ ];var result = _converter.ConvertTo(customAttributes, typeof(string));Assert.IsNotNull(result);}diff --git a/src/Tests/Grand.SharedKernel.Tests/Extensions/CommonHelperTests.cs b/src/Tests/Grand.SharedKernel.Tests/Extensions/CommonHelperTests.csindex f09ef3a0f..887d5d046 100644--- a/src/Tests/Grand.SharedKernel.Tests/Extensions/CommonHelperTests.cs+++ b/src/Tests/Grand.SharedKernel.Tests/Extensions/CommonHelperTests.cs@@ -101,13 +101,13 @@ namespace Grand.SharedKernel.Tests.Extensions[TestMethod()]public void ArraysEqualTest_True(){- Assert.IsTrue(CommonHelper.ArraysEqual(new string[] { "a1", "a2" }, new string[] { "a1", "a2" }));+ Assert.IsTrue(CommonHelper.ArraysEqual(["a1", "a2"], ["a1", "a2"]));}[TestMethod()]public void ArraysEqualTest_False(){- Assert.IsFalse(CommonHelper.ArraysEqual(new string[] { "a1", "a2" }, new string[] { "a2", "a3" }));+ Assert.IsFalse(CommonHelper.ArraysEqual(["a1", "a2"], ["a2", "a3"]));}[TestMethod()]diff --git a/src/Tests/Grand.SharedKernel.Tests/Extensions/ExtendedLinqTests.cs b/src/Tests/Grand.SharedKernel.Tests/Extensions/ExtendedLinqTests.csindex 93d63f8af..b2ce0bedc 100644--- a/src/Tests/Grand.SharedKernel.Tests/Extensions/ExtendedLinqTests.cs+++ b/src/Tests/Grand.SharedKernel.Tests/Extensions/ExtendedLinqTests.cs@@ -9,10 +9,10 @@ namespace Grand.SharedKernel.Tests.Extensions[TestMethod()]public void CartesianProductTest(){- var sampleList = new List<SampleObject>() {- new SampleObject() { Id = "1", Name = "name1" },- new SampleObject() { Id = "1", Name = "name2" },- new SampleObject() { Id = "3", Name = "name3" }+ var sampleList = new List<SampleObject> {+ new SampleObject { Id = "1", Name = "name1" },+ new SampleObject { Id = "1", Name = "name2" },+ new SampleObject { Id = "3", Name = "name3" }};var cartesianProduct = sampleList.GroupBy(x => x.Id).CartesianProduct().ToList();@@ -22,20 +22,20 @@ namespace Grand.SharedKernel.Tests.Extensions[TestMethod()]public void ContainsAnyTest_True(){- var sampleList = new List<int>() { 1, 2, 3, 4 };+ var sampleList = new List<int> { 1, 2, 3, 4 };Assert.IsTrue(sampleList.ContainsAny(new List<int> { 2, 3 }));}[TestMethod()]public void ContainsAnyTest2_True(){- var sampleList = new List<int>() { 1, 2, 3, 4 };+ var sampleList = new List<int> { 1, 2, 3, 4 };Assert.IsTrue(sampleList.ContainsAny(new List<int> { 2, 5 }));}[TestMethod()]public void ContainsAnyTest_False(){- var sampleList = new List<int>() { 1, 2, 3, 4 };+ var sampleList = new List<int> { 1, 2, 3, 4 };Assert.IsFalse(sampleList.ContainsAny(new List<int> { 5, 6 }));}diff --git a/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.csindex e58b93fb5..f2e83a3fb 100644--- a/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs+++ b/src/Tests/Grand.Web.Admin.Tests/MenuViewModelServiceTests.cs@@ -124,7 +124,7 @@ namespace Grand.Web.Admin.Tests;{new AdminSiteMap { Id = "1", SystemName = "Item 1" },new AdminSiteMap { Id = "2", SystemName = "Item 2",- ChildNodes = new List<AdminSiteMap>(){new (){Id = "3", SystemName = "Item 3"} }}+ ChildNodes = new List<AdminSiteMap> {new (){Id = "3", SystemName = "Item 3"} }}};_adminSiteMapServiceMock.Setup(x => x.GetSiteMap()).ReturnsAsync(siteMap);@@ -163,7 +163,7 @@ namespace Grand.Web.Admin.Tests;var idToDelete = "3";var siteMap = new List<AdminSiteMap>{- new AdminSiteMap { Id = "1", SystemName = "Item 1", ChildNodes = new List<AdminSiteMap>() { new AdminSiteMap(){ Id = idToDelete } } },+ new AdminSiteMap { Id = "1", SystemName = "Item 1", ChildNodes = new List<AdminSiteMap> { new AdminSiteMap { Id = idToDelete } } },new AdminSiteMap { Id = "2", SystemName = "Item 2" }};diff --git a/src/Tests/Grand.Web.Common.Tests/AuthorizeMenuAttributeTests.cs b/src/Tests/Grand.Web.Common.Tests/AuthorizeMenuAttributeTests.csindex de48a5a37..3cb394ebf 100644--- a/src/Tests/Grand.Web.Common.Tests/AuthorizeMenuAttributeTests.cs+++ b/src/Tests/Grand.Web.Common.Tests/AuthorizeMenuAttributeTests.cs@@ -31,7 +31,7 @@ public class AuthorizeMenuAttributeTestspublic void Setup(){CommonPath.BaseDirectory = "";- DataSettingsManager.SaveSettings(new DataSettings() { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB }).GetAwaiter().GetResult();+ DataSettingsManager.SaveSettings(new DataSettings { ConnectionString = "connectionstring", DbProvider = DbProvider.MongoDB }).GetAwaiter().GetResult();var settings = DataSettingsManager.LoadSettings();_mockPermissionService = new Mock<IPermissionService>();_mockAdminSiteMapService = new Mock<IAdminSiteMapService>();diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabInfo.cshtmlindex 8fac009a2..7ee71868f 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabInfo.cshtml@@ -62,7 +62,7 @@var attributeControlTypes = ((AttributeControlType)Model.AttributeControlTypeId).ToSelectList(Context, valuesToExclude://custom address attributes don't support some attribute control types- new[] { (int)AttributeControlType.Hidden, (int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares });+ [(int)AttributeControlType.Hidden, (int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares]);}<admin-select asp-for="AttributeControlTypeId" asp-items="attributeControlTypes" /><span asp-validation-for="AttributeControlTypeId"></span>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabInfo.cshtmlindex c71a40c77..e3e8d3ac1 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabInfo.cshtml@@ -147,7 +147,7 @@<div class="col-md-9 col-sm-9">@{var attributeControlTypes = ((AttributeControlType)Model.AttributeControlTypeId).ToSelectList(Context, valuesToExclude:- new[] { (int)AttributeControlType.ImageSquares, (int)AttributeControlType.Hidden });+ [(int)AttributeControlType.ImageSquares, (int)AttributeControlType.Hidden]);}<admin-select asp-for="AttributeControlTypeId" asp-items="attributeControlTypes" /><span asp-validation-for="AttributeControlTypeId"></span>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabInfo.cshtmlindex 5cc042825..12901c154 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabInfo.cshtml@@ -108,7 +108,7 @@<div class="col-md-9 col-sm-9">@{var attributeControlTypes = ((AttributeControlType)Model.AttributeControlTypeId).ToSelectList(Context, valuesToExclude:- new[] { (int)AttributeControlType.ImageSquares, (int)AttributeControlType.Hidden });+ [(int)AttributeControlType.ImageSquares, (int)AttributeControlType.Hidden]);}<admin-select asp-for="AttributeControlTypeId" asp-items="attributeControlTypes" /><span asp-validation-for="AttributeControlTypeId"></span>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabInfo.cshtmlindex 173fbe0f6..9298c8862 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabInfo.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabInfo.cshtml@@ -85,7 +85,7 @@var attributeControlTypes = ((AttributeControlType)Model.AttributeControlTypeId).ToSelectList(Context, valuesToExclude://custom customer attributes don't support some attribute control types- new[] { (int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares, (int)AttributeControlType.ReadonlyCheckboxes });+ [(int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares, (int)AttributeControlType.ReadonlyCheckboxes]);}<admin-select asp-for="AttributeControlTypeId" asp-items="attributeControlTypes" /><span asp-validation-for="AttributeControlTypeId"></span>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtmlindex 12a7e8f5d..2838404fc 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml@@ -21,7 +21,7 @@@Loc["Admin.Configuration.Menu.Edit"] - @Model.SystemName@if (parent != null && parent.Id != Model.Id){- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc[parent.ResourceName], "Edit", new { Id = parent.Id, area = @Constants.AreaAdmin })</small>+ <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc[parent.ResourceName], "Edit", new { parent.Id, area = @Constants.AreaAdmin })</small>}else{diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtmlindex fcd9df772..415ce5c9f 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml@@ -94,7 +94,7 @@@foreach (var item in groupList){<li>- <a class="btnUpdatePermission" href="@Url.Action("Update", new { area = Constants.AreaAdmin, SystemName = @item.SystemName })">@item.Name</a>+ <a class="btnUpdatePermission" href="@Url.Action("Update", new { area = Constants.AreaAdmin, @item.SystemName })">@item.Name</a></li>}</ul>diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtmlindex d28c8e466..237a6032d 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml@@ -71,8 +71,7 @@<div class="form-group"><admin-label asp-for="AttributeControlType" /><div class="col-md-9 col-sm-9">- <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude:- new[] { (int)AttributeControlType.Hidden })" />+ <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude: [(int)AttributeControlType.Hidden])" /><span asp-validation-for="AttributeControlTypeId"></span></div></div>diff --git a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs b/src/Web/Grand.Web.Admin/Controllers/BlogController.csindex 2685eae04..c7a0a728c 100644--- a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs@@ -106,7 +106,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var blogPost = await _blogViewModelService.InsertBlogPostModel(model);Success(_translationService.GetResource("Admin.Content.Blog.BlogPosts.Added"));@@ -172,7 +172,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}blogPost = await _blogViewModelService.UpdateBlogPostModel(model, blogPost);@@ -311,7 +311,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var blogCategory = model.ToEntity();@@ -377,7 +377,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}blogCategory = model.ToEntity(blogCategory);diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.csindex ca0a4cc16..bdece2ad5 100644--- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs@@ -146,7 +146,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var collection = await _brandViewModelService.InsertBrandModel(model);@@ -224,7 +224,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}brand = await _brandViewModelService.UpdateBrandModel(brand, model);Success(_translationService.GetResource("Admin.Catalog.Brands.Updated"));diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.csindex f2da390ae..48794fceb 100644--- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs@@ -123,7 +123,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var category = await _categoryViewModelService.InsertCategoryModel(model);@@ -193,7 +193,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}category = await _categoryViewModelService.UpdateCategoryModel(category, model);diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.csindex 2c173cd24..e835b805e 100644--- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs@@ -146,7 +146,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var collection = await _collectionViewModelService.InsertCollectionModel(model);@@ -224,7 +224,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}collection = await _collectionViewModelService.UpdateCollectionModel(collection, model);Success(_translationService.GetResource("Admin.Catalog.Collections.Updated"));diff --git a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs b/src/Web/Grand.Web.Admin/Controllers/CourseController.csindex d96c4dafe..8bc5b7061 100644--- a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs@@ -157,7 +157,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var course = await _courseViewModelService.InsertCourseModel(model);@@ -227,7 +227,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}course = await _courseViewModelService.UpdateCourseModel(course, model);diff --git a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs b/src/Web/Grand.Web.Admin/Controllers/DiscountController.csindex 768afab04..c41f78e1d 100644--- a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs@@ -99,7 +99,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var discount = await _discountViewModelService.InsertDiscountModel(model);@@ -157,7 +157,7 @@ namespace Grand.Web.Admin.Controllers{if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}discount = await _discountViewModelService.UpdateDiscountModel(discount, model);Success(_translationService.GetResource("admin.marketing.discounts.Updated"));diff --git a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs b/src/Web/Grand.Web.Admin/Controllers/HomeController.csindex 3cd257172..5596eed34 100644--- a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs@@ -82,7 +82,8 @@ namespace Grand.Web.Admin.Controllersmodel.TodayRegisteredCustomers =(await _mediator.Send(new GetCustomerQuery {StoreId = storeId,- CustomerGroupIds = new[] { (await _groupService.GetCustomerGroupBySystemName(SystemCustomerGroupNames.Registered)).Id },+ CustomerGroupIds = [(await _groupService.GetCustomerGroupBySystemName(SystemCustomerGroupNames.Registered)).Id+ ],CreatedFromUtc = DateTime.UtcNow.Date})).Count();return model;@@ -160,7 +161,7 @@ namespace Grand.Web.Admin.Controllersreturn Json(new List<dynamic> { new { id = "", name = _translationService.GetResource("Address.SelectState") } });var country = await countryService.GetCountryById(countryId);- var states = country != null ? country.StateProvinces.ToList() : new List<StateProvince>();+ var states = country != null ? country.StateProvinces.ToList() : [];var result = (from s in statesselect new { id = s.Id, name = s.Name }).ToList();if (addAsterisk.HasValue && addAsterisk.Value)diff --git a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs b/src/Web/Grand.Web.Admin/Controllers/PermissionController.csindex 1f0b96842..9d54bc831 100644--- a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs@@ -78,7 +78,7 @@ namespace Grand.Web.Admin.Controllerspublic IActionResult Create(){- return View(new PermissionCreateModel() { Area = "Area admin" });+ return View(new PermissionCreateModel { Area = "Area admin" });}[HttpPost]diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.csindex c20eaabe9..683a1cea1 100644--- a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs@@ -94,7 +94,7 @@ namespace Grand.Web.Admin.ControllersproductAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(productAttribute.SeName) ? productAttribute.Name : productAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}await _productAttributeService.InsertProductAttribute(productAttribute);@@ -141,7 +141,7 @@ namespace Grand.Web.Admin.ControllersproductAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(productAttribute.SeName) ? productAttribute.Name : productAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}await _productAttributeService.UpdateProductAttribute(productAttribute);diff --git a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.csindex 822285637..9dc05c930 100644--- a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs@@ -93,7 +93,7 @@ namespace Grand.Web.Admin.ControllersspecificationAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(specificationAttribute.SeName) ? specificationAttribute.Name : specificationAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}await _specificationAttributeService.InsertSpecificationAttribute(specificationAttribute);@@ -139,7 +139,7 @@ namespace Grand.Web.Admin.ControllersspecificationAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(specificationAttribute.SeName) ? specificationAttribute.Name : specificationAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);if (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}await _specificationAttributeService.UpdateSpecificationAttribute(specificationAttribute);diff --git a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.csindex fecf961fb..d959dfe29 100644--- a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs@@ -72,7 +72,7 @@ namespace Grand.Web.Admin.Services{var allowedFileTypes = new List<string>();if (string.IsNullOrEmpty(_mediaSettings.AllowedFileTypes))- allowedFileTypes = new List<string> { ".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp" };+ allowedFileTypes = [".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp"];elseallowedFileTypes = _mediaSettings.AllowedFileTypes.Split(',').Select(x => x.Trim().ToLowerInvariant()).ToList();diff --git a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.csindex a3c68e622..396966f1b 100644--- a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs+++ b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs@@ -859,7 +859,7 @@ namespace Grand.Web.Admin.Services//a staff should have access only to his productsif (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}//product@@ -895,7 +895,7 @@ namespace Grand.Web.Admin.Services//a staff should have access only to his productsif (await _groupService.IsStaff(_workContext.CurrentCustomer)){- model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };+ model.Stores = [_workContext.CurrentCustomer.StaffStoreId];}var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);diff --git a/src/Web/Grand.Web.Common/Binders/CustomAttributesBinder.cs b/src/Web/Grand.Web.Common/Binders/CustomAttributesBinder.csindex 4d9008163..1ee0e6cff 100644--- a/src/Web/Grand.Web.Common/Binders/CustomAttributesBinder.cs+++ b/src/Web/Grand.Web.Common/Binders/CustomAttributesBinder.cs@@ -20,7 +20,7 @@ public class CustomAttributesBinder : IModelBinderforeach (var form in formCollection){if (form.Key.StartsWith("attributes"))- model.Add(new CustomAttributeModel() { Key = GetKey(form.Key), Value = form.Value });+ model.Add(new CustomAttributeModel { Key = GetKey(form.Key), Value = form.Value });}bindingContext.Result = ModelBindingResult.Success(model);diff --git a/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs b/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.csindex b66c15ada..eb4fcfa50 100644--- a/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/AuthorizeAdminAttribute.cs@@ -24,7 +24,7 @@ namespace Grand.Web.Common.Filterspublic AuthorizeAdminAttribute(bool ignore = false) : base(typeof(AuthorizeAdminFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Web/Grand.Web.Common/Filters/AuthorizeMenuAttribute.cs b/src/Web/Grand.Web.Common/Filters/AuthorizeMenuAttribute.csindex 9f94b8cd8..7b93e752a 100644--- a/src/Web/Grand.Web.Common/Filters/AuthorizeMenuAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/AuthorizeMenuAttribute.cs@@ -24,7 +24,7 @@ namespace Grand.Web.Common.Filterspublic AuthorizeMenuAttribute(bool ignore = false) : base(typeof(AuthorizeMenuFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;@@ -104,14 +104,14 @@ namespace Grand.Web.Common.Filters{if (menuSiteMap.AllPermissions){- if (!(await menuSiteMap.PermissionNames.AllAsync(async x =>- await _permissionService.Authorize(x, _workContext.CurrentCustomer))))+ if (!await menuSiteMap.PermissionNames.AllAsync(async x =>+ await _permissionService.Authorize(x, _workContext.CurrentCustomer)))filterContext.Result = new ForbidResult();}else{- if (!(await menuSiteMap.PermissionNames.AnyAsync(async x =>- await _permissionService.Authorize(x, _workContext.CurrentCustomer))))+ if (!await menuSiteMap.PermissionNames.AnyAsync(async x =>+ await _permissionService.Authorize(x, _workContext.CurrentCustomer)))filterContext.Result = new ForbidResult();}}diff --git a/src/Web/Grand.Web.Common/Filters/AuthorizeVendorAttribute.cs b/src/Web/Grand.Web.Common/Filters/AuthorizeVendorAttribute.csindex e291be90f..7a4a4d6e2 100644--- a/src/Web/Grand.Web.Common/Filters/AuthorizeVendorAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/AuthorizeVendorAttribute.cs@@ -23,7 +23,7 @@ namespace Grand.Web.Common.Filterspublic AuthorizeVendorAttribute(bool ignore = false) : base(typeof(AuthorizeVendorFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Web/Grand.Web.Common/Filters/ClosedStoreAttribute.cs b/src/Web/Grand.Web.Common/Filters/ClosedStoreAttribute.csindex d99c5f019..b15916ce1 100644--- a/src/Web/Grand.Web.Common/Filters/ClosedStoreAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/ClosedStoreAttribute.cs@@ -24,7 +24,7 @@ namespace Grand.Web.Common.Filterspublic ClosedStoreAttribute(bool ignore = false) : base(typeof(CheckAccessClosedStoreFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.cs b/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.csindex 26433845c..04e19b529 100644--- a/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/DenySystemAccountAttribute.cs@@ -21,7 +21,7 @@ namespace Grand.Web.Common.Filterspublic DenySystemAccountAttribute(bool ignore = false) : base(typeof(DenySystemAccountFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Web/Grand.Web.Common/Filters/PublicStoreAttribute.cs b/src/Web/Grand.Web.Common/Filters/PublicStoreAttribute.csindex 35eff47ea..24e88869b 100644--- a/src/Web/Grand.Web.Common/Filters/PublicStoreAttribute.cs+++ b/src/Web/Grand.Web.Common/Filters/PublicStoreAttribute.cs@@ -22,7 +22,7 @@ namespace Grand.Web.Common.Filterspublic PublicStoreAttribute(bool ignore = false) : base(typeof(AccessPublicStoreFilter)){_ignoreFilter = ignore;- Arguments = new object[] { ignore };+ Arguments = [ignore];}public bool IgnoreFilter => _ignoreFilter;diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultDisplayTemplates.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultDisplayTemplates.csindex 2ad019ad2..adcfc3a5e 100644--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultDisplayTemplates.cs+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultDisplayTemplates.cs@@ -62,12 +62,11 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend// Will soon need to be shared with the default editor templates implementations.internal static List<SelectListItem> TriStateValues(bool? value){- return new List<SelectListItem>- {+ return [new SelectListItem("Not Set", string.Empty, !value.HasValue),new SelectListItem("True", "true", value == true),new SelectListItem("False", "false", value == false)- };+ ];}public static async Task<IHtmlContent> CollectionTemplate(IHtmlHelper htmlHelper)diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.csindex fecc00fe9..bf481438a 100644--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs@@ -26,11 +26,11 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend// See: (http://www.w3.org/TR/html5/forms.html#the-input-element)private static readonly string[] _placeholderInputTypes =- new[] { "text", "search", "url", "tel", "email", "password", "number" };+ ["text", "search", "url", "tel", "email", "password", "number"];// See: (http://www.w3.org/TR/html5/sec-forms.html#apply)private static readonly string[] _maxLengthInputTypes =- new[] { "text", "search", "url", "tel", "email", "password" };+ ["text", "search", "url", "tel", "email", "password"];private readonly IAntiforgery _antiforgery;private readonly IModelMetadataProvider _metadataProvider;@@ -1064,7 +1064,7 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend{// E.g. got a string from ModelState.var methodInfo = ConvertEnumFromStringMethod.MakeGenericMethod(innerType);- enumValue = (Enum)methodInfo.Invoke(obj: null, parameters: new[] { stringValue });+ enumValue = (Enum)methodInfo.Invoke(obj: null, parameters: [stringValue]);}}@@ -1593,7 +1593,7 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extendif (optionLabel != null){listItemBuilder.AppendLine(GenerateOption(- new SelectListItem() {+ new SelectListItem {Text = optionLabel,Value = string.Empty,Selected = falsediff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.csindex 37c932ffe..04c05b31c 100644--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs@@ -157,9 +157,10 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend}else if (_currentPage != null){- _multiplePages = new List<ViewBufferPage>(2);- _multiplePages.Add(_currentPage);- _multiplePages.Add(page);+ _multiplePages = [+ _currentPage,+ page+ ];}_currentPage = page;diff --git a/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.csindex 4a05c6b27..cd7bd980f 100644--- a/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs+++ b/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs@@ -60,8 +60,7 @@ namespace Grand.Web.Common.TagHelpersoutput.TagName = "div";output.TagMode = TagMode.StartTagAndEndTag;- var model = new DatePickerDropDownsModel()- {+ var model = new DatePickerDropDownsModel {Attribute = Attribute,Begin_Year = Begin_Year,Day = ControlId_Day,@@ -73,19 +72,19 @@ namespace Grand.Web.Common.TagHelpersSelectedYear = SelectedYear};- model.SelectListDay.Add(new SelectListItem() { Value = "0", Text = _translationService.GetResource("Common.Day") });+ model.SelectListDay.Add(new SelectListItem { Value = "0", Text = _translationService.GetResource("Common.Day") });for (var i = 1; i <= 31; i++){- model.SelectListDay.Add(new SelectListItem() { Value = i.ToString(), Text = i.ToString(), Selected = SelectedDay == i });+ model.SelectListDay.Add(new SelectListItem { Value = i.ToString(), Text = i.ToString(), Selected = SelectedDay == i });}- model.SelectListMonth.Add(new SelectListItem() { Value = "0", Text = _translationService.GetResource("Common.Month") });+ model.SelectListMonth.Add(new SelectListItem { Value = "0", Text = _translationService.GetResource("Common.Month") });for (var i = 1; i <= 12; i++){- model.SelectListMonth.Add(new SelectListItem() { Value = i.ToString(), Text = CultureInfo.CurrentUICulture.DateTimeFormat.GetMonthName(i), Selected = SelectedMonth == i });+ model.SelectListMonth.Add(new SelectListItem { Value = i.ToString(), Text = CultureInfo.CurrentUICulture.DateTimeFormat.GetMonthName(i), Selected = SelectedMonth == i });}- model.SelectListYear.Add(new SelectListItem() { Value = "0", Text = _translationService.GetResource("Common.Year") });+ model.SelectListYear.Add(new SelectListItem { Value = "0", Text = _translationService.GetResource("Common.Year") });if (Begin_Year == 0)Begin_Year = DateTime.UtcNow.Year - 100;@@ -95,12 +94,12 @@ namespace Grand.Web.Common.TagHelpersif (End_Year > Begin_Year){for (var i = Begin_Year; i <= End_Year; i++)- model.SelectListYear.Add(new SelectListItem() { Value = i.ToString(), Text = i.ToString(), Selected = SelectedYear == i });+ model.SelectListYear.Add(new SelectListItem { Value = i.ToString(), Text = i.ToString(), Selected = SelectedYear == i });}else{for (var i = Begin_Year; i >= End_Year; i--)- model.SelectListYear.Add(new SelectListItem() { Value = i.ToString(), Text = i.ToString(), Selected = SelectedYear == i });+ model.SelectListYear.Add(new SelectListItem { Value = i.ToString(), Text = i.ToString(), Selected = SelectedYear == i });}output.Content.SetHtmlContent((await _htmlHelper.PartialAsync(PartialViewName, model)).ToHtmlString());diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtmlindex e3db19c1c..48b11c6b3 100644--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/ProductAttributeMappingPopup.cshtml@@ -71,8 +71,7 @@<div class="form-group"><admin-label asp-for="AttributeControlType" /><div class="col-md-9 col-sm-9">- <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude:- new[] { (int)AttributeControlType.Hidden })" />+ <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude: [(int)AttributeControlType.Hidden])" /><span asp-validation-for="AttributeControlTypeId"></span></div></div>diff --git a/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs b/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.csindex 0648ee9fc..60eedf57a 100644--- a/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs+++ b/src/Web/Grand.Web.Vendor/Extensions/FileExtensions.cs@@ -4,7 +4,8 @@ public static class FileExtensions{public static IList<string> GetAllowedMediaFileTypes(string allowedFileTypes){- return string.IsNullOrEmpty(allowedFileTypes) ? new List<string> { ".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp" } :+ return string.IsNullOrEmpty(allowedFileTypes) ? [".gif", ".jpg", ".jpeg", ".png", ".bmp", ".webp"]+ :allowedFileTypes.Split(',').Select(x => x.Trim().ToLowerInvariant()).ToList();}}\ No newline at end of filediff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.csindex f0c4309ad..be6c6bb2c 100644--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs@@ -110,7 +110,7 @@ namespace Grand.Web.Controllers[NonAction]protected IShippingRateCalculationProvider GetShippingComputation(string input){- var shippingMethodName = input.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1];+ var shippingMethodName = input.Split([":"], StringSplitOptions.RemoveEmptyEntries)[1];var shippingMethod = _shippingService.LoadShippingRateCalculationProviderBySystemName(shippingMethodName);if (shippingMethod == null)throw new Exception("Shipping method is not selected");@@ -683,7 +683,7 @@ namespace Grand.Web.Controllersif (string.IsNullOrEmpty(model.ShippingOption))throw new Exception("Selected shipping method can't be parsed");- var splitOption = model.ShippingOption.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);+ var splitOption = model.ShippingOption.Split([":"], StringSplitOptions.RemoveEmptyEntries);if (splitOption.Length != 2)throw new Exception("Selected shipping method can't be parsed");diff --git a/src/Web/Grand.Web/Models/Blogs/BlogPagingFilteringModel.cs b/src/Web/Grand.Web/Models/Blogs/BlogPagingFilteringModel.csindex 7edaf4001..ba2046ef1 100644--- a/src/Web/Grand.Web/Models/Blogs/BlogPagingFilteringModel.cs+++ b/src/Web/Grand.Web/Models/Blogs/BlogPagingFilteringModel.cs@@ -10,7 +10,7 @@ namespace Grand.Web.Models.Blogs{DateTime? result = null;if (string.IsNullOrEmpty(Month)) return null;- var tempDate = Month.Split(new [] { '-' });+ var tempDate = Month.Split(['-']);if (tempDate.Length != 2) return null;int.TryParse(tempDate[0], out var year);int.TryParse(tempDate[1], out var month);