Skip to content

Commit 2f74142

Browse files
committed
Updated with gitattributes
1 parent ba3f059 commit 2f74142

32 files changed

+2473
-2473
lines changed

src/AngleSharp.Io.Tests/AngleSharp.Io.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
2323
</ItemGroup>
2424

25-
<ItemGroup>
26-
<None Update="TestContent.txt">
27-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
28-
</None>
25+
<ItemGroup>
26+
<None Update="TestContent.txt">
27+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
28+
</None>
2929
</ItemGroup>
3030
</Project>

src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs

Lines changed: 465 additions & 465 deletions
Large diffs are not rendered by default.
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
namespace AngleSharp.Io.Tests
2-
{
3-
using System;
4-
using System.IO;
5-
6-
sealed class DisposableStream : Stream
7-
{
1+
namespace AngleSharp.Io.Tests
2+
{
3+
using System;
4+
using System.IO;
5+
6+
sealed class DisposableStream : Stream
7+
{
88
public override Boolean CanRead => false;
99

1010
public override Boolean CanSeek => false;
@@ -13,47 +13,47 @@ sealed class DisposableStream : Stream
1313

1414
public override Int64 Length => 0;
1515

16-
public override Int64 Position
17-
{
18-
get;
19-
set;
20-
}
21-
22-
public Boolean Disposed
23-
{
24-
get;
25-
set;
26-
}
27-
28-
public override void Flush()
29-
{
30-
throw new NotImplementedException();
31-
}
32-
33-
public override Int64 Seek(Int64 offset, SeekOrigin origin)
34-
{
35-
throw new NotImplementedException();
36-
}
37-
38-
public override void SetLength(Int64 value)
39-
{
40-
throw new NotImplementedException();
41-
}
42-
43-
public override Int32 Read(Byte[] buffer, Int32 offset, Int32 count)
44-
{
45-
throw new NotImplementedException();
46-
}
47-
48-
public override void Write(Byte[] buffer, Int32 offset, Int32 count)
49-
{
50-
throw new NotImplementedException();
51-
}
52-
53-
protected override void Dispose(Boolean disposing)
54-
{
55-
Disposed = true;
56-
base.Dispose(disposing);
57-
}
58-
}
59-
}
16+
public override Int64 Position
17+
{
18+
get;
19+
set;
20+
}
21+
22+
public Boolean Disposed
23+
{
24+
get;
25+
set;
26+
}
27+
28+
public override void Flush()
29+
{
30+
throw new NotImplementedException();
31+
}
32+
33+
public override Int64 Seek(Int64 offset, SeekOrigin origin)
34+
{
35+
throw new NotImplementedException();
36+
}
37+
38+
public override void SetLength(Int64 value)
39+
{
40+
throw new NotImplementedException();
41+
}
42+
43+
public override Int32 Read(Byte[] buffer, Int32 offset, Int32 count)
44+
{
45+
throw new NotImplementedException();
46+
}
47+
48+
public override void Write(Byte[] buffer, Int32 offset, Int32 count)
49+
{
50+
throw new NotImplementedException();
51+
}
52+
53+
protected override void Dispose(Boolean disposing)
54+
{
55+
Disposed = true;
56+
base.Dispose(disposing);
57+
}
58+
}
59+
}

