Skip to content

Commit 19761fe

Browse files
committed
Port tests back to .NET Framework 4
1 parent 4326e06 commit 19761fe

28 files changed

Lines changed: 2705 additions & 2616 deletions

QrCodeGenerator/DataSegment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public abstract class DataSegment
105105
/// </summary>
106106
/// <remarks>
107107
/// Most encodings other than Latin-1 / ISO-8859-1 and the UTF encodings require that
108-
/// the encoding is registered, typically using:
108+
/// the encoding is registered (except for .NET Framework 4.x), typically using:
109109
/// <code>Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);</code>
110110
/// </remarks>
111111
/// <param name="text">The text to encode.</param>

QrCodeGenerator/QrCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static QrCode EncodeText(string text, Ecc ecl)
133133
/// maximum size (version).</exception>
134134
/// <remarks>
135135
/// Most encodings other than Latin-1 / ISO-8859-1 and the UTF encodings require that
136-
/// the encoding is registered, typically using:
136+
/// the encoding is registered (except for .NET Framework 4.x), typically using:
137137
/// <code>Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);</code>
138138
/// </remarks>
139139
[SuppressMessage("csharpsquid", "S107")]
Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
using System;
22
using Xunit;
33

4-
namespace Net.Codecrete.QrCodeGenerator.Test;
5-
6-
public class ArraySegmentExtensionsTest
4+
namespace Net.Codecrete.QrCodeGenerator.Test
75
{
8-
[Fact]
9-
public void At_GetsElement()
6+
public class ArraySegmentExtensionsTest
107
{
11-
var data = new byte[] { 0x10, 0x39, 0xba };
12-
var segment = new ArraySegment<byte>(data);
13-
Assert.Equal(0x10, segment.At(0));
14-
Assert.Equal(0x39, segment.At(1));
15-
Assert.Equal(0xba, segment.At(2));
16-
}
8+
[Fact]
9+
public void At_GetsElement()
10+
{
11+
var data = new byte[] { 0x10, 0x39, 0xba };
12+
var segment = new ArraySegment<byte>(data);
13+
Assert.Equal(0x10, segment.At(0));
14+
Assert.Equal(0x39, segment.At(1));
15+
Assert.Equal(0xba, segment.At(2));
16+
}
1717

18-
[Fact]
19-
public void At_ThrowsExceptionForInvalidIndex()
20-
{
21-
var data = new byte[] { 0x10, 0x39, 0xba };
22-
var segment = new ArraySegment<byte>(data);
23-
Assert.Throws<IndexOutOfRangeException>(() => segment.At(-1));
24-
Assert.Throws<IndexOutOfRangeException>(() => segment.At(3));
25-
}
18+
[Fact]
19+
public void At_ThrowsExceptionForInvalidIndex()
20+
{
21+
var data = new byte[] { 0x10, 0x39, 0xba };
22+
var segment = new ArraySegment<byte>(data);
23+
Assert.Throws<IndexOutOfRangeException>(() => segment.At(-1));
24+
Assert.Throws<IndexOutOfRangeException>(() => segment.At(3));
25+
}
2626

27-
[Fact]
28-
public void Slice_Succeeds()
29-
{
30-
var data = new byte[] { 0x00, 0x00, 0x10, 0x39, 0xba, 0x00, 0x00 };
31-
var segment = new ArraySegment<byte>(data);
32-
var slice = segment.MakeSlice(2, 3);
27+
[Fact]
28+
public void Slice_Succeeds()
29+
{
30+
var data = new byte[] { 0x00, 0x00, 0x10, 0x39, 0xba, 0x00, 0x00 };
31+
var segment = new ArraySegment<byte>(data);
32+
var slice = segment.MakeSlice(2, 3);
3333

34-
Assert.Equal(2, slice.Offset);
35-
Assert.Equal(3, slice.Count);
36-
Assert.Equal(0x10, slice.At(0));
37-
Assert.Equal(0x39, slice.At(1));
38-
Assert.Equal(0xba, slice.At(2));
39-
}
34+
Assert.Equal(2, slice.Offset);
35+
Assert.Equal(3, slice.Count);
36+
Assert.Equal(0x10, slice.At(0));
37+
Assert.Equal(0x39, slice.At(1));
38+
Assert.Equal(0xba, slice.At(2));
39+
}
4040

41-
[Fact]
42-
public void Slice_ThrowsExceptionForInvalidRange()
43-
{
44-
var data = new byte[] { 0x00, 0x00, 0x10, 0x39, 0xba, 0x00, 0x00 };
45-
var segment = new ArraySegment<byte>(data);
41+
[Fact]
42+
public void Slice_ThrowsExceptionForInvalidRange()
43+
{
44+
var data = new byte[] { 0x00, 0x00, 0x10, 0x39, 0xba, 0x00, 0x00 };
45+
var segment = new ArraySegment<byte>(data);
4646

47-
Assert.Throws<ArgumentException>(() => segment.MakeSlice(0, 8));
48-
Assert.Throws<ArgumentOutOfRangeException>(() => segment.MakeSlice(2, -1));
49-
Assert.Throws<ArgumentException>(() => segment.MakeSlice(8, 3));
47+
Assert.Throws<ArgumentException>(() => segment.MakeSlice(0, 8));
48+
Assert.Throws<ArgumentOutOfRangeException>(() => segment.MakeSlice(2, -1));
49+
Assert.Throws<ArgumentException>(() => segment.MakeSlice(8, 3));
50+
}
5051
}
5152
}

0 commit comments

Comments
 (0)