HelperClasses_ITRS.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //
  2. // HelperClasses_ITRS.cs : Various ITypeResolutionService implementations
  3. // for use during testing.
  4. //
  5. // Author:
  6. // Gary Barnett ([email protected])
  7. //
  8. // Copyright (C) Gary Barnett (2012)
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. using System;
  29. using System.ComponentModel.Design;
  30. using System.Reflection;
  31. namespace MonoTests.System.Resources {
  32. public class DummyITRS : ITypeResolutionService {
  33. public Assembly GetAssembly (AssemblyName name, bool throwOnError)
  34. {
  35. return null;
  36. }
  37. public Assembly GetAssembly (AssemblyName name)
  38. {
  39. return null;
  40. }
  41. public string GetPathOfAssembly (AssemblyName name)
  42. {
  43. return null;
  44. }
  45. public Type GetType (string name, bool throwOnError, bool ignoreCase)
  46. {
  47. return null;
  48. }
  49. public Type GetType (string name, bool throwOnError)
  50. {
  51. return null;
  52. }
  53. public Type GetType (string name)
  54. {
  55. return null;
  56. }
  57. public void ReferenceAssembly (AssemblyName name)
  58. {
  59. }
  60. }
  61. public class ReturnSerializableSubClassITRS : ITypeResolutionService {
  62. public Assembly GetAssembly (AssemblyName name, bool throwOnError)
  63. {
  64. throw new NotImplementedException ("I was accessed");
  65. }
  66. public Assembly GetAssembly (AssemblyName name)
  67. {
  68. throw new NotImplementedException ("I was accessed");
  69. }
  70. public string GetPathOfAssembly (AssemblyName name)
  71. {
  72. throw new NotImplementedException ("I was accessed");
  73. }
  74. public Type GetType (string name, bool throwOnError, bool ignoreCase)
  75. {
  76. return typeof (serializableSubClass);
  77. }
  78. public Type GetType (string name, bool throwOnError)
  79. {
  80. return typeof (serializableSubClass);
  81. }
  82. public Type GetType (string name)
  83. {
  84. return typeof (serializableSubClass);
  85. }
  86. public void ReferenceAssembly (AssemblyName name)
  87. {
  88. }
  89. }
  90. public class ReturnIntITRS : ITypeResolutionService {
  91. public Assembly GetAssembly (AssemblyName name, bool throwOnError)
  92. {
  93. throw new NotImplementedException ("I was accessed");
  94. }
  95. public Assembly GetAssembly (AssemblyName name)
  96. {
  97. throw new NotImplementedException ("I was accessed");
  98. }
  99. public string GetPathOfAssembly (AssemblyName name)
  100. {
  101. throw new NotImplementedException ("I was accessed");
  102. }
  103. public Type GetType (string name, bool throwOnError, bool ignoreCase)
  104. {
  105. return typeof (Int32);
  106. }
  107. public Type GetType (string name, bool throwOnError)
  108. {
  109. return typeof (Int32);
  110. }
  111. public Type GetType (string name)
  112. {
  113. return typeof (Int32);
  114. }
  115. public void ReferenceAssembly (AssemblyName name)
  116. {
  117. }
  118. }
  119. public class ExceptionalITRS : ITypeResolutionService {
  120. public Assembly GetAssembly (AssemblyName name, bool throwOnError)
  121. {
  122. throw new NotImplementedException ("I was accessed");
  123. }
  124. public Assembly GetAssembly (AssemblyName name)
  125. {
  126. throw new NotImplementedException ("I was accessed");
  127. }
  128. public string GetPathOfAssembly (AssemblyName name)
  129. {
  130. throw new NotImplementedException ("I was accessed");
  131. }
  132. public Type GetType (string name, bool throwOnError, bool ignoreCase)
  133. {
  134. throw new NotImplementedException ("I was accessed");
  135. }
  136. public Type GetType (string name, bool throwOnError)
  137. {
  138. throw new NotImplementedException ("I was accessed");
  139. }
  140. public Type GetType (string name)
  141. {
  142. throw new NotImplementedException ("I was accessed");
  143. }
  144. public void ReferenceAssembly (AssemblyName name)
  145. {
  146. }
  147. }
  148. }