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.

Customer tests - remove unused using

KrzysztofPajak16bdfea4a559
diff --git a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
index 851305d89..c153bae4b 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
@@ -5,9 +5,6 @@ using Grand.Infrastructure;
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.Customers.Tests.Extensions
@@ -16,7 +13,7 @@ namespace Grand.Business.Customers.Tests.Extensions
public class AffiliateExtensionsTests
{
private const string _fakeStoreUrl = "http://localhost/";
- private string _expectedFormat = _fakeStoreUrl+"?{0}={1}";
+ private string _expectedFormat = _fakeStoreUrl + "?{0}={1}";
private Mock<IWorkContext> _workContextMock;
private Mock<IAffiliateService> _affiliateServiceMock;
@@ -40,8 +37,7 @@ namespace Grand.Business.Customers.Tests.Extensions
public void GetFullName_NullLastName_ReturnFirstName()
{
var firstName = "Test name";
- Affiliate affiliate = new Affiliate
- {
+ Affiliate affiliate = new Affiliate {
Address = new Domain.Common.Address() { FirstName = firstName }
};
Assert.AreEqual(firstName, affiliate.GetFullName());
@@ -51,8 +47,7 @@ namespace Grand.Business.Customers.Tests.Extensions
public void GetFullName_NullFirstName_ReturnLastName()
{
var lastName = "Test name";
- Affiliate affiliate = new Affiliate
- {
+ Affiliate affiliate = new Affiliate {
Address = new Domain.Common.Address() { LastName = lastName }
};
Assert.AreEqual(lastName, affiliate.GetFullName());
@@ -62,8 +57,7 @@ namespace Grand.Business.Customers.Tests.Extensions
public void GetFullName_ValidParameter_ReturnLastName()
{
var fullName = string.Format("{0} {1}", "first name", "lastName");
- Affiliate affiliate = new Affiliate
- {
+ Affiliate affiliate = new Affiliate {
Address = new Domain.Common.Address() { LastName = "lastName", FirstName = "first name" }
};
Assert.AreEqual(fullName, affiliate.GetFullName());
@@ -87,11 +81,10 @@ namespace Grand.Business.Customers.Tests.Extensions
public 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(_workContextMock.Object));
//_webHelperMock.Verify(c => c.ModifyQueryString(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
}
@@ -100,8 +93,7 @@ namespace Grand.Business.Customers.Tests.Extensions
public 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 });
@@ -115,8 +107,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, "");
@@ -136,8 +127,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.cs
index f99e661c5..47c5050a2 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs
@@ -7,10 +7,7 @@ using Grand.Domain.Customers;
using MediatR;
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.Customers.Tests.Handler
@@ -31,7 +28,7 @@ namespace Grand.Business.Customers.Tests.Handler
_cumstomerServiceMock = new Mock<ICustomerService>();
_groupServiceMock = new Mock<IGroupService>();
_mediatorMock = new Mock<IMediator>();
- _handler = new ActiveVendorCommandHandler(_vendorMock.Object,_cumstomerServiceMock.Object,_groupServiceMock.Object,_mediatorMock.Object);
+ _handler = new ActiveVendorCommandHandler(_vendorMock.Object, _cumstomerServiceMock.Object, _groupServiceMock.Object, _mediatorMock.Object);
}
[TestMethod()]
@@ -40,7 +37,7 @@ namespace Grand.Business.Customers.Tests.Handler
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);
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/AffiliateServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/AffiliateServiceTests.cs
index 5b2905ec1..6de8fe3ad 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/AffiliateServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/AffiliateServiceTests.cs
@@ -8,9 +8,6 @@ using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -70,6 +67,6 @@ namespace Grand.Business.Customers.Tests.Services
_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<Affiliate>>(), default(CancellationToken)), Times.Once);
}
-
+
}
}
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs
index 9e112dcfe..a905407b8 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs
@@ -5,10 +5,8 @@ using Grand.Domain.Common;
using Grand.Domain.Customers;
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.Customers.Tests.Services
@@ -64,7 +62,7 @@ namespace Grand.Business.Customers.Tests.Services
public async Task ParseCustomerAttributes_ReturnEmptyList()
{
//not exist
- _customerAtrServiceMock.Setup(c => c.GetCustomerAttributeById(It.IsAny<string>())).Returns(()=>Task.FromResult<CustomerAttribute>(null));
+ _customerAtrServiceMock.Setup(c => c.GetCustomerAttributeById(It.IsAny<string>())).Returns(() => Task.FromResult<CustomerAttribute>(null));
var result = await _parser.ParseCustomerAttributes(customAtr);
Assert.IsTrue(result.Count == 0);
}
@@ -87,10 +85,10 @@ namespace Grand.Business.Customers.Tests.Services
public void AddCustomerAttribute_ReturnExpectedValues()
{
//not exist
-
- var result = _parser.AddCustomerAttribute(customAtr,new CustomerAttribute() { Id="key7"},"value7");
- Assert.IsTrue(result.Count==5);
- Assert.IsTrue(result.Any(c=>c.Key.Equals("key7")));
+
+ var result = _parser.AddCustomerAttribute(customAtr, new CustomerAttribute() { Id = "key7" }, "value7");
+ Assert.IsTrue(result.Count == 5);
+ Assert.IsTrue(result.Any(c => c.Key.Equals("key7")));
}
}
}
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeServiceTests.cs
index 153a85e29..a40001689 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeServiceTests.cs
@@ -6,10 +6,6 @@ using Grand.Infrastructure.Events;
using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -36,9 +32,9 @@ namespace Grand.Business.Customers.Tests.Services
public async Task InsertCustomerAttribute_ValidArguemnts_InvokeRepositoryAndCache()
{
await _atrService.InsertCustomerAttribute(new CustomerAttribute());
- _repositoryMock.Verify(c => c.InsertAsync(It.IsAny<CustomerAttribute>()), Times.Once);
+ _repositoryMock.Verify(c => c.InsertAsync(It.IsAny<CustomerAttribute>()), Times.Once);
_mediatorMock.Verify(c => c.Publish(It.IsAny<EntityInserted<CustomerAttribute>>(), default(CancellationToken)), Times.Once);
- _cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(),true));
+ _cacheMock.Verify(c => c.RemoveByPrefix(It.IsAny<string>(), true));
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerNoteServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerNoteServiceTests.cs
index bc6ceaed1..ca04aa194 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerNoteServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerNoteServiceTests.cs
@@ -5,10 +5,6 @@ using Grand.Infrastructure.Events;
using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -26,7 +22,7 @@ namespace Grand.Business.Customers.Tests.Services
{
_repositoryMock = new Mock<IRepository<CustomerNote>>();
_mediatorMock = new Mock<IMediator>();
- _noteService = new CustomerNoteService(_repositoryMock.Object,_mediatorMock.Object);
+ _noteService = new CustomerNoteService(_repositoryMock.Object, _mediatorMock.Object);
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/UserApiServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/UserApiServiceTests.cs
index ffc6c6112..cdbf64111 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/UserApiServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/UserApiServiceTests.cs
@@ -5,10 +5,6 @@ using Grand.Infrastructure.Events;
using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/VendorServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/VendorServiceTests.cs
index 8327195b0..5b730f017 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/VendorServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/VendorServiceTests.cs
@@ -5,10 +5,6 @@ using Grand.Infrastructure.Events;
using MediatR;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -28,7 +24,7 @@ namespace Grand.Business.Customers.Tests.Services
_repoMock = new Mock<IRepository<Vendor>>();
_vendorReviewRepositoryMock = new Mock<IRepository<VendorReview>>();
_mediatorMock = new Mock<IMediator>();
- _vendorService = new VendorService(_repoMock.Object,_vendorReviewRepositoryMock.Object,_mediatorMock.Object);
+ _vendorService = new VendorService(_repoMock.Object, _vendorReviewRepositoryMock.Object, _mediatorMock.Object);
}
[TestMethod()]