public static void Main(string[] args) { var service = EventServiceFactory.GetAuthenticatedService(new StaticConfiguration()); var calendars = service.GetAvailableCalendars(true); foreach (var calendar in calendars) { Console.WriteLine("\nUpcoming events for {0}:", calendar.Summary); var events = service.GetNextWeeksEvents(calendar.Id); if (events != null && events.Count > 0) { foreach (var eventItem in events) { string when = eventItem.Start.DateTime.ToString(); if (string.IsNullOrEmpty(when)) { when = eventItem.Start.Date; } Console.WriteLine("{0} - {1} ({2})", calendar.Summary, eventItem.Summary, when); } } else { Console.WriteLine("No upcoming events found."); } } Console.WriteLine("\n\nPress enter to exit"); Console.Read(); }
public void SetUp() { _factory = new InMemorySqlLiteContextFactory <TContext>(options => Activator.CreateInstance(typeof(TContext), options) as TContext); _context = _factory.CreateContext(true); _publish = Substitute.For <IPublishEndpoint>(); _authorizationService = Substitute.For <IAuthorizationService>(); _eventService = EventServiceFactory.CreateEventService(_context, _publish); }
public async Task Should_Only_Return_Online_Events() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.Search("", new List <SearchFilter>() { new() { Key = SearchParam.IsOnline, Value = "true" } }, new Guid());
public void SetUp() { var content = _factory.CreateContext(true); _publishEndpoint = Substitute.For <IPublishEndpoint>(); var eventService = EventServiceFactory.CreateEventService(content, _publishEndpoint); _consumer = new TimeslotReservationFailedEventConsumer(content, CreateMapper(), eventService); _harness.Start().Wait(); }
public void SetUp() { var content = _factory.CreateContext(true); _publishEndpoint = Substitute.For <IPublishEndpoint>(); var eventService = EventServiceFactory.CreateEventService(content, _publishEndpoint); _consumer = new VerifyChangedTimeslotEventConsumer(content, eventService); _harness.Start().Wait(); }
public void SetUp() { var content = _factory.CreateContext(true); _publishEndpoint = Substitute.For <IPublishEndpoint>(); var eventService = EventServiceFactory.CreateEventService(content, _publishEndpoint); _consumer = new ClubSubscriptionCreatedEventConsumer(content); _harness.Start().Wait(); }
public async Task ShouldNotFindEvent() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); FluentActions.Invoking(async() => await service.GetForPublic(new Guid(), new Guid())) .Should().Throw <EventNotFoundException>(); } }
public async Task ShouldGetForHost() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetForHost(new Guid("74831876-FC2E-4D03-99D8-B3872BDEFD5C")); result.Should().NotBeNull(); result.Should().BeOfType <EventHostModel>(); } }
public async Task ShouldGetForPublic() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetForPublic(RealEventId, new Guid()); result.Should().NotBeNull(); result.Should().BeOfType <EventDetailModel>(); } }
public async Task ShouldGetAllHostsEvents() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetAllHosts(new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C")); result.Should().NotBeNull(); result.Should().BeOfType <List <EventHostModel> >(); } }
public async Task Should_Get_Recommended() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetRecommended(new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C")); result.Should().NotBeNull(); result.Should().NotContainNulls(); } }
public async Task Null_Keyword_Should_Return_All() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.Search(null, new List <SearchFilter>(), new Guid()); result.Should().NotBeNull(); result.Count.Should().BeGreaterThan(2); } }
public async Task Should_Search_By_Keyword() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.Search("Test", new List <SearchFilter>(), new Guid()); result.Count().Should().BeGreaterThan(0); result.ForEach(r => r.Name.Should().Contain("Test")); } }
public async Task ShouldCancelEvent() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); await service.Cancel(RealEventId); var result = await context.Events.FirstOrDefaultAsync(x => x.Id == RealEventId); result.isCanceled.Should().BeTrue(); } }
public async Task ShouldGetAllCategories() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetAllCategories(); result.Should().NotBeNull(); result.Should().BeOfType <List <Category> >(); result.Count.Should().BeGreaterThan(1); } }
public async Task Should_Get_Analytics() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var result = await service.GetAnalytics(new Guid("74831876-FC2E-4D03-99D8-B3872BDEFD5C")); result.Should().NotBeNull(); // result.AverageRecommendationScores.Should().NotContainNulls().And.BeInDescendingOrder(); result.PageViewEvents.Should().NotContainNulls().And.BeInDescendingOrder(x => x.Created); result.TicketVerificationEvents.Should().NotContainNulls().And.BeInDescendingOrder(x => x.Created); } }
public async Task Should_Limit_Results_To_50() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); await context.Events.AddRangeAsync(EventData.FakeEvent.Generate(100).ToList()); await context.SaveChangesAsync(); var result = await service.Search("", new List <SearchFilter>(), new Guid()); result.Should().NotBeNull(); result.Count().Should().Be(50); } }
public async Task Should_Search_By_Category() { await using (var context = new DbContextFactory().CreateContext()) { var service = new EventServiceFactory().Create(context); var categoryId = context.Categories.First().Id; var searchFilters = new List <SearchFilter>() { new() { Key = SearchParam.Category, Value = categoryId.ToString() // Music category } }; var result = await service.Search("", searchFilters, new Guid()); result.Count().Should().Be(1); } }