Skip to content

Commit 177d418

Browse files
committed
Update packages use for unit tests
1 parent e0d49d7 commit 177d418

15 files changed

+72
-82
lines changed

BencodeNET.Tests/AutoMockedDataAttribute.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using Ploeh.AutoFixture;
2-
using Ploeh.AutoFixture.AutoNSubstitute;
3-
using Ploeh.AutoFixture.Xunit2;
1+
using AutoFixture;
2+
using AutoFixture.AutoNSubstitute;
3+
using AutoFixture.Xunit2;
44
using Xunit;
55

66
namespace BencodeNET.Tests
77
{
88
public class AutoMockedDataAttribute : AutoDataAttribute
99
{
1010
public AutoMockedDataAttribute()
11-
: base(new Fixture().Customize(new AutoConfiguredNSubstituteCustomization()))
11+
: base(() => new Fixture().Customize(new AutoNSubstituteCustomization {ConfigureMembers = true}))
1212
{ }
1313
}
1414

BencodeNET.Tests/BencodeNET.Tests.csproj

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,24 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<None Update="Files\ubuntu-14.10-desktop-amd64.iso.torrent">
9-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
10-
</None>
11-
<None Update="xunit.runner.json">
12-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
13-
</None>
8+
<None Update="Files\ubuntu-14.10-desktop-amd64.iso.torrent" CopyToOutputDirectory="PreserveNewest" />
9+
<None Update="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
1410
</ItemGroup>
1511

1612
<ItemGroup>
1713
<ProjectReference Include="..\BencodeNET\BencodeNET.csproj" />
1814
</ItemGroup>
1915

2016
<ItemGroup>
21-
<PackageReference Include="AutoFixture" Version="3.50.3" />
22-
<PackageReference Include="AutoFixture.AutoNSubstitute" Version="3.50.3" />
23-
<PackageReference Include="AutoFixture.Xunit2" Version="3.50.3" />
24-
<PackageReference Include="FluentAssertions" Version="4.19.3" />
25-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
26-
<PackageReference Include="NSubstitute" Version="2.0.3" />
27-
<PackageReference Include="xunit" Version="2.3.0-beta4-build3742" />
28-
<PackageReference Include="xunit.core" Version="2.3.0-beta4-build3742" />
29-
<PackageReference Include="xunit.extensibility.execution" Version="2.3.0-beta4-build3742" />
30-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta4-build3742" />
17+
<PackageReference Include="AutoFixture" Version="4.8.0" />
18+
<PackageReference Include="AutoFixture.AutoNSubstitute" Version="4.8.0" />
19+
<PackageReference Include="AutoFixture.Xunit2" Version="4.8.0" />
20+
<PackageReference Include="FluentAssertions" Version="5.6.0" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
22+
<PackageReference Include="NSubstitute" Version="4.0.0" />
23+
<PackageReference Include="xunit" Version="2.4.1" />
24+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
3125
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
3226
</ItemGroup>
3327

34-
<ItemGroup>
35-
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
36-
</ItemGroup>
37-
3828
</Project>

BencodeNET.Tests/Objects/BDictionaryTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,31 @@ public void Add_NullValue_ThrowsArgumentNullException()
1414
{
1515
var dict = new BDictionary();
1616
Action action = () => dict.Add("key", null);
17-
action.ShouldThrow<ArgumentNullException>();
17+
action.Should().Throw<ArgumentNullException>();
1818
}
1919

2020
[Fact]
2121
public void Add_NullIBobjectValue_ThrowsArgumentNullException()
2222
{
2323
var dict = new BDictionary();
2424
Action action = () => dict.Add("key", (IBObject)null);
25-
action.ShouldThrow<ArgumentNullException>();
25+
action.Should().Throw<ArgumentNullException>();
2626
}
2727

2828
[Fact]
2929
public void Add_KeyValuePairWithNullValue_ThrowsArgumentException()
3030
{
3131
var dict = new BDictionary();
3232
Action action = () => dict.Add(new KeyValuePair<BString, IBObject>("key", null));
33-
action.ShouldThrow<ArgumentException>();
33+
action.Should().Throw<ArgumentException>();
3434
}
3535

3636
[Fact]
3737
public void Indexer_Set_Null_ThrowsArgumentNullException()
3838
{
3939
var dict = new BDictionary {{"key", "value"}};
4040
Action action = () => dict["key"] = null;
41-
action.ShouldThrow<ArgumentNullException>();
41+
action.Should().Throw<ArgumentNullException>();
4242
}
4343

4444
[Fact]

BencodeNET.Tests/Objects/BListTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void Add_Null_ThrowsArgumentNullException()
1414
{
1515
var blist = new BList();
1616
Action action = () => blist.Add((IBObject) null);
17-
action.ShouldThrow<ArgumentNullException>();
17+
action.Should().Throw<ArgumentNullException>();
1818
}
1919

2020
[Fact]
@@ -34,7 +34,7 @@ public void Indexer_Set_Null_ThrowsArgumentNullException()
3434
{
3535
var blist = new BList {0};
3636
Action action = () => blist[0] = null;
37-
action.ShouldThrow<ArgumentNullException>();
37+
action.Should().Throw<ArgumentNullException>();
3838
}
3939

4040
[Fact]
@@ -155,7 +155,7 @@ public void AsType_ContainingWrongType_ThrowsInvalidCastException()
155155
{
156156
var blist = new BList {1, "2", 3};
157157
Action action = () => blist.AsType<BNumber>();
158-
action.ShouldThrow<InvalidCastException>();
158+
action.Should().Throw<InvalidCastException>();
159159
}
160160

161161
[Fact]
@@ -173,7 +173,7 @@ public void AsStrings_ContainingNonBStringType_ThrowsInvalidCastException()
173173
{
174174
var blist = new BList {"a", "b", 3};
175175
Action action = () => blist.AsStrings();
176-
action.ShouldThrow<InvalidCastException>();
176+
action.Should().Throw<InvalidCastException>();
177177
}
178178

179179
[Fact]
@@ -191,7 +191,7 @@ public void AsNumbers_ContainingNonBNumberType_ThrowsInvalidCastException()
191191
{
192192
var blist = new BList {1, 2, "3"};
193193
Action action = () => blist.AsNumbers();
194-
action.ShouldThrow<InvalidCastException>();
194+
action.Should().Throw<InvalidCastException>();
195195
}
196196
}
197197
}

