-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy pathResourceFakes.cs
88 lines (75 loc) · 2.75 KB
/
ResourceFakes.cs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
namespace CommandLine.Tests.Fakes
{
public static class StaticResource
{
public static string HelpText { get { return "Localized HelpText"; } }
public static TypeWithImplicitCast ImplicitCastHelpText => new TypeWithImplicitCast("Localized HelpText");
public static TypeWithExplicitCast ExplicitCastHelpText => new TypeWithExplicitCast("Localized HelpText");
public static TypeWithWrongImplicitCast WrongImplicitCastHelpText => new TypeWithWrongImplicitCast();
public static TypeWithWrongExplicitCast WrongExplicitCastHelpText => new TypeWithWrongExplicitCast();
}
public class NonStaticResource
{
public static string HelpText { get { return "Localized HelpText"; } }
public static string WriteOnlyText { set { value?.ToString(); } }
private static string PrivateHelpText { get { return "Localized HelpText"; } }
public static TypeWithImplicitCast ImplicitCastHelpText => new TypeWithImplicitCast("Localized HelpText");
public static TypeWithExplicitCast ExplicitCastHelpText => new TypeWithExplicitCast("Localized HelpText");
public static TypeWithWrongImplicitCast WrongImplicitCastHelpText => new TypeWithWrongImplicitCast();
public static TypeWithWrongExplicitCast WrongExplicitCastHelpText => new TypeWithWrongExplicitCast();
}
public class NonStaticResource_WithNonStaticProperty
{
public string HelpText { get { return "Localized HelpText"; } }
}
internal class InternalResource
{
public static string HelpText { get { return "Localized HelpText"; } }
}
public class TypeWithImplicitCast
{
private string value;
public TypeWithImplicitCast(string value)
{
this.value = value;
}
public static implicit operator string(TypeWithImplicitCast obj)
{
return obj.value;
}
public static implicit operator int(TypeWithImplicitCast obj)
{
return 0;
}
}
public class TypeWithWrongImplicitCast
{
public static implicit operator int(TypeWithWrongImplicitCast obj)
{
return 0;
}
}
public class TypeWithExplicitCast
{
private string value;
public TypeWithExplicitCast(string value)
{
this.value = value;
}
public static explicit operator string(TypeWithExplicitCast obj)
{
return obj.value;
}
public static explicit operator int(TypeWithExplicitCast obj)
{
return 0;
}
}
public class TypeWithWrongExplicitCast
{
public static explicit operator int(TypeWithWrongExplicitCast obj)
{
return 0;
}
}
}