aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Controllers/UserControllerTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-01-18 00:50:31 +0800
committercrupest <crupest@outlook.com>2020-01-18 00:50:31 +0800
commit4ec507df6251bc1dae5204fdc6aaf14ddbb268f6 (patch)
tree8479cc9af91a7e7b1c0c60a0abc778244359bdbd /Timeline.Tests/Controllers/UserControllerTest.cs
parent631731e5c2253116a53fdc435afca184251a34fc (diff)
downloadtimeline-4ec507df6251bc1dae5204fdc6aaf14ddbb268f6.tar.gz
timeline-4ec507df6251bc1dae5204fdc6aaf14ddbb268f6.tar.bz2
timeline-4ec507df6251bc1dae5204fdc6aaf14ddbb268f6.zip
...
Diffstat (limited to 'Timeline.Tests/Controllers/UserControllerTest.cs')
-rw-r--r--Timeline.Tests/Controllers/UserControllerTest.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Timeline.Tests/Controllers/UserControllerTest.cs b/Timeline.Tests/Controllers/UserControllerTest.cs
index a5ca7a2b..7a6541fb 100644
--- a/Timeline.Tests/Controllers/UserControllerTest.cs
+++ b/Timeline.Tests/Controllers/UserControllerTest.cs
@@ -13,7 +13,8 @@ using Timeline.Models.Http;
using Timeline.Services;
using Timeline.Tests.Helpers;
using Xunit;
-using static Timeline.ErrorCodes.Http.User;
+using static Timeline.ErrorCodes.User;
+using static Timeline.ErrorCodes.UserCommon;
namespace Timeline.Tests.Controllers
{
@@ -61,7 +62,7 @@ namespace Timeline.Tests.Controllers
var action = await _controller.Get(username);
action.Result.Should().BeAssignableTo<NotFoundObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Get.NotExist);
+ .Which.Code.Should().Be(UserNotExist);
}
[Theory]
@@ -114,7 +115,7 @@ namespace Timeline.Tests.Controllers
}, username);
action.Should().BeAssignableTo<NotFoundObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Patch.NotExist);
+ .Which.Code.Should().Be(UserNotExist);
}
[Fact]
@@ -154,8 +155,8 @@ namespace Timeline.Tests.Controllers
}
[Theory]
- [InlineData(typeof(UserNotExistException), Op.ChangeUsername.NotExist)]
- [InlineData(typeof(UsernameConfictException), Op.ChangeUsername.AlreadyExist)]
+ [InlineData(typeof(UserNotExistException), UserNotExist)]
+ [InlineData(typeof(UsernameConfictException), ChangeUsername_Conflict)]
public async Task Op_ChangeUsername_Failure(Type exceptionType, int code)
{
const string oldUsername = "aaa";
@@ -212,7 +213,7 @@ namespace Timeline.Tests.Controllers
var action = await _controller.ChangePassword(new ChangePasswordRequest { OldPassword = oldPassword, NewPassword = newPassword });
action.Should().BeAssignableTo<BadRequestObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(Op.ChangePassword.BadOldPassword);
+ .Which.Code.Should().Be(ChangePassword_BadOldPassword);
}
}
}