private static void TestUpdateVenue(VenueServiceApi venueServiceApi, Venue venue) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine($" Test: Update venue by ID = {venue.internalId} "); Console.WriteLine(" ========================================================== "); var resultVenue = venueServiceApi.UpdateVenueById(venue); Console.WriteLine($"{resultVenue.title} ({resultVenue.internalId}): {resultVenue.compositeId}"); }
private static void TestUpsertSeatAttributes(VenueServiceApi venueServiceApi, string venueId, IList <SeatAttribute> seatAttributes) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine($" Test: Upsert seat attributes for {venueId}"); Console.WriteLine(" ========================================================== "); var result = venueServiceApi.UpsertSeatAttributes(venueId, seatAttributes); Console.WriteLine(result); }
private static void TestUpdateStandardAttributeByTitle(VenueServiceApi venueServiceApi, IList <StandardAttribute> standardAttributes) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine(" Test: Update standard attribute by title "); Console.WriteLine(" ========================================================== "); var sourceAttribute = standardAttributes.First(); var updatedAttribute = venueServiceApi.UpsertStandardAttributeByTitle(sourceAttribute); Console.WriteLine($"{updatedAttribute?.title} - {updatedAttribute?.intention}"); }
private static Venue TestGetVenueById(VenueServiceApi venueServiceApi, string venueId) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine($" Test: Get detailed venue by ID = {venueId} "); Console.WriteLine(" ========================================================== "); var venue = venueServiceApi.GetVenueById(venueId); Console.WriteLine($"{venue.title} ({venue.internalId}): {venue.compositeId}"); return(venue); }
private static void TestGetVenues(VenueServiceApi venueServiceApi) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine(" Test: Get all venues "); Console.WriteLine(" ========================================================== "); IList <Venue> venues = venueServiceApi.GetVenues(); foreach (var a in venues) { Console.WriteLine($"{a.title} ({a.internalId}): {a.compositeId}"); } }
public void Authentication_IfBadCredentials_Exception401() { var apiContext = new ApiContext(context.Environment, "admin", "invalid_password"); service = new VenueServiceApi(apiContext); var exception = Assert.Catch <ApiException>(() => { service.AuthenticationService.Authenticate(); }); AssertApiException(exception, HttpStatusCode.Unauthorized); }
public void UpsertSeatAttributes_IfSeatAttributeIsNotInitialized_Exception401() { var venueId = configuration["Venue:TestVenueIdWithSeatAttributes"]; var sourceAttributes = service.GetSeatAttributes(venueId); service = new VenueServiceApi(context); var exception = Assert.Catch <ApiException>(() => { var result = service.UpsertSeatAttributes(venueId, sourceAttributes); }); AssertApiException(exception, HttpStatusCode.Unauthorized); }
public void UpdateVenue_IfContextUnauthorized_Exception401() { var venueId = configuration["Venue:TestVenueIdWithAddress"]; service = new VenueServiceApi(context); var sourceVenue = service.GetVenueById(venueId); var exception = Assert.Catch <ApiException>(() => { var updatedVenue = service.UpdateVenueById(sourceVenue); }); AssertApiException(exception, HttpStatusCode.Unauthorized); }
private static IList <StandardAttribute> TestGetStandardAttributes(VenueServiceApi venueServiceApi) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine(" Test: Get standard attributes "); Console.WriteLine(" ========================================================== "); var standardAttributes = venueServiceApi.GetStandardAttributes(); foreach (var a in standardAttributes) { Console.WriteLine($"{a.title} - {a.intention}"); } return(standardAttributes); }
public void UpsertSeatAttributes_IfTokenInvalid_Exception403() { var venueId = configuration["Venue:TestVenueIdWithSeatAttributes"]; var sourceAttributes = service.GetSeatAttributes(venueId); context.AccessToken = "invalid_token"; service = new VenueServiceApi(context); var exception = Assert.Catch <ApiException>(() => { var result = service.UpsertSeatAttributes(venueId, sourceAttributes); }); AssertApiException(exception, HttpStatusCode.Forbidden); }
public void UpsertStandardAttributeByTitle_IfContextUnauthorized_Exception401() { var sourceAttribute = new Attribute { Title = "test" }; service = new VenueServiceApi(context); var exception = Assert.Catch <ApiException>(() => { var updatedAttribute = service.UpsertStandardAttributeByTitle(sourceAttribute); }); AssertApiException(exception, HttpStatusCode.Unauthorized); }
public void UpdateVenue_IfTokenInvalid_Exception403() { var venueId = configuration["Venue:TestVenueIdWithAddress"]; context.AccessToken = "invalid_token"; service = new VenueServiceApi(context); var sourceVenue = service.GetVenueById(venueId); var exception = Assert.Catch <ApiException>(() => { var updatedVenue = service.UpdateVenueById(sourceVenue); }); AssertApiException(exception, HttpStatusCode.Forbidden); }
private static IList <SeatAttribute> TestGetSeatAttributes(VenueServiceApi venueServiceApi, string venueId) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine($" Test: Get seat attributes for {venueId}"); Console.WriteLine(" ========================================================== "); IList <SeatAttribute> seatAttributes = venueServiceApi.GetSeatAttributes(venueId); foreach (var a in seatAttributes) { Console.WriteLine( $"{a.seatIdentifier} - {a.attributes[0].title} [{(!string.IsNullOrEmpty(a.startDate) ? a.startDate : "-")}-{((!string.IsNullOrEmpty(a.endDate)) ? a.endDate : "-")} : {(a.performanceTimes != null ? string.Join(",", a.performanceTimes) : "-")}]"); } return(seatAttributes); }
private static VenueServiceApi TestVenueServiceAuthentication(ApiContext context) { Console.WriteLine(); Console.WriteLine(" ========================================================== "); Console.WriteLine(" Test: Get JWT token for the venue service"); Console.WriteLine(" ========================================================== "); var venueServiceApi = new VenueServiceApi(context); var authContext = venueServiceApi.AuthenticationService.Authenticate(); Console.WriteLine($"username: {authContext.UserName}"); Console.WriteLine($"Password: {authContext.Password}"); Console.WriteLine($"token: {authContext.AccessToken}"); Console.WriteLine($"authenticated: {venueServiceApi.AuthenticationService.IsThereAuthentication()}"); return(venueServiceApi); }
public void UpsertStandardAttributeByTitle_IfTokenInvalid_Exception403() { var sourceAttribute = new Attribute { Title = "test" }; context.AccessToken = "invalid_token"; service = new VenueServiceApi(context); var exception = Assert.Catch <ApiException>(() => { var updatedAttribute = service.UpsertStandardAttributeByTitle(sourceAttribute); }); AssertApiException(exception, HttpStatusCode.Forbidden); }
public void SetupState() { configuration = ConfigurationHelper.GetConfiguration(); context = new ApiContext(Environments.Sandbox, configuration["Venue:Username"], configuration["Venue:Password"]); service = new VenueServiceApi(context, true); }