예제 #1
0
        public async Task ShouldGetVenueById()
        {
            CreateVenues();

            VenueService    venueService    = new VenueService(_dbContext, _mainEventProvider);
            SecurityService securityService = new SecurityService(_dbContext, _userManager, _roleManager);
            VenueController venueController = new VenueController(venueService, securityService);

            SetUser(venueController, _createdUser2.Entity.Id);

            ActionResult <VenueVm> result1 = await venueController.GetVenueAsync(1);

            VenueVm returnedVenue1 = result1.Value;

            Assert.AreEqual(1, returnedVenue1.Id);
            Assert.AreEqual("Venue 1", returnedVenue1.Name);
            Assert.AreEqual("Venue gate 123", returnedVenue1.Address);
            Assert.AreEqual("1236", returnedVenue1.PostalCode);
            Assert.AreEqual("12345678", returnedVenue1.ContactPhone);
            Assert.AreEqual("*****@*****.**", returnedVenue1.ContactEMail);

            ActionResult <VenueVm> result2 = await venueController.GetVenueAsync(2);

            VenueVm returnedVenue2 = result2.Value;

            Assert.AreEqual(2, returnedVenue2.Id);
            Assert.AreEqual(_venueName2, returnedVenue2.Name);
            Assert.AreEqual(_venueAddress2, returnedVenue2.Address);
            Assert.AreEqual(_postalCode2, returnedVenue2.PostalCode);
            Assert.AreEqual(_contactPhone2, returnedVenue2.ContactPhone);
            Assert.AreEqual(_contactEMail2, returnedVenue2.ContactEMail);
        }
예제 #2
0
 public PhishinImporter(
     DbService db,
     VenueService venueService,
     TourService tourService,
     SourceService sourceService,
     SourceSetService sourceSetService,
     SourceReviewService sourceReviewService,
     SourceTrackService sourceTrackService,
     SetlistSongService setlistSongService,
     SetlistShowService setlistShowService,
     EraService eraService,
     ILogger <PhishinImporter> log
     ) : base(db)
 {
     this._setlistSongService = setlistSongService;
     this._setlistShowService = setlistShowService;
     this._sourceService      = sourceService;
     this._venueService       = venueService;
     this._tourService        = tourService;
     this._log            = log;
     _sourceReviewService = sourceReviewService;
     _sourceTrackService  = sourceTrackService;
     _sourceSetService    = sourceSetService;
     _eraService          = eraService;
 }
예제 #3
0
        public async Task ShouldCreateVenue()
        {
            string venueName3    = "Venue name 3";
            string venueAddress3 = "Testing gate 215";


            VenueService    venueService    = new VenueService(_dbContext, _mainEventProvider);
            SecurityService securityService = new SecurityService(_dbContext, _userManager, _roleManager);
            VenueController venueController = new VenueController(venueService, securityService);

            CreateUser();
            CreateVenues();
            SetUser(venueController, _createdUser2.Entity.Id);


            VenueVm venueVm = new VenueVm {
                Name = venueName3, Address = venueAddress3, PostalCode = "0258", ContactEMail = "*****@*****.**", ContactPhone = "1234578", OrganizerId = 2
            };

            await venueController.CreateVenueAsync(venueVm);

            ActionResult <List <VenueListVm> > result = await venueController.GetVenuesAsync();

            List <VenueListVm> venues = (List <VenueListVm>)((OkObjectResult)result.Result).Value;
            Venue createdVenue        = _dbContext.Venues.Find(3);

            Assert.AreEqual(3, venues.Count);
            Assert.That(venues, Has.Exactly(1).Matches <VenueListVm>(venue => venue.Id == createdVenue.Id &&
                                                                     venue.Name == createdVenue.Name &&
                                                                     venue.Address == createdVenue.Address
                                                                     ));
        }
