-
-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathtest_null_url.cs
More file actions
57 lines (52 loc) · 1.71 KB
/
test_null_url.cs
File metadata and controls
57 lines (52 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using Akavache;
using Akavache.SystemTextJson;
// Simple test to see what error we get with null URL
class Program
{
static void Main()
{
var serializer = new SystemJsonSerializer();
var cache = new InMemoryBlobCache(serializer);
try
{
// Test string URL null
cache.LoadImageBytesFromUrl((string)null!);
Console.WriteLine("No exception thrown for null string URL");
}
catch (Exception ex)
{
Console.WriteLine($"Exception for null string URL: {ex.GetType().Name}: {ex.Message}");
}
try
{
// Test Uri URL null
cache.LoadImageBytesFromUrl((Uri)null!);
Console.WriteLine("No exception thrown for null Uri URL");
}
catch (Exception ex)
{
Console.WriteLine($"Exception for null Uri URL: {ex.GetType().Name}: {ex.Message}");
}
try
{
// Test with key and null string URL
cache.LoadImageBytesFromUrl("key", (string)null!);
Console.WriteLine("No exception thrown for null string URL with key");
}
catch (Exception ex)
{
Console.WriteLine($"Exception for null string URL with key: {ex.GetType().Name}: {ex.Message}");
}
try
{
// Test with key and null Uri URL
cache.LoadImageBytesFromUrl("key", (Uri)null!);
Console.WriteLine("No exception thrown for null Uri URL with key");
}
catch (Exception ex)
{
Console.WriteLine($"Exception for null Uri URL with key: {ex.GetType().Name}: {ex.Message}");
}
}
}