diff --git a/src/Downloader.Test/ExceptionHelperTest.cs b/src/Downloader.Test/ExceptionHelperTest.cs
deleted file mode 100644
index ccc67ad7..00000000
--- a/src/Downloader.Test/ExceptionHelperTest.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.IO;
-using System.Net.Http;
-
-namespace Downloader.Test
-{
- [TestClass]
- public class ExceptionHelperTest
- {
- private Exception GetException()
- {
- try
- {
- throw new Exception("High level exception",
- new IOException("Mid level exception",
- new HttpRequestException("Low level exception")));
- }
- catch (Exception e)
- {
- return e;
- }
- }
-
- [TestMethod]
- public void HasSourceFromThisNamespaceTest()
- {
- // arrange
- Exception exception = GetException();
-
- // act
- bool hasThisNamespace = ExceptionHelper.HasSource(exception, GetType().Namespace);
-
- // assert
- Assert.IsTrue(hasThisNamespace);
- }
-
- [TestMethod]
- public void HasSourceFromNonOccurrenceNamespaceTest()
- {
- // arrange
- Exception exception = GetException();
-
- // act
- bool hasSocketsNamespace = ExceptionHelper.HasSource(exception, "System.Net.Sockets");
- bool hasSecurityNamespace = ExceptionHelper.HasSource(exception, "System.Net.Security");
-
- // assert
- Assert.IsFalse(hasSocketsNamespace);
- Assert.IsFalse(hasSecurityNamespace);
- }
- }
-}
diff --git a/src/Downloader.Test/DownloadServiceEventsState.cs b/src/Downloader.Test/Helper/DownloadServiceEventsState.cs
similarity index 89%
rename from src/Downloader.Test/DownloadServiceEventsState.cs
rename to src/Downloader.Test/Helper/DownloadServiceEventsState.cs
index bbc53960..d808d34d 100644
--- a/src/Downloader.Test/DownloadServiceEventsState.cs
+++ b/src/Downloader.Test/Helper/DownloadServiceEventsState.cs
@@ -1,6 +1,6 @@
using System;
-namespace Downloader.Test
+namespace Downloader.Test.Helper
{
public class DownloadServiceEventsState
{
@@ -21,7 +21,7 @@ public DownloadServiceEventsState(IDownloadService downloadService)
downloadService.DownloadProgressChanged += (s, e) => {
DownloadProgressCount++;
- DownloadProgressIsCorrect &= (e.ProgressPercentage == downloadService.Package.SaveProgress);
+ DownloadProgressIsCorrect &= e.ProgressPercentage == downloadService.Package.SaveProgress;
};
downloadService.DownloadFileCompleted += (s, e) => {
diff --git a/src/Downloader.Test/DownloadIntegrationTest.cs b/src/Downloader.Test/IntegrationTests/DownloadIntegrationTest.cs
similarity index 99%
rename from src/Downloader.Test/DownloadIntegrationTest.cs
rename to src/Downloader.Test/IntegrationTests/DownloadIntegrationTest.cs
index 10a9415a..526039f5 100644
--- a/src/Downloader.Test/DownloadIntegrationTest.cs
+++ b/src/Downloader.Test/IntegrationTests/DownloadIntegrationTest.cs
@@ -5,7 +5,7 @@
using System.Linq;
using System.Threading;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
public abstract class DownloadIntegrationTest
{
@@ -314,7 +314,7 @@ public void SpeedLimitTest()
Config.MaximumBytesPerSecond = 256; // 256 Byte/s
var downloader = new DownloadService(Config);
downloader.DownloadProgressChanged += (s, e) => {
- averageSpeed = ((averageSpeed * progressCounter) + e.BytesPerSecondSpeed) / (progressCounter + 1);
+ averageSpeed = (averageSpeed * progressCounter + e.BytesPerSecondSpeed) / (progressCounter + 1);
progressCounter++;
};
diff --git a/src/Downloader.Test/DownloadServiceMockHelperTest.cs b/src/Downloader.Test/IntegrationTests/DownloadServiceMockHelperTest.cs
similarity index 98%
rename from src/Downloader.Test/DownloadServiceMockHelperTest.cs
rename to src/Downloader.Test/IntegrationTests/DownloadServiceMockHelperTest.cs
index bf183fdc..a7c7e0cd 100644
--- a/src/Downloader.Test/DownloadServiceMockHelperTest.cs
+++ b/src/Downloader.Test/IntegrationTests/DownloadServiceMockHelperTest.cs
@@ -1,7 +1,7 @@
using Downloader.Test.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class DownloadServiceMockHelperTest
diff --git a/src/Downloader.Test/DownloadServiceTest.cs b/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs
similarity index 97%
rename from src/Downloader.Test/DownloadServiceTest.cs
rename to src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs
index 979adc7b..82828830 100644
--- a/src/Downloader.Test/DownloadServiceTest.cs
+++ b/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs
@@ -5,7 +5,7 @@
using System.IO;
using System.Net;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class DownloadServiceTest : DownloadService
@@ -121,7 +121,7 @@ public void TestPackageChunksDataAfterDispose()
Assert.IsNotNull(Package.Chunks);
foreach (var chunk in Package.Chunks)
{
- Assert.IsTrue(DummyFileHelper.AreEqual(dummyData, chunk.Storage.OpenRead()));
+ Assert.IsTrue(dummyData.AreEqual(chunk.Storage.OpenRead()));
}
Package.Clear();
diff --git a/src/Downloader.Test/ParallelOnTheFlyDownloadIntegrationTest.cs b/src/Downloader.Test/IntegrationTests/ParallelOnTheFlyDownloadIntegrationTest.cs
similarity index 92%
rename from src/Downloader.Test/ParallelOnTheFlyDownloadIntegrationTest.cs
rename to src/Downloader.Test/IntegrationTests/ParallelOnTheFlyDownloadIntegrationTest.cs
index e5bff5cb..a4f786bb 100644
--- a/src/Downloader.Test/ParallelOnTheFlyDownloadIntegrationTest.cs
+++ b/src/Downloader.Test/IntegrationTests/ParallelOnTheFlyDownloadIntegrationTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class ParallelOnTheFlyDownloadIntegrationTest : DownloadIntegrationTest
diff --git a/src/Downloader.Test/ParallelOnTheTempDownloadIntegrationTest.cs b/src/Downloader.Test/IntegrationTests/ParallelOnTheTempDownloadIntegrationTest.cs
similarity index 92%
rename from src/Downloader.Test/ParallelOnTheTempDownloadIntegrationTest.cs
rename to src/Downloader.Test/IntegrationTests/ParallelOnTheTempDownloadIntegrationTest.cs
index 4508eef2..109694eb 100644
--- a/src/Downloader.Test/ParallelOnTheTempDownloadIntegrationTest.cs
+++ b/src/Downloader.Test/IntegrationTests/ParallelOnTheTempDownloadIntegrationTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class ParallelOnTheTempDownloadIntegrationTest : DownloadIntegrationTest
diff --git a/src/Downloader.Test/SerialOnTheFlyDownloadIntegrationTest.cs b/src/Downloader.Test/IntegrationTests/SerialOnTheFlyDownloadIntegrationTest.cs
similarity index 92%
rename from src/Downloader.Test/SerialOnTheFlyDownloadIntegrationTest.cs
rename to src/Downloader.Test/IntegrationTests/SerialOnTheFlyDownloadIntegrationTest.cs
index 6fed73b6..d18064bd 100644
--- a/src/Downloader.Test/SerialOnTheFlyDownloadIntegrationTest.cs
+++ b/src/Downloader.Test/IntegrationTests/SerialOnTheFlyDownloadIntegrationTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class SerialOnTheFlyDownloadIntegrationTest : DownloadIntegrationTest
diff --git a/src/Downloader.Test/SerialOnTheTempDownloadIntegrationTest.cs b/src/Downloader.Test/IntegrationTests/SerialOnTheTempDownloadIntegrationTest.cs
similarity index 92%
rename from src/Downloader.Test/SerialOnTheTempDownloadIntegrationTest.cs
rename to src/Downloader.Test/IntegrationTests/SerialOnTheTempDownloadIntegrationTest.cs
index ea892090..8b2d24ef 100644
--- a/src/Downloader.Test/SerialOnTheTempDownloadIntegrationTest.cs
+++ b/src/Downloader.Test/IntegrationTests/SerialOnTheTempDownloadIntegrationTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.IntegrationTests
{
[TestClass]
public class SerialOnTheTempDownloadIntegrationTest : DownloadIntegrationTest
diff --git a/src/Downloader.Test/BandwidthTest.cs b/src/Downloader.Test/UnitTests/BandwidthTest.cs
similarity index 97%
rename from src/Downloader.Test/BandwidthTest.cs
rename to src/Downloader.Test/UnitTests/BandwidthTest.cs
index 9e90de58..59f8f255 100644
--- a/src/Downloader.Test/BandwidthTest.cs
+++ b/src/Downloader.Test/UnitTests/BandwidthTest.cs
@@ -4,7 +4,7 @@
using System.Linq;
using System.Threading;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class BandwidthTest
diff --git a/src/Downloader.Test/ChunkDownloaderTest.cs b/src/Downloader.Test/UnitTests/ChunkDownloaderTest.cs
similarity index 99%
rename from src/Downloader.Test/ChunkDownloaderTest.cs
rename to src/Downloader.Test/UnitTests/ChunkDownloaderTest.cs
index 100f5964..7fc649ec 100644
--- a/src/Downloader.Test/ChunkDownloaderTest.cs
+++ b/src/Downloader.Test/UnitTests/ChunkDownloaderTest.cs
@@ -7,7 +7,7 @@
using Downloader.Test.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class ChunkDownloaderTest
diff --git a/src/Downloader.Test/ChunkHubTest.cs b/src/Downloader.Test/UnitTests/ChunkHubTest.cs
similarity index 99%
rename from src/Downloader.Test/ChunkHubTest.cs
rename to src/Downloader.Test/UnitTests/ChunkHubTest.cs
index 8790bef5..26a2fa59 100644
--- a/src/Downloader.Test/ChunkHubTest.cs
+++ b/src/Downloader.Test/UnitTests/ChunkHubTest.cs
@@ -7,7 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class ChunkHubTest
diff --git a/src/Downloader.Test/ChunkTest.cs b/src/Downloader.Test/UnitTests/ChunkTest.cs
similarity index 99%
rename from src/Downloader.Test/ChunkTest.cs
rename to src/Downloader.Test/UnitTests/ChunkTest.cs
index 65ac9e17..7b14bfe8 100644
--- a/src/Downloader.Test/ChunkTest.cs
+++ b/src/Downloader.Test/UnitTests/ChunkTest.cs
@@ -5,7 +5,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public abstract class ChunkTest
@@ -145,7 +145,7 @@ public void IsValidPositionOnOverflowTest()
// assert
Assert.IsFalse(isValidPosition);
}
-
+
[TestMethod]
public void IsValidPositionWithEqualStorageSizeTest()
{
diff --git a/src/Downloader.Test/DownloadBuilderTest.cs b/src/Downloader.Test/UnitTests/DownloadBuilderTest.cs
similarity index 98%
rename from src/Downloader.Test/DownloadBuilderTest.cs
rename to src/Downloader.Test/UnitTests/DownloadBuilderTest.cs
index 7cdd70d9..35d53b81 100644
--- a/src/Downloader.Test/DownloadBuilderTest.cs
+++ b/src/Downloader.Test/UnitTests/DownloadBuilderTest.cs
@@ -2,7 +2,7 @@
using System;
using System.IO;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class DownloadBuilderTest
diff --git a/src/Downloader.Test/DownloadConfigurationTest.cs b/src/Downloader.Test/UnitTests/DownloadConfigurationTest.cs
similarity index 98%
rename from src/Downloader.Test/DownloadConfigurationTest.cs
rename to src/Downloader.Test/UnitTests/DownloadConfigurationTest.cs
index b136559c..24bdd58a 100644
--- a/src/Downloader.Test/DownloadConfigurationTest.cs
+++ b/src/Downloader.Test/UnitTests/DownloadConfigurationTest.cs
@@ -2,7 +2,7 @@
using System.IO;
using System.Reflection;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class DownloadConfigurationTest
diff --git a/src/Downloader.Test/DownloadPackageTest.cs b/src/Downloader.Test/UnitTests/DownloadPackageTest.cs
similarity index 99%
rename from src/Downloader.Test/DownloadPackageTest.cs
rename to src/Downloader.Test/UnitTests/DownloadPackageTest.cs
index 33d05af1..905ef440 100644
--- a/src/Downloader.Test/DownloadPackageTest.cs
+++ b/src/Downloader.Test/UnitTests/DownloadPackageTest.cs
@@ -4,7 +4,7 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public abstract class DownloadPackageTest
diff --git a/src/Downloader.Test/DummyFileControllerTest.cs b/src/Downloader.Test/UnitTests/DummyFileControllerTest.cs
similarity index 92%
rename from src/Downloader.Test/DummyFileControllerTest.cs
rename to src/Downloader.Test/UnitTests/DummyFileControllerTest.cs
index baa64440..2bb10361 100644
--- a/src/Downloader.Test/DummyFileControllerTest.cs
+++ b/src/Downloader.Test/UnitTests/DummyFileControllerTest.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Net;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class DummyFileControllerTest
@@ -36,7 +36,7 @@ public void GetFileWithNameTest()
byte[] bytes = new byte[size];
string filename = "testfilename.dat";
string url = DummyFileHelper.GetFileWithNameUrl(filename, size);
- var dummyData = Helper.DummyData.GenerateOrderedBytes(size);
+ var dummyData = DummyData.GenerateOrderedBytes(size);
// act
var headers = ReadAndGetHeaders(url, bytes);
@@ -55,7 +55,7 @@ public void GetFileWithoutHeaderTest()
byte[] bytes = new byte[size];
string filename = "testfilename.dat";
string url = DummyFileHelper.GetFileWithoutHeaderUrl(filename, size);
- var dummyData = Helper.DummyData.GenerateOrderedBytes(size);
+ var dummyData = DummyData.GenerateOrderedBytes(size);
// act
var headers = ReadAndGetHeaders(url, bytes);
@@ -74,7 +74,7 @@ public void GetFileWithContentDispositionTest()
byte[] bytes = new byte[size];
string filename = "testfilename.dat";
string url = DummyFileHelper.GetFileWithContentDispositionUrl(filename, size);
- var dummyData = Helper.DummyData.GenerateOrderedBytes(size);
+ var dummyData = DummyData.GenerateOrderedBytes(size);
// act
var headers = ReadAndGetHeaders(url, bytes);
diff --git a/src/Downloader.Test/UnitTests/ExceptionHelperTest.cs b/src/Downloader.Test/UnitTests/ExceptionHelperTest.cs
new file mode 100644
index 00000000..23bc3a51
--- /dev/null
+++ b/src/Downloader.Test/UnitTests/ExceptionHelperTest.cs
@@ -0,0 +1,84 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.IO;
+using System.Net.Http;
+
+namespace Downloader.Test.UnitTests
+{
+ [TestClass]
+ public class ExceptionHelperTest
+ {
+ [TestMethod]
+ public void HasSourceFromThisNamespaceTest()
+ {
+ // arrange
+ Exception exception = ExceptionThrower.GetException();
+ var exceptionSource = exception.Source;
+ var currentNamespace = "Downloader.Test";
+
+ // act
+ bool hasThisNamespace = exception.HasSource(currentNamespace);
+
+ // assert
+ Assert.IsTrue(hasThisNamespace,
+ $"Exception.Source: {exceptionSource}, CurrentNamespace: {currentNamespace}");
+ }
+
+ [TestMethod]
+ public void HasSourceFromNonOccurrenceNamespaceTest()
+ {
+ // arrange
+ Exception exception = ExceptionThrower.GetException();
+
+ // act
+ bool hasSocketsNamespace = exception.HasSource("System.Net.Sockets");
+ bool hasSecurityNamespace = exception.HasSource("System.Net.Security");
+
+ // assert
+ Assert.IsFalse(hasSocketsNamespace);
+ Assert.IsFalse(hasSecurityNamespace);
+ }
+ }
+
+ public static class ExceptionThrower
+ {
+ public static Exception GetException()
+ {
+ try
+ {
+ ThrowException();
+ return new Exception(); // This code will never run.
+ }
+ catch (Exception e)
+ {
+ return e;
+ }
+ }
+ private static void ThrowException()
+ {
+ try
+ {
+ ThrowIoException();
+ }
+ catch (Exception e)
+ {
+ throw new Exception("High level exception", e);
+ }
+ }
+ private static void ThrowIoException()
+ {
+ try
+ {
+ ThrowHttpRequestException();
+ }
+ catch (Exception e)
+ {
+ throw new IOException("Mid level exception", e);
+ }
+ }
+ private static void ThrowHttpRequestException()
+ {
+ throw new HttpRequestException("Low level exception");
+ }
+ }
+}
diff --git a/src/Downloader.Test/FileChunkTest.cs b/src/Downloader.Test/UnitTests/FileChunkTest.cs
similarity index 87%
rename from src/Downloader.Test/FileChunkTest.cs
rename to src/Downloader.Test/UnitTests/FileChunkTest.cs
index 037a7071..e053aa64 100644
--- a/src/Downloader.Test/FileChunkTest.cs
+++ b/src/Downloader.Test/UnitTests/FileChunkTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class FileChunkTest : ChunkTest
diff --git a/src/Downloader.Test/FileDownloadPackageTest.cs b/src/Downloader.Test/UnitTests/FileDownloadPackageTest.cs
similarity index 90%
rename from src/Downloader.Test/FileDownloadPackageTest.cs
rename to src/Downloader.Test/UnitTests/FileDownloadPackageTest.cs
index 52940b55..5173d6c8 100644
--- a/src/Downloader.Test/FileDownloadPackageTest.cs
+++ b/src/Downloader.Test/UnitTests/FileDownloadPackageTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class FileDownloadPackageTest : DownloadPackageTest
diff --git a/src/Downloader.Test/FileHelperTest.cs b/src/Downloader.Test/UnitTests/FileHelperTest.cs
similarity index 99%
rename from src/Downloader.Test/FileHelperTest.cs
rename to src/Downloader.Test/UnitTests/FileHelperTest.cs
index 2af2f889..4b36b3df 100644
--- a/src/Downloader.Test/FileHelperTest.cs
+++ b/src/Downloader.Test/UnitTests/FileHelperTest.cs
@@ -3,7 +3,7 @@
using Downloader.Test.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class FileHelperTest
diff --git a/src/Downloader.Test/FileStorageTest.cs b/src/Downloader.Test/UnitTests/FileStorageTest.cs
similarity index 97%
rename from src/Downloader.Test/FileStorageTest.cs
rename to src/Downloader.Test/UnitTests/FileStorageTest.cs
index 53246edf..b1067e9a 100644
--- a/src/Downloader.Test/FileStorageTest.cs
+++ b/src/Downloader.Test/UnitTests/FileStorageTest.cs
@@ -4,7 +4,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class FileStorageTest : StorageTest
diff --git a/src/Downloader.Test/MemoryChunkTest.cs b/src/Downloader.Test/UnitTests/MemoryChunkTest.cs
similarity index 88%
rename from src/Downloader.Test/MemoryChunkTest.cs
rename to src/Downloader.Test/UnitTests/MemoryChunkTest.cs
index 86039c0c..6128b078 100644
--- a/src/Downloader.Test/MemoryChunkTest.cs
+++ b/src/Downloader.Test/UnitTests/MemoryChunkTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class MemoryChunkTest : ChunkTest
diff --git a/src/Downloader.Test/MemoryDownloadPackageTest.cs b/src/Downloader.Test/UnitTests/MemoryDownloadPackageTest.cs
similarity index 90%
rename from src/Downloader.Test/MemoryDownloadPackageTest.cs
rename to src/Downloader.Test/UnitTests/MemoryDownloadPackageTest.cs
index 7f476859..82039ba0 100644
--- a/src/Downloader.Test/MemoryDownloadPackageTest.cs
+++ b/src/Downloader.Test/UnitTests/MemoryDownloadPackageTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class MemoryDownloadPackageTest : DownloadPackageTest
diff --git a/src/Downloader.Test/MemoryStorageTest.cs b/src/Downloader.Test/UnitTests/MemoryStorageTest.cs
similarity index 87%
rename from src/Downloader.Test/MemoryStorageTest.cs
rename to src/Downloader.Test/UnitTests/MemoryStorageTest.cs
index d87b8d62..d6a2f705 100644
--- a/src/Downloader.Test/MemoryStorageTest.cs
+++ b/src/Downloader.Test/UnitTests/MemoryStorageTest.cs
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class MemoryStorageTest : StorageTest
diff --git a/src/Downloader.Test/RequestTest.cs b/src/Downloader.Test/UnitTests/RequestTest.cs
similarity index 99%
rename from src/Downloader.Test/RequestTest.cs
rename to src/Downloader.Test/UnitTests/RequestTest.cs
index cc64d260..2cdf6d6e 100644
--- a/src/Downloader.Test/RequestTest.cs
+++ b/src/Downloader.Test/UnitTests/RequestTest.cs
@@ -3,7 +3,7 @@
using Downloader.Test.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class RequestTest
diff --git a/src/Downloader.Test/StorageTest.cs b/src/Downloader.Test/UnitTests/StorageTest.cs
similarity index 99%
rename from src/Downloader.Test/StorageTest.cs
rename to src/Downloader.Test/UnitTests/StorageTest.cs
index 7ee42593..f9a8055f 100644
--- a/src/Downloader.Test/StorageTest.cs
+++ b/src/Downloader.Test/UnitTests/StorageTest.cs
@@ -3,7 +3,7 @@
using System;
using System.Threading.Tasks;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
public abstract class StorageTest
{
diff --git a/src/Downloader.Test/ThrottledStreamTest.cs b/src/Downloader.Test/UnitTests/ThrottledStreamTest.cs
similarity index 94%
rename from src/Downloader.Test/ThrottledStreamTest.cs
rename to src/Downloader.Test/UnitTests/ThrottledStreamTest.cs
index 2cbf9da7..653c1cd7 100644
--- a/src/Downloader.Test/ThrottledStreamTest.cs
+++ b/src/Downloader.Test/UnitTests/ThrottledStreamTest.cs
@@ -5,7 +5,7 @@
using Downloader.Test.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-namespace Downloader.Test
+namespace Downloader.Test.UnitTests
{
[TestClass]
public class ThrottledStreamTest
@@ -36,7 +36,7 @@ private void TestStreamReadSpeed(ThrottledStreamRead readMethod)
var limitationCoefficient = 0.8; // 80%
var size = 10240; // 10KB
var maxBytesPerSecond = 1024; // 1024 Byte/s
- var expectedTime = (size / maxBytesPerSecond) * 1000 * limitationCoefficient; // 80% of 10000 Milliseconds
+ var expectedTime = size / maxBytesPerSecond * 1000 * limitationCoefficient; // 80% of 10000 Milliseconds
var randomBytes = DummyData.GenerateRandomBytes(size);
var buffer = new byte[maxBytesPerSecond/8];
var readSize = 1;
@@ -79,7 +79,7 @@ private void TestStreamReadByDynamicSpeed(ThrottledStreamRead readMethod)
var limitationCoefficient = 0.9; // 90%
var size = 10240; // 10KB
var maxBytesPerSecond = 1024; // 1 KByte/s
- var expectedTime = ((size/2 / maxBytesPerSecond) + (size/2 / (maxBytesPerSecond*2))) * 1000 * limitationCoefficient; // 90% of 10000 Milliseconds
+ var expectedTime = (size/2 / maxBytesPerSecond + size/2 / (maxBytesPerSecond*2)) * 1000 * limitationCoefficient; // 90% of 10000 Milliseconds
var randomBytes = DummyData.GenerateRandomBytes(size);
var buffer = new byte[maxBytesPerSecond/8];
var readSize = 1;
@@ -129,7 +129,7 @@ private void TestStreamWriteSpeed(ThrottledStreamWrite writeMethod)
var size = 1024;
var bytesPerSecond = 256; // 256 B/s
var tolerance = 50; // 50 ms
- var expectedTime = (size / bytesPerSecond) * 1000; // 4000 Milliseconds
+ var expectedTime = size / bytesPerSecond * 1000; // 4000 Milliseconds
var randomBytes = DummyData.GenerateRandomBytes(size);
using Stream stream = new ThrottledStream(new MemoryStream(), bytesPerSecond);
var stopWatcher = Stopwatch.StartNew();
diff --git a/src/Downloader/Downloader.csproj b/src/Downloader/Downloader.csproj
index f25f18d3..c6d6d00b 100644
--- a/src/Downloader/Downloader.csproj
+++ b/src/Downloader/Downloader.csproj
@@ -3,7 +3,7 @@
netstandard2.0;netstandard2.1;netcoreapp3.1;net452;net6.0
latestMajor
- 2.3.2
+ 2.3.3
Downloader
Behzad Khosravifar
bezzad
@@ -20,8 +20,8 @@
LICENSE
downloader.png
git
- 2.3.1
- 2.3.1
+ 2.3.3
+ 2.3.3
diff --git a/src/Downloader/FileStorage.cs b/src/Downloader/FileStorage.cs
index 04c5d0bb..bf27f586 100644
--- a/src/Downloader/FileStorage.cs
+++ b/src/Downloader/FileStorage.cs
@@ -6,7 +6,7 @@
namespace Downloader
{
[Serializable]
- internal class FileStorage : IStorage, IDisposable
+ public class FileStorage : IStorage, IDisposable
{
[NonSerialized] private FileStream _stream;
[NonSerialized] private SemaphoreSlim _streamSynchronizer;
diff --git a/src/Downloader/MemoryStorage.cs b/src/Downloader/MemoryStorage.cs
index 18ab1b22..269b86e4 100644
--- a/src/Downloader/MemoryStorage.cs
+++ b/src/Downloader/MemoryStorage.cs
@@ -6,7 +6,7 @@
namespace Downloader
{
[Serializable]
- internal class MemoryStorage : IStorage, IDisposable, ISerializable
+ public class MemoryStorage : IStorage, IDisposable, ISerializable
{
[NonSerialized] private MemoryStream _dataStream;
public string Data