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.

Storages tests - remove unused using

KrzysztofPajak815f0d581ff1
diff --git a/src/Tests/Grand.Business.Storage.Tests/Extensions/ExtensionsTests.cs b/src/Tests/Grand.Business.Storage.Tests/Extensions/ExtensionsTests.cs
index 72bd7b8e1..ba36e2625 100644
--- a/src/Tests/Grand.Business.Storage.Tests/Extensions/ExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Storage.Tests/Extensions/ExtensionsTests.cs
@@ -3,11 +3,9 @@ using Microsoft.AspNetCore.Http;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
-using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
-using System.Threading.Tasks;
namespace Grand.Business.Storage.Tests.Extensions
{
@@ -24,7 +22,7 @@ namespace Grand.Business.Storage.Tests.Extensions
{
expected = test_Stream.ToArray();
file.Setup(c => c.OpenReadStream()).Returns(test_Stream);
- var result=file.Object.GetDownloadBits();
+ var result = file.Object.GetDownloadBits();
Assert.IsTrue(result.SequenceEqual(expected));
}
}
diff --git a/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs b/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs
index d9356e429..516c8e6e5 100644
--- a/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs
+++ b/src/Tests/Grand.Business.Storage.Tests/Services/DownloadServiceTests.cs
@@ -6,9 +6,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.Tasks;
namespace Grand.Business.Storage.Tests.Services
@@ -33,8 +30,8 @@ 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 }));
- var result=await _service.GetDownloadById("id");
+ _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");
}
diff --git a/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs b/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs
index e69197e6f..c6f9f97c9 100644
--- a/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs
+++ b/src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs
@@ -11,9 +11,6 @@ using Microsoft.AspNetCore.Hosting;
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.Storage.Tests.Services
@@ -43,14 +40,14 @@ namespace Grand.Business.Storage.Tests.Services
_cacheMock = new Mock<ICacheBase>();
_mediaFileStoreMock = new Mock<IMediaFileStore>();
_settings = new MediaSettings();
- _service = new PictureService(_repoMock.Object,_logerMock.Object,_mediatorMock.Object,_webHostMock.Object,_workContextMock.Object
- ,_cacheMock.Object, _mediaFileStoreMock.Object, _settings);
+ _service = new PictureService(_repoMock.Object, _logerMock.Object, _mediatorMock.Object, _webHostMock.Object, _workContextMock.Object
+ , _cacheMock.Object, _mediaFileStoreMock.Object, _settings);
}
[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 = new byte[] { } }));
await _service.LoadPictureBinary(new Picture(), true);
_repoMock.Verify(c => c.GetByIdAsync(It.IsAny<string>()), Times.Once);
}
@@ -60,7 +57,7 @@ namespace Grand.Business.Storage.Tests.Services
public 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 array
Assert.IsTrue(result.Length == 0);
}
@@ -69,7 +66,7 @@ namespace Grand.Business.Storage.Tests.Services
public async Task GetPictureUrl_InovkeCacheQuery()
{
await _service.GetPictureUrl("picture id");
- _cacheMock.Verify(c => c.GetAsync<string>(It.IsAny<string>(), It.IsAny<Func<Task<string>>>()), Times.Once);
+ _cacheMock.Verify(c => c.GetAsync<string>(It.IsAny<string>(), It.IsAny<Func<Task<string>>>()), Times.Once);
}
[TestMethod]