aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Controllers
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-31 00:56:46 +0800
committer杨宇千 <crupest@outlook.com>2019-10-31 00:56:46 +0800
commitd3a1bf5f2939049f11e77f91ad9ddea30d8acd64 (patch)
tree7d034bb824b50d892136c6f1225a15e8baa30741 /Timeline.Tests/Controllers
parent006d799d2fe5f081c188f95a8590c4b75a93caae (diff)
downloadtimeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.tar.gz
timeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.tar.bz2
timeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.zip
Continue to construct feature and tests.
Diffstat (limited to 'Timeline.Tests/Controllers')
-rw-r--r--Timeline.Tests/Controllers/UserControllerTest.cs1
-rw-r--r--Timeline.Tests/Controllers/UserDetailControllerTest.cs5
2 files changed, 5 insertions, 1 deletions
diff --git a/Timeline.Tests/Controllers/UserControllerTest.cs b/Timeline.Tests/Controllers/UserControllerTest.cs
index a9cce970..83b8cdcf 100644
--- a/Timeline.Tests/Controllers/UserControllerTest.cs
+++ b/Timeline.Tests/Controllers/UserControllerTest.cs
@@ -13,7 +13,6 @@ using Timeline.Models.Http;
using Timeline.Services;
using Timeline.Tests.Helpers;
using Timeline.Tests.Mock.Data;
-using Timeline.Tests.Mock.Services;
using Xunit;
using static Timeline.ErrorCodes.Http.User;
diff --git a/Timeline.Tests/Controllers/UserDetailControllerTest.cs b/Timeline.Tests/Controllers/UserDetailControllerTest.cs
index 99341c40..ffd88790 100644
--- a/Timeline.Tests/Controllers/UserDetailControllerTest.cs
+++ b/Timeline.Tests/Controllers/UserDetailControllerTest.cs
@@ -1,4 +1,5 @@
using FluentAssertions;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Moq;
using System;
@@ -42,6 +43,8 @@ namespace Timeline.Tests.Controllers
var putNickname = typeof(UserDetailController).GetMethod(nameof(UserDetailController.PutNickname));
putNickname.Should().BeDecoratedWith<HttpPutAttribute>()
+ .And.BeDecoratedWith<AuthorizeAttribute>()
+ .And.BeDecoratedWith<SelfOrAdminAttribute>()
.And.BeDecoratedWith<CatchUserNotExistExceptionAttribute>();
putNickname.GetParameter("username").Should().BeDecoratedWith<UsernameAttribute>()
.And.BeDecoratedWith<FromRouteAttribute>();
@@ -53,6 +56,8 @@ namespace Timeline.Tests.Controllers
var deleteNickname = typeof(UserDetailController).GetMethod(nameof(UserDetailController.DeleteNickname));
deleteNickname.Should().BeDecoratedWith<HttpDeleteAttribute>()
+ .And.BeDecoratedWith<AuthorizeAttribute>()
+ .And.BeDecoratedWith<SelfOrAdminAttribute>()
.And.BeDecoratedWith<CatchUserNotExistExceptionAttribute>();
deleteNickname.GetParameter("username").Should().BeDecoratedWith<UsernameAttribute>()
.And.BeDecoratedWith<FromRouteAttribute>();