aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Services/TimelineServiceTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-28 00:01:04 +0800
committercrupest <crupest@outlook.com>2020-08-28 00:01:04 +0800
commit315a5fa6eea7511618266877fca6aa1275caed1c (patch)
tree8452312130c4f763c1c30a525f0e1b1fa0e8af94 /Timeline.Tests/Services/TimelineServiceTest.cs
parentbdff6f0ad414f1ec1352d1d4e36c78e06e02ab80 (diff)
downloadtimeline-315a5fa6eea7511618266877fca6aa1275caed1c.tar.gz
timeline-315a5fa6eea7511618266877fca6aa1275caed1c.tar.bz2
timeline-315a5fa6eea7511618266877fca6aa1275caed1c.zip
Add change timeline name api to timeline controller.
Diffstat (limited to 'Timeline.Tests/Services/TimelineServiceTest.cs')
-rw-r--r--Timeline.Tests/Services/TimelineServiceTest.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Timeline.Tests/Services/TimelineServiceTest.cs b/Timeline.Tests/Services/TimelineServiceTest.cs
index 3883cda9..5a774b78 100644
--- a/Timeline.Tests/Services/TimelineServiceTest.cs
+++ b/Timeline.Tests/Services/TimelineServiceTest.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Timeline.Entities;
using Timeline.Models;
using Timeline.Services;
+using Timeline.Services.Exceptions;
using Timeline.Tests.Helpers;
using Xunit;
@@ -304,7 +305,14 @@ namespace Timeline.Tests.Services
{
_clock.ForwardCurrentTime();
+ await _timelineService.Awaiting(s => s.ChangeTimelineName("!!!", "newtl")).Should().ThrowAsync<ArgumentException>();
+ await _timelineService.Awaiting(s => s.ChangeTimelineName("tl", "!!!")).Should().ThrowAsync<ArgumentException>();
+ await _timelineService.Awaiting(s => s.ChangeTimelineName("tl", "newtl")).Should().ThrowAsync<TimelineNotExistException>();
+
await _timelineService.CreateTimeline("tl", await _userService.GetUserIdByUsername("user"));
+ await _timelineService.CreateTimeline("tl2", await _userService.GetUserIdByUsername("user"));
+
+ await _timelineService.Awaiting(s => s.ChangeTimelineName("tl", "tl2")).Should().ThrowAsync<EntityAlreadyExistException>();
var time = _clock.ForwardCurrentTime();