예제 #4
0
        public async Task ShouldUpdateVenue()
        {
            string newVenueName    = "Venue name ";
            string newVenueAddress = "Testing gate 216";

            VenueService    venueService    = new VenueService(_dbContext, _mainEventProvider);
            SecurityService securityService = new SecurityService(_dbContext, _userManager, _roleManager);
            VenueController venueController = new VenueController(venueService, securityService);

            CreateUser();
            CreateVenues();
            SetUser(venueController, _createdUser.Entity.Id);

            VenueVm venueVm = new VenueVm {
                Id = 2, Name = newVenueName, Address = newVenueAddress, PostalCode = _postalCode2, ContactEMail = _contactEMail2, ContactPhone = _contactPhone2, OrganizerId = 2
            };

            await venueController.UpdateVenueAsync(venueVm);

            // Check that only one has been changed
            Venue venue2 = _dbContext.Venues.Find(2);

            Assert.AreEqual(newVenueName, venue2.Name);
            Assert.AreEqual(newVenueAddress, venue2.Address);
        }
        public IHttpActionResult Get(string state)
        {
            VenueService venueService = CreateVenueService();
            var          venue        = venueService.GetVenueByState(state);

            return(Ok(venue));
        }
        private VenueService CreateVenueService()
        {
            var userId       = Guid.Parse(User.Identity.GetUserId());
            var venueService = new VenueService(userId);

            return(venueService);
        }
        public IHttpActionResult Get()
        {
            VenueService venueService = CreateVenueService();
            var          venue        = venueService.GetVenues();

            return(Ok(venue));
        }
        public IHttpActionResult GetbyId(int id)
        {
            VenueService venueService = CreateVenueService();
            var          venue        = venueService.GetVenueById(id);

            return(Ok(venue));
        }
예제 #9
0
        public async Task <IHttpActionResult> PostVenue(VenueResource venue)
        {
            var venueService = new VenueService();
            await venueService.CreateVenue(venue);

            return(Ok(venue));
        }
예제 #10
0
        private VenueService CreateVenueService()
        {
            //var userID = Guid.Parse(User.Identity.GetUserId());
            var service = new VenueService();

            return(service);
        }
예제 #11
0
 public VenuesController(IAuthorizationService authorizationService, ClassroomService classroomService, LessonService lessonService, VenueService venueService)
 {
     _authorizationService = authorizationService;
     _classroomService     = classroomService;
     _lessonService        = lessonService;
     _venueService         = venueService;
 }
예제 #12
0
        public PhishinImporter(
            DbService db,
            VenueService venueService,
            TourService tourService,
            SourceService sourceService,
            SourceSetService sourceSetService,
            SourceReviewService sourceReviewService,
            SourceTrackService sourceTrackService,
            SetlistSongService setlistSongService,
            LinkService linkService,
            SetlistShowService setlistShowService,
            EraService eraService,
            ILogger <PhishinImporter> log,
            IConfiguration configuration
            ) : base(db)
        {
            this.linkService         = linkService;
            this._setlistSongService = setlistSongService;
            this._setlistShowService = setlistShowService;
            this._sourceService      = sourceService;
            this._venueService       = venueService;
            this._tourService        = tourService;
            this._log            = log;
            _configuration       = configuration;
            _sourceReviewService = sourceReviewService;
            _sourceTrackService  = sourceTrackService;
            _sourceSetService    = sourceSetService;
            _eraService          = eraService;
            _configuration       = configuration;

            http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", configuration["PHISHIN_KEY"]);
        }
예제 #13
0
 /// <summary>
 /// Construct a participant from a VenueService.Participant
 /// </summary>
 /// <param name="participant">VenueService.Participant</param>
 /// <param name="venue"></param>
 internal Participant(VenueService.Participant participant)
 {
     identifier = participant.Identifier;
     name = participant.Name;
     email = participant.Email;
     icon = Utilities.ByteToBitmap(participant.Icon);
     role = ParticipantRole.Other;
 }
예제 #14
0
        // GET: Venue
        public ActionResult Index()
        {
            //var userID = Guid.Parse(User.Identity.GetUserId());
            var service = new VenueService();
            var model   = service.GetVenues();

            return(View(model));
        }
예제 #15
0
        public static IVenueService GetService()
        {
            var           logger   = Microsoft.Extensions.Logging.Abstractions.NullLogger <VenueService> .Instance;
            var           settings = TestConfig.GetSettings <VenueServiceSettings>("VenueServiceSettings");
            IVenueService service  = new VenueService(logger, Options.Create(settings));

            return(service);
        }
