mirror of https://github.com/abpframework/eventhub
8 changed files with 118 additions and 8 deletions
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class EventDto : EntityDto<Guid> |
|||
{ |
|||
public Guid OrganizationId { get; set; } |
|||
|
|||
public string Title { get; set; } |
|||
|
|||
public DateTime StartTime { get; set; } |
|||
|
|||
public DateTime EndTime { get; set; } |
|||
|
|||
public string Description { get; set; } |
|||
|
|||
public bool IsOnline { get; set; } |
|||
|
|||
public int? Capacity { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EventHub.Organizations; |
|||
using Shouldly; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Xunit; |
|||
|
|||
namespace EventHub.Events |
|||
{ |
|||
public class EventManagerTests : EventHubDomainTestBase |
|||
{ |
|||
private readonly EventHubTestData _testData; |
|||
private readonly EventManager _eventManager; |
|||
private readonly IRepository<Organization, Guid> _organizationRepository; |
|||
|
|||
public EventManagerTests() |
|||
{ |
|||
_testData = GetRequiredService<EventHubTestData>(); |
|||
_eventManager = GetRequiredService<EventManager>(); |
|||
_organizationRepository = GetRequiredService<IRepository<Organization, Guid>>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Should_Create_A_Valid_Event() |
|||
{ |
|||
await WithUnitOfWorkAsync(async () => |
|||
{ |
|||
var volosoftOrganization = await _organizationRepository.GetAsync( |
|||
_testData.OrganizationVolosoftId |
|||
); |
|||
|
|||
var @event = await _eventManager.CreateAsync( |
|||
volosoftOrganization, |
|||
"Introduction to the ABP Framework", |
|||
DateTime.Now.AddDays(1), |
|||
DateTime.Now.AddDays(1).AddHours(3), |
|||
"In this event, we will introduce the ABP Framework and explore the fundamental features." |
|||
); |
|||
|
|||
@event.OrganizationId.ShouldBe(volosoftOrganization.Id); |
|||
@event.Title.ShouldBe("Introduction to the ABP Framework"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue