mirror of https://github.com/abpframework/eventhub
3 changed files with 62 additions and 29 deletions
@ -1,29 +0,0 @@ |
|||
using System; |
|||
using Shouldly; |
|||
using Volo.Abp; |
|||
using Xunit; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class EventTests |
|||
{ |
|||
[Fact] |
|||
public void Should_Not_Allow_End_Time_To_Be_Earlier_Than_Start_Time() |
|||
{ |
|||
var exception = Assert.Throws<BusinessException>(() => |
|||
{ |
|||
new Event( |
|||
Guid.NewGuid(), |
|||
Guid.NewGuid(), |
|||
"1a8j3v0d", |
|||
"Introduction to the ABP Framework", |
|||
DateTime.Now, |
|||
DateTime.Now.AddDays(-2), |
|||
"In this event, we will introduce the ABP Framework and explore the fundamental features." |
|||
); |
|||
}); |
|||
|
|||
exception.Code.ShouldBe(EventHubErrorCodes.EventEndTimeCantBeEarlierThanStartTime); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class EventUrlHelper_Tests |
|||
{ |
|||
[Theory] |
|||
[InlineData("Introducing ABP Framework!", "introducing-abp-framework")] |
|||
[InlineData("Blazor: UI Messages", "blazor-ui-messages")] |
|||
[InlineData("What's new in .NET 6", "whats-new-in-net-6")] |
|||
public void Should_Convert_Title_To_Proper_Urls(string title, string url) |
|||
{ |
|||
var result = EventUrlHelper.ConvertTitleToUrlPart(title); |
|||
result.ShouldBe(url); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using Shouldly; |
|||
using Volo.Abp; |
|||
using Xunit; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class Event_Tests |
|||
{ |
|||
[Fact] |
|||
public void Should_Create_A_Valid_Event() |
|||
{ |
|||
new Event( |
|||
Guid.NewGuid(), |
|||
Guid.NewGuid(), |
|||
"1a8j3v0d", |
|||
"Introduction to the ABP Framework", |
|||
DateTime.Now, |
|||
DateTime.Now.AddHours(2), |
|||
"In this event, we will introduce the ABP Framework..." |
|||
); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Not_Allow_End_Time_Earlier_Than_Start_Time() |
|||
{ |
|||
var exception = Assert.Throws<BusinessException>(() => |
|||
{ |
|||
new Event( |
|||
Guid.NewGuid(), |
|||
Guid.NewGuid(), |
|||
"1a8j3v0d", |
|||
"Introduction to the ABP Framework", |
|||
DateTime.Now, |
|||
DateTime.Now.AddDays(-2), |
|||
"In this event, we will introduce the ABP Framework..." |
|||
); |
|||
}); |
|||
|
|||
exception.Code.ShouldBe( |
|||
EventHubErrorCodes.EventEndTimeCantBeEarlierThanStartTime); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue