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
commit12410a51fb2e5f55e8d83415bc3c4053a146ce3b (patch)
tree920ef556df34e0d69d990f8bf3ef2fdce13f9f46 /Timeline.Tests/Services/TimelineServiceTest.cs
parentc10dc9e221317ea39f9ce0f172670ffbe94e6f8a (diff)
downloadtimeline-12410a51fb2e5f55e8d83415bc3c4053a146ce3b.tar.gz
timeline-12410a51fb2e5f55e8d83415bc3c4053a146ce3b.tar.bz2
timeline-12410a51fb2e5f55e8d83415bc3c4053a146ce3b.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();