Skip to content

Commit dcdf152

Browse files
committed
Added more tests and finished cookiecontainer
1 parent c9f0b82 commit dcdf152

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/AngleSharp.Io/Cookie/AdvancedCookieProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace AngleSharp.Io.Cookie
1515
/// </summary>
1616
public class AdvancedCookieProvider : ICookieProvider
1717
{
18-
private readonly IFileHandler _handler;
18+
private readonly ICookieFileHandler _handler;
1919
private readonly Boolean _forceParse;
2020
private readonly Boolean _httpOnlyExtension;
2121
private readonly List<WebCookie> _cookies;
@@ -25,7 +25,7 @@ public class AdvancedCookieProvider : ICookieProvider
2525
/// </summary>
2626
/// <param name="handler">The handler responsible for file system interaction.</param>
2727
/// <param name="options">The options to use for the cookie provider.</param>
28-
public AdvancedCookieProvider(IFileHandler handler, AdvancedCookieProviderOptions options = default)
28+
public AdvancedCookieProvider(ICookieFileHandler handler, AdvancedCookieProviderOptions options = default)
2929
{
3030
_handler = handler;
3131
_forceParse = options.IsForceParse;

src/AngleSharp.Io/Cookie/IFileHandler.cs renamed to src/AngleSharp.Io/Cookie/ICookieFileHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace AngleSharp.Io.Cookie
55
/// <summary>
66
/// Represents a file handler.
77
/// </summary>
8-
public interface IFileHandler
8+
public interface ICookieFileHandler
99
{
1010
/// <summary>
1111
/// Reads the (text) content from the file.

src/AngleSharp.Io/Cookie/LocalFileHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace AngleSharp.Io.Cookie
77
/// Represents a file handler against the local
88
/// file system.
99
/// </summary>
10-
public class LocalFileHandler : IFileHandler
10+
public class LocalFileHandler : ICookieFileHandler
1111
{
1212
private readonly String _filePath;
1313

@@ -17,9 +17,9 @@ public class LocalFileHandler : IFileHandler
1717
/// <param name="filePath">The path to resolve to.</param>
1818
public LocalFileHandler(String filePath) => _filePath = filePath;
1919

20-
String IFileHandler.ReadFile() => File.ReadAllText(_filePath);
20+
String ICookieFileHandler.ReadFile() => File.ReadAllText(_filePath);
2121

22-
void IFileHandler.WriteFile(String content)
22+
void ICookieFileHandler.WriteFile(String content)
2323
{
2424
//TODO Replace with queued async method
2525
File.WriteAllText(_filePath, content);

src/AngleSharp.Io/Cookie/MemoryFileHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace AngleSharp.Io.Cookie
66
/// A memory file handler to feed the cookie provider.
77
/// Ideal for testing and sandboxed ("private") browsing.
88
/// </summary>
9-
public class MemoryFileHandler : IFileHandler
9+
public class MemoryFileHandler : ICookieFileHandler
1010
{
1111
private String _content;
1212

@@ -17,8 +17,8 @@ public class MemoryFileHandler : IFileHandler
1717
/// <param name="initialContent">The optional initial content.</param>
1818
public MemoryFileHandler(String initialContent = "") => _content = initialContent;
1919

20-
String IFileHandler.ReadFile() => _content;
20+
String ICookieFileHandler.ReadFile() => _content;
2121

22-
void IFileHandler.WriteFile(String content) => _content = content;
22+
void ICookieFileHandler.WriteFile(String content) => _content = content;
2323
}
2424
}

src/AngleSharp.Io/IoConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static IConfiguration WithTemporaryCookies(this IConfiguration configurat
120120
/// <param name="configuration">The configuration to extend.</param>
121121
/// <param name="fileHandler">The handler for the cookie source.</param>
122122
/// <returns>The new instance with the service.</returns>
123-
public static IConfiguration WithCookies(this IConfiguration configuration, IFileHandler fileHandler) =>
123+
public static IConfiguration WithCookies(this IConfiguration configuration, ICookieFileHandler fileHandler) =>
124124
configuration.WithCookies(new AdvancedCookieProvider(fileHandler));
125125

126126
/// <summary>

0 commit comments

Comments
 (0)