Skip to content

Commit 2fca155

Browse files
committed
test cases updated
1 parent c0546aa commit 2fca155

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

DigitalLearningSolutions.Web.Tests/Controllers/TrackingSystem/Delegates/DeactivateDelegateControllerTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public void Index_post_returns_error_when_no_option_selected_to_deactivate()
104104
public void Index_post_returns_view_for_deactivate_delegate_only()
105105
{
106106
// Given
107+
int? centreId = controller.User.GetCentreId();
107108
var formData = new DeactivateDelegateAccountViewModel
108109
{
109110
DelegateId = 1,
@@ -118,16 +119,21 @@ public void Index_post_returns_view_for_deactivate_delegate_only()
118119
var result = controller.Index(formData);
119120

120121
// Then
122+
A.CallTo(() => userService.DeactivateDelegateUser(DelegateId)).MustHaveHappenedOnceExactly();
123+
A.CallTo(() => userService.DeactivateAdminAccount(formData.UserId, centreId.Value)).MustNotHaveHappened();
124+
121125
result.Should().BeRedirectToActionResult()
122126
.WithControllerName("ViewDelegate")
123127
.WithActionName("Index")
124128
.WithRouteValue("delegateId", formData.DelegateId);
129+
125130
}
126131

127132
[Test]
128133
public void Index_post_returns_view_for_deactivate_delegate_and_admin()
129134
{
130135
// Given
136+
int? centreId = controller.User.GetCentreId();
131137
var formData = new DeactivateDelegateAccountViewModel
132138
{
133139
DelegateId = 1,
@@ -142,6 +148,9 @@ public void Index_post_returns_view_for_deactivate_delegate_and_admin()
142148
var result = controller.Index(formData);
143149

144150
// Then
151+
A.CallTo(() => userService.DeactivateDelegateUser(DelegateId)).MustHaveHappenedOnceExactly();
152+
A.CallTo(() => userService.DeactivateAdminAccount(formData.UserId, centreId.Value)).MustHaveHappenedOnceExactly();
153+
145154
result.Should().BeRedirectToActionResult()
146155
.WithControllerName("ViewDelegate")
147156
.WithActionName("Index")

0 commit comments

Comments
 (0)