예제 #16
0
        public void CreateVenueTest()
        {
            List <Venue> venues = new List <Venue>();

            venues.Add(new Venue {
                Id = 1, Address = "a", Description = "d"
            });
            venues.Add(new Venue {
                Id = 2, Address = "a2", Description = "d2"
            });
            venues.Add(new Venue {
                Id = 3, Address = "a3", Description = "d3"
            });

            VenueDto venueCreate_service = new VenueDto {
                Address = "a4", Description = "d4"
            };
            Venue venuePost = new Venue {
                Id = 4, Address = "a4", Description = "d4"
            };
            VenueDto venuePost_service = new VenueDto {
                Id = 4, Address = "a4", Description = "d4"
            };

            Mock <IVenueRepository> mockVenueRepository = new Mock <IVenueRepository>();

            mockVenueRepository.Setup(x => x.GetAll()).Returns(venues);
            mockVenueRepository.Setup(x => x.Create(It.IsAny <Venue>())).Returns(venuePost);

            Mock <ISeatService> mockSeatService = new Mock <ISeatService>();

            mockSeatService.Setup(x => x.CreateSeat(It.IsAny <SeatDto>()))
            .Returns(new SeatDto {
                Id = 1
            });

            Mock <ITMLayoutService> mockTMLayoutService = new Mock <ITMLayoutService>();

            mockTMLayoutService.Setup(x => x.CreateTMLayout(It.IsAny <TMLayoutDto>()))
            .Returns(new TMLayoutDto {
                Id = 1
            });

            Mock <IAreaService> mockAreaService = new Mock <IAreaService>();

            mockAreaService.Setup(x => x.CreateArea(It.IsAny <AreaDto>()))
            .Returns(new AreaDto {
                Id = 1
            });

            VenueService venueService = new VenueService(mockVenueRepository.Object,
                                                         mockTMLayoutService.Object, mockAreaService.Object, mockSeatService.Object);

            VenueDto venue = venueService.CreateVenue(venueCreate_service);

            venue.Should().BeEquivalentTo(venuePost_service);
        }
예제 #17
0
        //Get: Create Venue
        public ActionResult Create()
        {
            var service = new VenueService();

            // var model = service.GetVenues();

            //    ViewBag.VenueType = new SelectList();
            return(View());
        }
예제 #18
0
        internal Venue(VenueService.Venue v)
        {
            identifier = v.Identifier;
            name = v.Name;
            icon = Utilities.ByteToBitmap(v.Icon);

            // Trim the IPAddress, because whitespace isn't handled in .NET 2.0, but was in .NET 1.1
            string trimmedIP = v.IPAddress.Trim();
            endPoint = new IPEndPoint(IPAddress.Parse(trimmedIP), v.Port);
        }
예제 #19
0
 public VenuesController(
     RedisService redis,
     DbService db,
     ArtistService artistService,
     VenueService venueService,
     ShowService showService
     ) : base(redis, db, artistService)
 {
     _venueService = venueService;
     _showService  = showService;
 }
예제 #20
0
 public DataProvider(TicketManagementContext context)
 {
     Context          = context;
     VenueManager     = new VenueService(new EntityVenueRepository(context));
     LayoutManager    = new LayoutService(new EntityLayoutRepository(context));
     AreaManager      = new AreaService(new EntityAreaRepository(context));
     SeatManager      = new SeatService(new EntitySeatRepository(context));
     EventManager     = new EventService(new EntityEventRepository(context), new EntityProcedureManager(context));
     EventSeatService = new EventSeatService(new EntityEventSeatRepository(context));
     EventAreaService = new EventAreaService(new EntityEventAreaRepository(context));
 }
예제 #21
0
        public DataProvider()
        {
            VenueManager  = new VenueService(new FakeVenueRepo());
            LayoutManager = new LayoutService(new FakeLayoutRepo());
            AreaManager   = new AreaService(new FakeAreaRepo());
            SeatManager   = new SeatService(new FakeSeatRepo());
            var eventRepo = new FakeEventRepo();

            EventManager     = new EventService(eventRepo, new FakePropcedureManager(eventRepo));
            EventAreaService = new EventAreaService(new FakeEventAreaRepo());
            EventSeatService = new EventSeatService(new FakeEventSeatRepo());
        }
예제 #22
0
        public async Task ShouldNotGetVenueWithoutPermissions()
        {
            VenueService    venueService    = new VenueService(_dbContext, _mainEventProvider);
            SecurityService securityService = new SecurityService(_dbContext, _userManager, _roleManager);
            VenueController venueController = new VenueController(venueService, securityService);

            SetUser(venueController, _createdUser2.Entity.Id);

            ActionResult <VenueVm> result = await venueController.GetVenueAsync(1);

            Assert.IsTrue(result.Result is ForbidResult);
        }
예제 #23
0
        public VenueServiceTests()
        {
            _placesApiMock               = new Mock <IPlacesApiClient>();
            _venueRepositoryMock         = new Mock <IVenueRepository>();
            _businessHoursRepositoryMock = new Mock <IBusinessHoursRepository>();
            _reviewRepositoryMock        = new Mock <IReviewRepository>();
            _locationRepositoryMock      = new Mock <ILocationRepository>();
            _venueOwnerRepositoryMock    = new Mock <IVenueOwnerRepository>();

            _sut = new VenueService(_placesApiMock.Object, _venueRepositoryMock.Object, _businessHoursRepositoryMock.Object,
                                    _reviewRepositoryMock.Object, _locationRepositoryMock.Object, _venueOwnerRepositoryMock.Object);
        }