BencodeNET.Tests/Objects/BNumberTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public void CastingToBool_Null_ThrowsInvalidCastException()
215215
{
216216
BNumber bnumber = null;
217217
Action action = () => { var b = (bool) bnumber; };
218-
action.ShouldThrow<InvalidCastException>();
218+
action.Should().Throw<InvalidCastException>();
219219
}
220220
}
221221
}

BencodeNET.Tests/Objects/BStringTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void ConstructorWithNullValue_ThrowsArgumentNullException()
1414
{
1515
Action action = () => new BString((string) null);
1616

17-
action.ShouldThrow<ArgumentNullException>();
17+
action.Should().Throw<ArgumentNullException>();
1818
}
1919

2020
[Theory]

BencodeNET.Tests/Parsing/BDictionaryParserTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void BelowMinimumLength2_ThrowsInvalidBencodeException(string bencode, IB
4444
var parser = new BDictionaryParser(bparser);
4545
Action action = () => parser.ParseString(bencode);
4646

47-
action.ShouldThrow<InvalidBencodeException<BDictionary>>();
47+
action.Should().Throw<InvalidBencodeException<BDictionary>>();
4848
}
4949

5050
[Theory]
@@ -57,7 +57,7 @@ public void InvalidFirstChar_ThrowsInvalidBencodeException(string bencode, IBenc
5757
var parser = new BDictionaryParser(bparser);
5858
Action action = () => parser.ParseString(bencode);
5959

60-
action.ShouldThrow<InvalidBencodeException<BDictionary>>();
60+
action.Should().Throw<InvalidBencodeException<BDictionary>>();
6161
}
6262

6363
[Theory]
@@ -71,7 +71,7 @@ public void MissingEndChar_ThrowsInvalidBencodeException(string bencode, IBencod
7171
var parser = new BDictionaryParser(bparser);
7272
Action action = () => parser.ParseString(bencode);
7373

74-
action.ShouldThrow<InvalidBencodeException<BDictionary>>();
74+
action.Should().Throw<InvalidBencodeException<BDictionary>>();
7575
}
7676

7777
private static void SetupBencodeParser(IBencodeParser bparser, string bencode, BString key, IBObject value, bool hasEndChar)

BencodeNET.Tests/Parsing/BListParserTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void BelowMinimumLength2_ThrowsInvalidBencodeException(string bencode, IB
5050
var parser = new BListParser(bparser);
5151
Action action = () => parser.ParseString(bencode);
5252

53-
action.ShouldThrow<InvalidBencodeException<BList>>();
53+
action.Should().Throw<InvalidBencodeException<BList>>();
5454
}
5555

