diff options
author | crupest <crupest@outlook.com> | 2020-01-19 22:45:43 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-01-19 22:45:43 +0800 |
commit | 40eea04e1ec9b71c5215e9dce5a6963ea60cafaa (patch) | |
tree | 1fa3969a53138becb76a7eef7bafdafc7046c12c /Timeline.Tests/Controllers/UserControllerTest.cs | |
parent | 4ec507df6251bc1dae5204fdc6aaf14ddbb268f6 (diff) | |
download | timeline-40eea04e1ec9b71c5215e9dce5a6963ea60cafaa.tar.gz timeline-40eea04e1ec9b71c5215e9dce5a6963ea60cafaa.tar.bz2 timeline-40eea04e1ec9b71c5215e9dce5a6963ea60cafaa.zip |
Basically finish refactor of error codes.
Diffstat (limited to 'Timeline.Tests/Controllers/UserControllerTest.cs')
-rw-r--r-- | Timeline.Tests/Controllers/UserControllerTest.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Timeline.Tests/Controllers/UserControllerTest.cs b/Timeline.Tests/Controllers/UserControllerTest.cs index 7a6541fb..043062c3 100644 --- a/Timeline.Tests/Controllers/UserControllerTest.cs +++ b/Timeline.Tests/Controllers/UserControllerTest.cs @@ -13,8 +13,6 @@ using Timeline.Models.Http; using Timeline.Services;
using Timeline.Tests.Helpers;
using Xunit;
-using static Timeline.ErrorCodes.User;
-using static Timeline.ErrorCodes.UserCommon;
namespace Timeline.Tests.Controllers
{
@@ -62,7 +60,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(UserNotExist);
+ .Which.Code.Should().Be(ErrorCodes.UserCommon.NotExist);
}
[Theory]
@@ -115,7 +113,7 @@ namespace Timeline.Tests.Controllers }, username);
action.Should().BeAssignableTo<NotFoundObjectResult>()
.Which.Value.Should().BeAssignableTo<CommonResponse>()
- .Which.Code.Should().Be(UserNotExist);
+ .Which.Code.Should().Be(ErrorCodes.UserCommon.NotExist);
}
[Fact]
@@ -155,8 +153,8 @@ namespace Timeline.Tests.Controllers }
[Theory]
- [InlineData(typeof(UserNotExistException), UserNotExist)]
- [InlineData(typeof(UsernameConfictException), ChangeUsername_Conflict)]
+ [InlineData(typeof(UserNotExistException), ErrorCodes.UserCommon.NotExist)]
+ [InlineData(typeof(UsernameConfictException), ErrorCodes.UserController.ChangeUsername_Conflict)]
public async Task Op_ChangeUsername_Failure(Type exceptionType, int code)
{
const string oldUsername = "aaa";
@@ -213,7 +211,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(ChangePassword_BadOldPassword);
+ .Which.Code.Should().Be(ErrorCodes.UserController.ChangePassword_BadOldPassword);
}
}
}
|