src/AngleSharp.Io.Tests/Helper.cs

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
namespace AngleSharp.Io.Tests
2-
{
3-
using NUnit.Framework;
4-
using System;
5-
using System.Net.NetworkInformation;
6-
7-
/// <summary>
8-
/// Small (but quite useable) code to enable / disable some
9-
/// test(s) depending on the current network status.
10-
/// Taken from
11-
/// http://stackoverflow.com/questions/520347/c-sharp-how-do-i-check-for-a-network-connection
12-
/// </summary>
13-
static class Helper
14-
{
15-
/// <summary>
16-
/// Indicates whether any network connection is available
17-
/// Filter connections below a specified speed, as well as virtual network cards.
18-
/// Additionally writes an inconclusive message if no network is available.
19-
/// </summary>
20-
/// <returns>True if a network connection is available; otherwise false.</returns>
21-
public static Boolean IsNetworkAvailable()
22-
{
23-
if (IsNetworkAvailable(0))
24-
{
25-
return true;
26-
}
27-
28-
Assert.Inconclusive("No network has been detected. Test skipped.");
29-
return false;
30-
}
31-
32-
/// <summary>
33-
/// Indicates whether any network connection is available.
34-
/// Filter connections below a specified speed, as well as virtual network cards.
35-
/// </summary>
36-
/// <param name="minimumSpeed">The minimum speed required. Passing 0 will not filter connection using speed.</param>
37-
/// <returns>True if a network connection is available; otherwise false.</returns>
38-
public static Boolean IsNetworkAvailable(Int64 minimumSpeed)
39-
{
40-
if (NetworkInterface.GetIsNetworkAvailable())
41-
{
42-
foreach (var ni in NetworkInterface.GetAllNetworkInterfaces())
43-
{
44-
// discard because of standard reasons
45-
if ((ni.OperationalStatus != OperationalStatus.Up) ||
46-
(ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) ||
47-
(ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))
48-
continue;
49-
50-
// this allow to filter modems, serial, etc.
51-
// I use 10000000 as a minimum speed for most cases
52-
if (ni.Speed < minimumSpeed)
53-
continue;
54-
55-
// discard virtual cards (virtual box, virtual pc, etc.)
56-
if ((ni.Description.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0) ||
57-
(ni.Name.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0))
58-
continue;
59-
60-
// discard "Microsoft Loopback Adapter", it will not show as NetworkInterfaceType.Loopback but as Ethernet Card.
61-
if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))
62-
continue;
63-
64-
return true;
65-
}
66-
}
67-
68-
return false;
69-
}
70-
}
1+
namespace AngleSharp.Io.Tests
2+
{
3+
using NUnit.Framework;
4+
using System;
5+
using System.Net.NetworkInformation;
6+
7+
/// <summary>
8+
/// Small (but quite useable) code to enable / disable some
9+
/// test(s) depending on the current network status.
10+
/// Taken from
11+
/// http://stackoverflow.com/questions/520347/c-sharp-how-do-i-check-for-a-network-connection
12+
/// </summary>
13+
static class Helper
14+
{
15+
/// <summary>
16+
/// Indicates whether any network connection is available
17+
/// Filter connections below a specified speed, as well as virtual network cards.
18+
/// Additionally writes an inconclusive message if no network is available.
19+
/// </summary>
20+
/// <returns>True if a network connection is available; otherwise false.</returns>
21+
public static Boolean IsNetworkAvailable()
22+
{
23+
if (IsNetworkAvailable(0))
24+
{
25+
return true;
26+
}
27+
28+
Assert.Inconclusive("No network has been detected. Test skipped.");
29+
return false;
30+
}
31+
32+
/// <summary>
33+
/// Indicates whether any network connection is available.
34+
/// Filter connections below a specified speed, as well as virtual network cards.
35+
/// </summary>
36+
/// <param name="minimumSpeed">The minimum speed required. Passing 0 will not filter connection using speed.</param>
37+
/// <returns>True if a network connection is available; otherwise false.</returns>
38+
public static Boolean IsNetworkAvailable(Int64 minimumSpeed)
39+
{
40+
if (NetworkInterface.GetIsNetworkAvailable())
41+
{
42+
foreach (var ni in NetworkInterface.GetAllNetworkInterfaces())
43+
{
44+
// discard because of standard reasons
45+
if ((ni.OperationalStatus != OperationalStatus.Up) ||
46+
(ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) ||
47+
(ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))
48+
continue;
49+
50+
// this allow to filter modems, serial, etc.
51+
// I use 10000000 as a minimum speed for most cases
52+
if (ni.Speed < minimumSpeed)
53+
continue;
54+
55+
// discard virtual cards (virtual box, virtual pc, etc.)
56+
if ((ni.Description.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0) ||
57+
(ni.Name.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0))
58+
continue;
59+
60+
// discard "Microsoft Loopback Adapter", it will not show as NetworkInterfaceType.Loopback but as Ethernet Card.
61+
if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))
62+
continue;
63+
64+
return true;
65+
}
66+
}
67+
68+
return false;
69+
}
70+
}
7171
}
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
namespace AngleSharp.Io.Tests.Integration
2-
{
3-
using AngleSharp.Dom;
4-
using AngleSharp.Html.Dom;
5-
using NUnit.Framework;
6-
using System;
7-
using System.Threading.Tasks;
8-
9-
[TestFixture]
10-
public class DocumentTests
11-
{
12-
[Test]
13-
public async Task IframeWithDocumentViaDataSrc()
14-
{
1+
namespace AngleSharp.Io.Tests.Integration
2+
{
3+
using AngleSharp.Dom;
4+
using AngleSharp.Html.Dom;
5+
using NUnit.Framework;
6+
using System;
7+
using System.Threading.Tasks;
8+
9+
[TestFixture]
10+
public class DocumentTests
11+
{
12+
[Test]
13+
public async Task IframeWithDocumentViaDataSrc()
14+
{
1515
var cfg = Configuration.Default.WithRequesters().WithDefaultLoader(new LoaderOptions
1616
{
1717
IsResourceLoadingEnabled = true
18-
});
19-
var html = @"<!doctype html><iframe id=myframe src='data:text/html,<span>Hello World!</span>'></iframe></script>";
20-
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
21-
var iframe = document.QuerySelector<IHtmlInlineFrameElement>("#myframe");
22-
Assert.IsNotNull(iframe);
23-
Assert.IsNotNull(iframe.ContentDocument);
24-
Assert.AreEqual("Hello World!", iframe.ContentDocument.Body.TextContent);
25-
Assert.AreEqual(iframe.ContentDocument, iframe.ContentWindow.Document);
18+
});
19+
var html = @"<!doctype html><iframe id=myframe src='data:text/html,<span>Hello World!</span>'></iframe></script>";
20+
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
21+
var iframe = document.QuerySelector<IHtmlInlineFrameElement>("#myframe");
22+
Assert.IsNotNull(iframe);
23+
Assert.IsNotNull(iframe.ContentDocument);
24+
Assert.AreEqual("Hello World!", iframe.ContentDocument.Body.TextContent);
25+
Assert.AreEqual(iframe.ContentDocument, iframe.ContentWindow.Document);
2626
}
2727

28-
[Test]
29-
public async Task ImportPageFromDataRequest()
30-
{
31-
var receivedRequest = new TaskCompletionSource<Boolean>();
28+
[Test]
29+
public async Task ImportPageFromDataRequest()
30+
{
31+
var receivedRequest = new TaskCompletionSource<Boolean>();
3232
var config = Configuration.Default.WithRequesters().WithDefaultLoader(new LoaderOptions
3333
{
3434
IsResourceLoadingEnabled = true,
35-
Filter = request =>
36-
{
37-
receivedRequest.SetResult(true);
38-
return true;
35+
Filter = request =>
36+
{
37+
receivedRequest.SetResult(true);
38+
return true;
3939
},
40-
});
41-
42-
var document = await BrowsingContext.New(config).OpenAsync(m => m.Content("<!doctype html><link rel=import href='data:text/html,<div>foo</div>'>"));
43-
var link = document.QuerySelector<IHtmlLinkElement>("link");
44-
await receivedRequest.Task;
45-
46-
Assert.AreEqual("import", link.Relation);
47-
Assert.IsNotNull(link.Import);
48-
Assert.AreEqual("foo", link.Import.QuerySelector("div").TextContent);
49-
}
50-
}
51-
}
40+
});
41+
42+
var document = await BrowsingContext.New(config).OpenAsync(m => m.Content("<!doctype html><link rel=import href='data:text/html,<div>foo</div>'>"));
43+
var link = document.QuerySelector<IHtmlLinkElement>("link");
44+
await receivedRequest.Task;
45+
46+
Assert.AreEqual("import", link.Relation);
47+
Assert.IsNotNull(link.Import);
48+
Assert.AreEqual("foo", link.Import.QuerySelector("div").TextContent);
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)