回答編集履歴
4
修正
answer
CHANGED
@@ -29,11 +29,6 @@
|
|
29
29
|
this._loggerMock = new Mock<ILogger<TestsController>>();
|
30
30
|
this._userCheckServiceMock = new Mock<IUserCheckService>();
|
31
31
|
|
32
|
-
this._user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] {
|
33
|
-
new Claim(ClaimTypes.Name, "Administrator"),
|
34
|
-
new Claim(ClaimTypes.Role, "Administrator")
|
35
|
-
}, "mock"));
|
36
|
-
|
37
32
|
// nullまたは空オブジェクトではだめで、It.IsAny<T>()を使うことで解決しました。
|
38
33
|
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(It.IsAny<ClaimsPrincipal>, It.IsAny<Project>())).ReturnsAsync(true);
|
39
34
|
|
@@ -42,6 +37,12 @@
|
|
42
37
|
this._userCheckServiceMock.Object
|
43
38
|
);
|
44
39
|
|
40
|
+
// ダミーのUserはこれで対応
|
41
|
+
this._user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] {
|
42
|
+
new Claim(ClaimTypes.Name, "Administrator"),
|
43
|
+
new Claim(ClaimTypes.Role, "Administrator")
|
44
|
+
}, "mock"));
|
45
|
+
|
45
46
|
this._controller.ControllerContext = new ControllerContext() {
|
46
47
|
HttpContext = new DefaultHttpContext() { User = this._user }
|
47
48
|
};
|
3
修正
answer
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
}, "mock"));
|
36
36
|
|
37
37
|
// nullまたは空オブジェクトではだめで、It.IsAny<T>()を使うことで解決しました。
|
38
|
-
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(
|
38
|
+
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(It.IsAny<ClaimsPrincipal>, It.IsAny<Project>())).ReturnsAsync(true);
|
39
39
|
|
40
40
|
this._controller = new TestsController(
|
41
41
|
this._loggerMock.Object,
|
2
修正
answer
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
private TestsController _controller = null;
|
27
27
|
|
28
28
|
public TestsControllerTest() {
|
29
|
-
this._loggerMock = new Mock<ILogger<
|
29
|
+
this._loggerMock = new Mock<ILogger<TestsController>>();
|
30
30
|
this._userCheckServiceMock = new Mock<IUserCheckService>();
|
31
31
|
|
32
32
|
this._user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] {
|
@@ -37,7 +37,7 @@
|
|
37
37
|
// nullまたは空オブジェクトではだめで、It.IsAny<T>()を使うことで解決しました。
|
38
38
|
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(this._user, It.IsAny<Project>())).ReturnsAsync(true);
|
39
39
|
|
40
|
-
this._controller = new
|
40
|
+
this._controller = new TestsController(
|
41
41
|
this._loggerMock.Object,
|
42
42
|
this._userCheckServiceMock.Object
|
43
43
|
);
|
1
修正
answer
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
}, "mock"));
|
36
36
|
|
37
37
|
// nullまたは空オブジェクトではだめで、It.IsAny<T>()を使うことで解決しました。
|
38
|
-
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(this._user,
|
38
|
+
this._userCheckServiceMock.Setup(e => e.IsCheckedAsync(this._user, It.IsAny<Project>())).ReturnsAsync(true);
|
39
39
|
|
40
40
|
this._controller = new PartsInformationsController(
|
41
41
|
this._loggerMock.Object,
|