回答編集履歴

1

修正

2020/08/11 04:23

投稿

退会済みユーザー
test CHANGED
@@ -40,52 +40,54 @@
40
40
 
41
41
  namespace Test.Tests.Common {
42
42
 
43
+
43
44
 
44
-
45
- internal static class MockHttpContext {
45
+ internal static class MockHttpContext {
46
46
 
47
47
 
48
48
 
49
- public static Mock<HttpContextBase> getMockHttpContext() {
49
+ public static Mock<HttpContextBase> getMockHttpContext() {
50
50
 
51
51
 
52
52
 
53
- var httpContext = new Mock<HttpContextBase>();
53
+ var httpContext = new Mock<HttpContextBase>();
54
54
 
55
55
 
56
56
 
57
- // Principal
57
+ // Principal
58
58
 
59
- GenericIdentity identity = new GenericIdentity("管理者");
59
+ GenericIdentity identity = new GenericIdentity("管理者");
60
60
 
61
- GenericPrincipal principal = new GenericPrincipal(identity, new string[] { "Administrator" });
61
+ GenericPrincipal principal = new GenericPrincipal(identity, new string[] { "Administrator" });
62
62
 
63
- httpContext.SetupGet(e => e.User).Returns(principal);
63
+ httpContext.SetupGet(e => e.User).Returns(principal);
64
64
 
65
65
 
66
66
 
67
- // Request
67
+ // Request
68
68
 
69
- var request = new Mock<HttpRequestBase>();
69
+ var request = new Mock<HttpRequestBase>();
70
70
 
71
- request.SetupGet(e => e.Headers).Returns(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } });
71
+ request.SetupGet(e => e.Headers).Returns(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } });
72
72
 
73
- httpContext.SetupGet(e => e.Request).Returns(request.Object);
73
+ httpContext.SetupGet(e => e.Request).Returns(request.Object);
74
74
 
75
75
 
76
76
 
77
- // Response
77
+ // Response
78
78
 
79
- var response = new Mock<HttpResponseBase>();
79
+ var response = new Mock<HttpResponseBase>();
80
80
 
81
- httpContext.SetupGet(x => x.Response).Returns(response.Object);
81
+ httpContext.SetupGet(x => x.Response).Returns(response.Object);
82
82
 
83
83
 
84
84
 
85
- return httpContext;
85
+ return httpContext;
86
+
87
+ }
88
+
89
+ }
86
90
 
87
91
  }
88
92
 
89
- }
93
+ ```
90
-
91
- }