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); }
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; }
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 )); }
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)); }
public async Task <IHttpActionResult> PostVenue(VenueResource venue) { var venueService = new VenueService(); await venueService.CreateVenue(venue); return(Ok(venue)); }
private VenueService CreateVenueService() { //var userID = Guid.Parse(User.Identity.GetUserId()); var service = new VenueService(); return(service); }
public VenuesController(IAuthorizationService authorizationService, ClassroomService classroomService, LessonService lessonService, VenueService venueService) { _authorizationService = authorizationService; _classroomService = classroomService; _lessonService = lessonService; _venueService = venueService; }
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"]); }
/// <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; }
// GET: Venue public ActionResult Index() { //var userID = Guid.Parse(User.Identity.GetUserId()); var service = new VenueService(); var model = service.GetVenues(); return(View(model)); }
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); }
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); }
//Get: Create Venue public ActionResult Create() { var service = new VenueService(); // var model = service.GetVenues(); // ViewBag.VenueType = new SelectList(); return(View()); }
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); }
public VenuesController( RedisService redis, DbService db, ArtistService artistService, VenueService venueService, ShowService showService ) : base(redis, db, artistService) { _venueService = venueService; _showService = showService; }
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)); }
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()); }
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); }
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); }
public PhantasyTourImporter( DbService db, VenueService venueService, TourService tourService, SetlistShowService setlistShowService, SetlistSongService setlistSongService ) : base(db) { _setlistSongService = setlistSongService; _setlistShowService = setlistShowService; _venueService = venueService; _tourService = tourService; }
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(); }
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); }
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; }
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); }
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); }
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; }
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>())); }
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>())); }
public VenueManager() { if (_vs == null) _vs = new VenueService(); }