5656
[Theory]
@@ -65,7 +65,7 @@ public void InvalidFirstChar_ThrowsInvalidBencodeException(string bencode, IBenc
6565
var parser = new BListParser(bparser);
6666
Action action = () => parser.ParseString(bencode);
6767

68-
action.ShouldThrow<InvalidBencodeException<BList>>();
68+
action.Should().Throw<InvalidBencodeException<BList>>();
6969
}
7070

7171
[Theory]
@@ -84,7 +84,7 @@ public void MissingEndChar_ThrowsInvalidBencodeException(string bencode, IBencod
8484
Action action = () => parser.ParseString(bencode);
8585

8686
// Assert
87-
action.ShouldThrow<InvalidBencodeException<BList>>();
87+
action.Should().Throw<InvalidBencodeException<BList>>();
8888
}
8989

9090
private static void SetupBencodeParser(IBencodeParser bparser, string bencode, IBObject obj, bool hasEndChar)

BencodeNET.Tests/Parsing/BNumberParserTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public void CanParseInt64(string bencode, long value)
6666
public void LeadingZeros_ThrowsInvalidBencodeException(string bencode)
6767
{
6868
Action action = () => Parser.ParseString(bencode);
69-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
69+
action.Should().Throw<InvalidBencodeException<BNumber>>();
7070
}
7171

7272
[Fact]
7373
public void MinusZero_ThrowsInvalidBencodeException()
7474
{
7575
Action action = () => Parser.ParseString("i-0e");
76-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
76+
action.Should().Throw<InvalidBencodeException<BNumber>>();
7777
}
7878

7979
[Theory]
@@ -84,7 +84,7 @@ public void MinusZero_ThrowsInvalidBencodeException()
8484
public void MissingEndChar_ThrowsInvalidBencodeException(string bencode)
8585
{
8686
Action action = () => Parser.ParseString(bencode);
87-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
87+
action.Should().Throw<InvalidBencodeException<BNumber>>();
8888
}
8989

9090
[Theory]
@@ -95,14 +95,14 @@ public void MissingEndChar_ThrowsInvalidBencodeException(string bencode)
9595
public void InvalidFirstChar_ThrowsInvalidBencodeException(string bencode)
9696
{
9797
Action action = () => Parser.ParseString(bencode);
98-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
98+
action.Should().Throw<InvalidBencodeException<BNumber>>();
9999
}
100100

101101
[Fact]
102102
public void JustNegativeSign_ThrowsInvalidBencodeException()
103103
{
104104
Action action = () => Parser.ParseString("i-e");
105-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
105+
action.Should().Throw<InvalidBencodeException<BNumber>>();
106106
}
107107

108108
[Theory]
@@ -113,7 +113,7 @@ public void JustNegativeSign_ThrowsInvalidBencodeException()
113113
public void MoreThanOneNegativeSign_ThrowsInvalidBencodeException(string bencode)
114114
{
115115
Action action = () => Parser.ParseString(bencode);
116-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
116+
action.Should().Throw<InvalidBencodeException<BNumber>>();
117117
}
118118

119119
[Theory]
@@ -126,14 +126,14 @@ public void MoreThanOneNegativeSign_ThrowsInvalidBencodeException(string bencode
126126
public void NonDigit_ThrowsInvalidBencodeException(string bencode)
127127
{
128128
Action action = () => Parser.ParseString(bencode);
129-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
129+
action.Should().Throw<InvalidBencodeException<BNumber>>();
130130
}
131131

132132
[Fact]
133133
public void BelowMinimumLength_ThrowsInvalidBencodeException()
134134
{
135135
Action action = () => Parser.ParseString("ie");
136-
action.ShouldThrow<InvalidBencodeException<BNumber>>();
136+
action.Should().Throw<InvalidBencodeException<BNumber>>();
137137
}
138138

139139
[Theory]
@@ -142,7 +142,7 @@ public void BelowMinimumLength_ThrowsInvalidBencodeException()
142142
public void LargerThanInt64_ThrowsUnsupportedException(string bencode)
143143
{
144144
Action action = () => Parser.ParseString(bencode);
145-
action.ShouldThrow<UnsupportedBencodeException<BNumber>>();
145+
action.Should().Throw<UnsupportedBencodeException<BNumber>>();
146146
}
147147

148148
[Theory]
@@ -152,7 +152,7 @@ public void LargerThanInt64_ThrowsUnsupportedException(string bencode)
152152
public void LongerThanMaxDigits19_ThrowsUnsupportedException(string bencode)
153153
{
154154
Action action = () => Parser.ParseString(bencode);
155-
action.ShouldThrow<UnsupportedBencodeException<BNumber>>();
155+
action.Should().Throw<UnsupportedBencodeException<BNumber>>();
156156
}
157157
}
158158
}

