New tests.
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / ActionExecutedContext.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.Diagnostics.CodeAnalysis;\r
16 \r
17     public class ActionExecutedContext : ControllerContext {\r
18 \r
19         private ActionResult _result;\r
20 \r
21         // parameterless constructor used for mocking\r
22         public ActionExecutedContext() {\r
23         }\r
24 \r
25         [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors",\r
26             Justification = "The virtual property setters are only to support mocking frameworks, in which case this constructor shouldn't be called anyway.")]\r
27         public ActionExecutedContext(ControllerContext controllerContext, ActionDescriptor actionDescriptor, bool canceled, Exception exception)\r
28             : base(controllerContext) {\r
29             if (actionDescriptor == null) {\r
30                 throw new ArgumentNullException("actionDescriptor");\r
31             }\r
32 \r
33             ActionDescriptor = actionDescriptor;\r
34             Canceled = canceled;\r
35             Exception = exception;\r
36         }\r
37 \r
38         public virtual ActionDescriptor ActionDescriptor {\r
39             get;\r
40             set;\r
41         }\r
42 \r
43         public virtual bool Canceled {\r
44             get;\r
45             set;\r
46         }\r
47 \r
48         public virtual Exception Exception {\r
49             get;\r
50             set;\r
51         }\r
52 \r
53         public bool ExceptionHandled {\r
54             get;\r
55             set;\r
56         }\r
57 \r
58         public ActionResult Result {\r
59             get {\r
60                 return _result ?? EmptyResult.Instance;\r
61             }\r
62             set {\r
63                 _result = value;\r
64             }\r
65         }\r
66 \r
67     }\r
68 }\r