Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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());
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        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>();
            }
        }
Ejemplo n.º 8
0
        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>();
            }
        }
Ejemplo n.º 9
0
        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>();
            }
        }
Ejemplo n.º 10
0
        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> >();
            }
        }
Ejemplo n.º 11
0
        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();
            }
        }
Ejemplo n.º 12
0
        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);
            }
        }
Ejemplo n.º 13
0
        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"));
            }
        }
Ejemplo n.º 14
0
        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();
            }
        }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        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);
            }
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
        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);
            }
        }