BencodeNET.Tests/Parsing/BObjectParserListTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void Add_ParserWithNonIBObjectType_ThrowsArgumentException(Type type, IBO
6363
var list = new BObjectParserList();
6464
Action action = () => list.Add(type, parser);
6565

66-
action.ShouldThrow<ArgumentException>("because only IBObject types are allowed");
66+
action.Should().Throw<ArgumentException>("because only IBObject types are allowed");
6767
}
6868

6969
[Theory]

BencodeNET.Tests/Parsing/BStringParserTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void CanParse_EmptyString()
5151
public void LessCharsThanSpecified_ThrowsInvalidBencodeException(string bencode)
5252
{
5353
Action action = () => Parser.ParseString(bencode);
54-
action.ShouldThrow<InvalidBencodeException<BString>>();
54+
action.Should().Throw<InvalidBencodeException<BString>>();
5555
}
5656

5757
[Theory]
@@ -65,7 +65,7 @@ public void LessCharsThanSpecified_ThrowsInvalidBencodeException(string bencode)
6565
public void MissingDelimiter_ThrowsInvalidBencodeException(string bencode)
6666
{
6767
Action action = () => Parser.ParseString(bencode);
68-
action.ShouldThrow<InvalidBencodeException<BString>>();
68+
action.Should().Throw<InvalidBencodeException<BString>>();
6969
}
7070

7171
[Theory]
@@ -80,7 +80,7 @@ public void MissingDelimiter_ThrowsInvalidBencodeException(string bencode)
8080
public void NonDigitFirstChar_ThrowsInvalidBencodeException(string bencode)
8181
{
8282
Action action = () => Parser.ParseString(bencode);
83-
action.ShouldThrow<InvalidBencodeException<BString>>();
83+
action.Should().Throw<InvalidBencodeException<BString>>();
8484
}
8585

8686
[Theory]
@@ -89,7 +89,7 @@ public void NonDigitFirstChar_ThrowsInvalidBencodeException(string bencode)
8989
public void LessThanMinimumLength2_ThrowsInvalidBencodeException(string bencode)
9090
{
9191
Action action = () => Parser.ParseString(bencode);
92-
action.ShouldThrow<InvalidBencodeException<BString>>();
92+
action.Should().Throw<InvalidBencodeException<BString>>();
9393
}
9494

9595
[Theory]
@@ -100,7 +100,7 @@ public void LessThanMinimumLength2_ThrowsInvalidBencodeException(string bencode)
100100
public void LengthAboveMaxDigits10_ThrowsUnsupportedException(string bencode)
101101
{
102102
Action action = () => Parser.ParseString(bencode);
103-
action.ShouldThrow<UnsupportedBencodeException<BString>>();
103+
action.Should().Throw<UnsupportedBencodeException<BString>>();
104104
}
105105

106106
[Theory]
@@ -117,23 +117,23 @@ public void LengthAboveMaxDigits10_ThrowsUnsupportedException(string bencode)
117117
public void LengthAtOrBelowMaxDigits10_DoesNotThrowUnsupportedException(string bencode)
118118
{
119119
Action action = () => Parser.ParseString(bencode);
120-
action.ShouldNotThrow<UnsupportedBencodeException<BString>>();
120+
action.Should().NotThrow<UnsupportedBencodeException<BString>>();
121121
}
122122

123123
[Fact]
124124
public void LengthAboveInt32MaxValue_ThrowsUnsupportedException()
125125
{
126126
var bencode = "2147483648:spam";
127127
Action action = () => Parser.ParseString(bencode);
128-
action.ShouldThrow<UnsupportedBencodeException<BString>>();
128+
action.Should().Throw<UnsupportedBencodeException<BString>>();
129129
}
130130

131131
[Fact]
132132
public void LengthBelowInt32MaxValue_DoesNotThrowUnsupportedException()
133133
{
134134
var bencode = "2147483647:spam";
135135
Action action = () => Parser.ParseString(bencode);
136-
action.ShouldNotThrow<UnsupportedBencodeException<BString>>();
136+
action.Should().NotThrow<UnsupportedBencodeException<BString>>();
137137
}
138138

139139
[Fact]

BencodeNET.Tests/Parsing/BencodeParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void InvalidFirstChars_ThrowsInvalidBencodeException(string bencode)
123123
var bparser = new BencodeParser();
124124
Action action = () => bparser.ParseString(bencode);
125125

126-
action.ShouldThrow<InvalidBencodeException<IBObject>>();
126+
action.Should().Throw<InvalidBencodeException<IBObject>>();
127127
}
128128

129129
[Fact]

0 commit comments

Comments
 (0)