-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted all MS Tests to xUnit tests
- Loading branch information
Showing
34 changed files
with
3,035 additions
and
3,357 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | ||
<AssertMessage /> | ||
<ConfigureAwait ContinueOnCapturedContext="false" /> | ||
</Weavers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,79 @@ | ||
using Downloader.DummyHttpServer; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace Downloader.Test.HelperTests | ||
namespace Downloader.Test.HelperTests; | ||
|
||
public class DummyDataTest | ||
{ | ||
[TestClass] | ||
public class DummyDataTest | ||
[Fact] | ||
public void GenerateOrderedBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
byte[] bytes = Enumerable.Range(0, size).Select(i => (byte)i).ToArray(); | ||
|
||
// act | ||
var dummyData = DummyData.GenerateOrderedBytes(size); | ||
|
||
// assert | ||
Assert.Equal(size, dummyData.Length); | ||
Assert.True(dummyData.SequenceEqual(bytes)); | ||
} | ||
|
||
[Fact] | ||
public void GenerateOrderedBytesLessThan1Test() | ||
{ | ||
[TestMethod] | ||
public void GenerateOrderedBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
byte[] bytes = Enumerable.Range(0, size).Select(i => (byte)i).ToArray(); | ||
|
||
// act | ||
var dummyData = DummyData.GenerateOrderedBytes(size); | ||
|
||
// assert | ||
Assert.AreEqual(size, dummyData.Length); | ||
Assert.IsTrue(dummyData.SequenceEqual(bytes)); | ||
} | ||
|
||
[TestMethod] | ||
public void GenerateOrderedBytesLessThan1Test() | ||
{ | ||
// arrange | ||
int size = 0; | ||
|
||
// act | ||
void act() => DummyData.GenerateOrderedBytes(size); | ||
|
||
// assert | ||
Assert.ThrowsException<ArgumentException>(act); | ||
} | ||
|
||
[TestMethod] | ||
public void GenerateRandomBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
|
||
// act | ||
var dummyData = DummyData.GenerateRandomBytes(size); | ||
|
||
// assert | ||
Assert.AreEqual(size, dummyData.Length); | ||
Assert.IsTrue(dummyData.Any(i => i > 0)); | ||
} | ||
|
||
[TestMethod] | ||
public void GenerateRandomBytesLessThan1Test() | ||
{ | ||
// arrange | ||
int size = 0; | ||
|
||
// act | ||
void act() => DummyData.GenerateRandomBytes(size); | ||
|
||
// assert | ||
Assert.ThrowsException<ArgumentException>(act); | ||
} | ||
|
||
[TestMethod] | ||
public void GenerateSingleBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
byte fillByte = 13; | ||
|
||
// act | ||
var dummyData = DummyData.GenerateSingleBytes(size, fillByte); | ||
|
||
// assert | ||
Assert.AreEqual(size, dummyData.Length); | ||
Assert.IsTrue(dummyData.All(i => i == fillByte)); | ||
} | ||
// arrange | ||
int size = 0; | ||
|
||
// act | ||
void act() => DummyData.GenerateOrderedBytes(size); | ||
|
||
// assert | ||
Assert.ThrowsAny<ArgumentException>(act); | ||
} | ||
|
||
[Fact] | ||
public void GenerateRandomBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
|
||
// act | ||
var dummyData = DummyData.GenerateRandomBytes(size); | ||
|
||
// assert | ||
Assert.Equal(size, dummyData.Length); | ||
Assert.Contains(dummyData, i => i > 0); | ||
} | ||
|
||
[Fact] | ||
public void GenerateRandomBytesLessThan1Test() | ||
{ | ||
// arrange | ||
int size = 0; | ||
|
||
// act | ||
void act() => DummyData.GenerateRandomBytes(size); | ||
|
||
// assert | ||
Assert.ThrowsAny<ArgumentException>(act); | ||
} | ||
|
||
[Fact] | ||
public void GenerateSingleBytesTest() | ||
{ | ||
// arrange | ||
int size = 1024; | ||
byte fillByte = 13; | ||
|
||
// act | ||
var dummyData = DummyData.GenerateSingleBytes(size, fillByte); | ||
|
||
// assert | ||
Assert.Equal(size, dummyData.Length); | ||
Assert.True(dummyData.All(i => i == fillByte)); | ||
} | ||
} |
Oops, something went wrong.