예제 #24
0
 public PhantasyTourImporter(
     DbService db,
     VenueService venueService,
     TourService tourService,
     SetlistShowService setlistShowService,
     SetlistSongService setlistSongService
     ) : base(db)
 {
     _setlistSongService = setlistSongService;
     _setlistShowService = setlistShowService;
     _venueService       = venueService;
     _tourService        = tourService;
 }
예제 #25
0
        public void GetAllVenue()
        {
            Mock <ISeatService>     mockSeatService     = new Mock <ISeatService>();
            Mock <ITMLayoutService> mockTMLayoutService = new Mock <ITMLayoutService>();
            Mock <IAreaService>     mockAreaService     = new Mock <IAreaService>();
            Mock <IVenueRepository> mockVenueRepository = new Mock <IVenueRepository>();
            VenueService            venueService        = new VenueService(mockVenueRepository.Object,
                                                                           mockTMLayoutService.Object, mockAreaService.Object, mockSeatService.Object);

            List <VenueDto> venues = venueService.GetAllVenue();

            venues.Should().NotBeNull();
        }
예제 #26
0
        public void FilterVenuesShouldCallVenueRepositoryOnce()
        {
            var mapper           = new Mock <IMapper>();
            var mockedRepo       = new Mock <IGenericRepository <Venue> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var mockedFactoy     = new Mock <IVenueFactory>();

            mockedRepo.Setup(x => x.GetAll(It.IsAny <Expression <Func <Venue, bool> > >())).Verifiable();
            var service = new VenueService(mockedRepo.Object, mockedUnitOfWork.Object, mockedFactoy.Object);

            service.FilterVenues(It.IsAny <string>(), It.IsAny <string>());
            mockedRepo.Verify(x => x.GetAll(It.IsAny <Expression <Func <Venue, bool> > >()), Times.Once);
        }
예제 #27
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            var service = new VenueService();

            var locator = CrossGeolocator.Current;

            var position = await locator.GetPositionAsync();

            var venues = await service.GetVenuesAsync(position.Latitude, position.Longitude);

            venueList.ItemsSource = venues;
        }
예제 #28
0
        public void SetUp()
        {
            var sqlConnectionString =
                ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString;
            var context          = new MyContext(sqlConnectionString);
            var venueRepository  = new Repository <Venue>(context);
            var layoutRepository = new Repository <Layout>(context);
            var areaRepository   = new Repository <Area>(context);
            var seatRepository   = new Repository <Seat>(context);
            var mapper           = new MapperConfigurationProvider();

            _venueService = new VenueService(seatRepository, layoutRepository,
                                             venueRepository, areaRepository, mapper);
        }
예제 #29
0
        private IEnumerable <Models.Venue> FindSuggestedVenues()
        {
            var selectedCategories = Context.SearchRequest.Categories;
            var venues             = VenueService.SearchVenues(
                Context.SearchRequest);

            venues = venues.Where(x => selectedCategories.Contains(x.PrimaryCategory.RootCategory) && !Context.PlannedTrip.Contains(x));
            int i = 0;

            foreach (var venue in venues)
            {
                venue.MarkerIcon = string.Format("http://www.google.com/mapfiles/marker{0}.png", (char)('A' + i++));
            }
            return(venues);
        }
예제 #30
0
 public JerryGarciaComImporter(
     DbService db,
     SetlistShowService setlistShowService,
     VenueService venueService,
     TourService tourService,
     SetlistSongService setlistSongService,
     ILogger <JerryGarciaComImporter> log
     ) : base(db)
 {
     this._setlistShowService = setlistShowService;
     this._venueService       = venueService;
     this._tourService        = tourService;
     this._setlistSongService = setlistSongService;
     this._log = log;
 }
예제 #31
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IVenueRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Venue>(null));
            var service = new VenueService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.VenueModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLVenueMapperMock,
                                           mock.DALMapperMockFactory.DALVenueMapperMock);

            ApiVenueResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
예제 #32
0
        public async void ByProvinceId_Not_Exists()
        {
            var mock = new ServiceMockFacade <IVenueRepository>();

            mock.RepositoryMock.Setup(x => x.ByProvinceId(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <Venue> >(new List <Venue>()));
            var service = new VenueService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.VenueModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLVenueMapperMock,
                                           mock.DALMapperMockFactory.DALVenueMapperMock);

            List <ApiVenueResponseModel> response = await service.ByProvinceId(default(int));

            response.Should().BeEmpty();
            mock.RepositoryMock.Verify(x => x.ByProvinceId(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()));
        }
예제 #33
0
 public VenueManager()
 {
     if (_vs == null) _vs = new VenueService();    
 }