Skip to content

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.

System tests - remove unused using

KrzysztofPajak0e6523d8f2a2
diff --git a/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs b/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs
index 506ba1e03..b583b4331 100644
--- a/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Commands/SendOutBidCustomerNotificationCommandHandlerTests.cs
@@ -4,10 +4,6 @@ using Grand.Business.System.Commands.Handlers.Catalog;
using Grand.Domain.Catalog;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Commands
@@ -18,7 +14,7 @@ namespace Grand.Business.System.Tests.Commands
private Mock<IMessageProviderService> _messageProviderMock;
private SendOutBidCustomerNotificationCommandHandler _handler;
- [TestInitialize]
+ [TestInitialize]
public void Init()
{
_messageProviderMock = new Mock<IMessageProviderService>();
@@ -28,8 +24,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.cs
index 83d2e6a75..59140c02d 100644
--- a/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Commands/SendQuantityBelowStoreOwnerNotificationCommandHandlerTests.cs
@@ -5,10 +5,6 @@ using Grand.Domain.Catalog;
using Grand.Domain.Localization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Commands
@@ -32,8 +28,7 @@ namespace Grand.Business.System.Tests.Commands
public async Task Handle_InvokeExpectedMethods()
{
_settings.DefaultAdminLanguageId = "1";
- var command = new SendQuantityBelowStoreOwnerCommand()
- {
+ var command = new SendQuantityBelowStoreOwnerCommand() {
Product = new Domain.Catalog.Product(),
ProductAttributeCombination = null
};
@@ -42,7 +37,7 @@ namespace Grand.Business.System.Tests.Commands
_messageProviderMock.Verify(c => c.SendQuantityBelowStoreOwnerMessage(It.IsAny<Product>(), It.IsAny<string>()), Times.Once);
command.ProductAttributeCombination = new ProductAttributeCombination();
await _handler.Handle(command, default);
- _messageProviderMock.Verify(c => c.SendQuantityBelowStoreOwnerMessage(It.IsAny<Product>(),It.IsAny<ProductAttributeCombination>(), It.IsAny<string>()), Times.Once);
+ _messageProviderMock.Verify(c => c.SendQuantityBelowStoreOwnerMessage(It.IsAny<Product>(), It.IsAny<ProductAttributeCombination>(), It.IsAny<string>()), Times.Once);
}
}
}
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CancelOrderScheduledTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CancelOrderScheduledTaskTests.cs
index d6df9f9fd..91c3eab5d 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CancelOrderScheduledTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CancelOrderScheduledTaskTests.cs
@@ -4,9 +4,6 @@ using Grand.Domain.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
@@ -23,7 +20,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
{
_orderServiceMock = new Mock<IOrderService>();
_settings = new SystemSettings();
- _task = new CancelOrderScheduledTask(_settings,_orderServiceMock.Object);
+ _task = new CancelOrderScheduledTask(_settings, _orderServiceMock.Object);
}
[TestMethod]
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearCacheScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearCacheScheduleTaskTests.cs
index 518b6c54f..2fa14c55f 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearCacheScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearCacheScheduleTaskTests.cs
@@ -2,10 +2,6 @@
using Grand.Infrastructure.Caching;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearLogScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearLogScheduleTaskTests.cs
index 8d807e9a8..f2dc59bd7 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearLogScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/ClearLogScheduleTaskTests.cs
@@ -2,10 +2,6 @@
using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs
index 0dbff612c..4ec1911e2 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderAbandonedCartScheduleTaskTests.cs
@@ -2,10 +2,6 @@
using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs
index 82d816637..b8ae5f385 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/CustomerReminderTasksTests.cs
@@ -2,10 +2,6 @@
using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/DeleteGuestsScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/DeleteGuestsScheduleTaskTests.cs
index 5974f8e35..6cb6255b1 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/DeleteGuestsScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/DeleteGuestsScheduleTaskTests.cs
@@ -4,9 +4,6 @@ using Grand.Domain.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
@@ -23,7 +20,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
{
_customerServiceMock = new Mock<ICustomerService>();
_settings = new SystemSettings();
- _task = new DeleteGuestsScheduleTask(_customerServiceMock.Object,_settings);
+ _task = new DeleteGuestsScheduleTask(_customerServiceMock.Object, _settings);
}
[TestMethod]
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs
index cc08895f0..badcc69bb 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/EndAuctionsTaskTests.cs
@@ -14,8 +14,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
@@ -40,15 +38,15 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
_customerServiceMock = new Mock<ICustomerService>();
_loggerMock = new Mock<ILogger>();
_settings = new LanguageSettings();
- _task = new EndAuctionsTask(_auctionMock.Object,_messageProviderMock.Object,_settings,_shoppingCartMock.Object,_customerServiceMock.Object,
+ _task = new EndAuctionsTask(_auctionMock.Object, _messageProviderMock.Object, _settings, _shoppingCartMock.Object, _customerServiceMock.Object,
_loggerMock.Object);
}
[TestMethod]
public async Task Execute_NotBids_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>());
+ _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);
_messageProviderMock.Verify(c => c.SendAuctionEndedStoreOwnerMessage(It.IsAny<Product>(), It.IsAny<string>(), It.IsAny<Bid>()), Times.Once);
@@ -59,7 +57,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
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.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<bool>()))
@@ -77,7 +75,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
_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<bool>()))
- .ReturnsAsync(new List<string>() );
+ .ReturnsAsync(new List<string>());
await _task.Execute();
_loggerMock.Verify(c => c.InsertLog(Domain.Logging.LogLevel.Error, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Customer>()), Times.Never);
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs
index 9fc51d415..3e5cd8686 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/QueuedMessagesSendScheduleTaskTests.cs
@@ -9,8 +9,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
@@ -31,7 +29,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
_emailSenderMock = new Mock<IEmailSender>();
_emailAccountServiceMock = new Mock<IEmailAccountService>();
_loggerMock = new Mock<ILogger>();
- _task = new QueuedMessagesSendScheduleTask(_queuedEmailServiceMock.Object,_emailSenderMock.Object,_loggerMock.Object,_emailAccountServiceMock.Object);
+ _task = new QueuedMessagesSendScheduleTask(_queuedEmailServiceMock.Object, _emailSenderMock.Object, _loggerMock.Object, _emailAccountServiceMock.Object);
}
[TestMethod]
@@ -39,10 +37,10 @@ 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<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();
+ await _task.Execute();
_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>()
, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<string>>(),
diff --git a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs
index 811739571..f6d0fcb22 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/BackgroundService/UpdateExchangeRateScheduleTaskTests.cs
@@ -3,10 +3,7 @@ using Grand.Business.System.Services.BackgroundServices.ScheduleTasks;
using Grand.Domain.Directory;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.BackgroundService
@@ -25,7 +22,7 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
_currencyServiceMock = new Mock<ICurrencyService>();
_exchangeRateServiceMock = new Mock<IExchangeRateService>();
_settings = new CurrencySettings();
- _task = new UpdateExchangeRateScheduleTask(_currencyServiceMock.Object,_exchangeRateServiceMock.Object,_settings);
+ _task = new UpdateExchangeRateScheduleTask(_currencyServiceMock.Object, _exchangeRateServiceMock.Object, _settings);
}
[TestMethod]
@@ -34,8 +31,8 @@ namespace Grand.Business.System.Tests.Services.BackgroundService
_settings.AutoUpdateEnabled = true;
_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.Business.System.Tests/Services/ExportImport/ExportManagerTests.cs b/src/Tests/Grand.Business.System.Tests/Services/ExportImport/ExportManagerTests.cs
index 07a02a188..f6dfa0bc5 100644
--- a/src/Tests/Grand.Business.System.Tests/Services/ExportImport/ExportManagerTests.cs
+++ b/src/Tests/Grand.Business.System.Tests/Services/ExportImport/ExportManagerTests.cs
@@ -1,22 +1,12 @@
-using Grand.Business.Catalog.Interfaces.Categories;
-using Grand.Business.Catalog.Interfaces.Discounts;
-using Grand.Business.Catalog.Interfaces.Products;
-using Grand.Business.Common.Interfaces.Stores;
-using Grand.Business.Marketing.Interfaces.Newsletters;
-using Grand.Business.Storage.Interfaces;
-using Grand.Business.System.Interfaces.ExportImport;
+using Grand.Business.Storage.Interfaces;
using Grand.Business.System.Services.ExportImport;
using Grand.Domain.Catalog;
-using Grand.Domain.Messages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Grand.Business.System.Tests.Services.ExportImport
{