New tests.
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / Error.cs
1 /* ****************************************************************************\r
2  *\r
3  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4  *\r
5  * This software is subject to the Microsoft Public License (Ms-PL). \r
6  * A copy of the license can be found in the license.htm file included \r
7  * in this distribution.\r
8  *\r
9  * You must not remove this notice, or any other, from this software.\r
10  *\r
11  * ***************************************************************************/\r
12 \r
13 namespace System.Web.Mvc {\r
14     using System;\r
15     using System.Globalization;\r
16     using System.Web.Mvc.Async;\r
17     using System.Web.Mvc.Resources;\r
18 \r
19     internal static class Error {\r
20 \r
21         public static InvalidOperationException AsyncActionMethodSelector_CouldNotFindMethod(string methodName, Type controllerType) {\r
22             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.AsyncActionMethodSelector_CouldNotFindMethod,\r
23                 methodName, controllerType);\r
24             return new InvalidOperationException(message);\r
25         }\r
26 \r
27         public static InvalidOperationException AsyncCommon_AsyncResultAlreadyConsumed() {\r
28             return new InvalidOperationException(MvcResources.AsyncCommon_AsyncResultAlreadyConsumed);\r
29         }\r
30 \r
31         public static InvalidOperationException AsyncCommon_ControllerMustImplementIAsyncManagerContainer(Type actualControllerType) {\r
32             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.AsyncCommon_ControllerMustImplementIAsyncManagerContainer,\r
33                 actualControllerType);\r
34             return new InvalidOperationException(message);\r
35         }\r
36 \r
37         public static ArgumentException AsyncCommon_InvalidAsyncResult(string parameterName) {\r
38             return new ArgumentException(MvcResources.AsyncCommon_InvalidAsyncResult, parameterName);\r
39         }\r
40 \r
41         public static ArgumentOutOfRangeException AsyncCommon_InvalidTimeout(string parameterName) {\r
42             return new ArgumentOutOfRangeException(parameterName, MvcResources.AsyncCommon_InvalidTimeout);\r
43         }\r
44 \r
45         public static InvalidOperationException ReflectedAsyncActionDescriptor_CannotExecuteSynchronously(string actionName) {\r
46             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.ReflectedAsyncActionDescriptor_CannotExecuteSynchronously,\r
47                 actionName);\r
48             return new InvalidOperationException(message);\r
49         }\r
50 \r
51         public static InvalidOperationException ChildActionOnlyAttribute_MustBeInChildRequest(ActionDescriptor actionDescriptor) {\r
52             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.ChildActionOnlyAttribute_MustBeInChildRequest,\r
53                 actionDescriptor.ActionName);\r
54             return new InvalidOperationException(message);\r
55         }\r
56 \r
57         public static ArgumentException ParameterCannotBeNullOrEmpty(string parameterName) {\r
58             return new ArgumentException(MvcResources.Common_NullOrEmpty, parameterName);\r
59         }\r
60 \r
61         public static InvalidOperationException PropertyCannotBeNullOrEmpty(string propertyName) {\r
62             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.Common_PropertyCannotBeNullOrEmpty,\r
63                 propertyName);\r
64             return new InvalidOperationException(message);\r
65         }\r
66 \r
67         public static SynchronousOperationException SynchronizationContextUtil_ExceptionThrown(Exception innerException) {\r
68             return new SynchronousOperationException(MvcResources.SynchronizationContextUtil_ExceptionThrown, innerException);\r
69         }\r
70 \r
71         public static InvalidOperationException ViewDataDictionary_WrongTModelType(Type valueType, Type modelType) {\r
72             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.ViewDataDictionary_WrongTModelType,\r
73                 valueType, modelType);\r
74             return new InvalidOperationException(message);\r
75         }\r
76 \r
77         public static InvalidOperationException ViewDataDictionary_ModelCannotBeNull(Type modelType) {\r
78             string message = String.Format(CultureInfo.CurrentUICulture, MvcResources.ViewDataDictionary_ModelCannotBeNull,\r
79                 modelType);\r
80             return new InvalidOperationException(message);\r
81         }\r
82 \r
83     }\r
84 }\r