public FulfillmentLocationClientTests()
 {
     if (String.IsNullOrEmpty(_authorization) || String.IsNullOrEmpty(_url) || String.IsNullOrEmpty(_testFulfillerId))
     {
         throw new Exception("Please set up test variables in your environment.");
     }
     _client = new FulfillmentLocationClient(new Uri(_url), _authorization);
 }
 public async void DeleteFulfillmentLocation_ThrowsCorrectExceptionOnNotFound(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <LocationNotFoundException>(async() => {
         await client.GetFulfillmentLocation(String.Empty);
     });
 }
 public async void DeleteFulfillmentLocation_ThrowsCorrectExceptionOnOtherError(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <CommunicationFailureException>(async() => {
         await client.DeleteFulfillmentLocation("a1s2d3");
     });
 }
 public async void UpdateFulfillmentLocation_ThrowsCorrectExceptionOnOtherError(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <CommunicationFailureException>(async() => {
         await client.UpdateFulfillmentLocation("a1s2d3", _locationConfigurations.ElementAt(0));
     });
 }
 public async void DeleteFulfillmentLocation_ThrowsCorrectExceptionOnForbidden(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <AccessForbiddenException>(async() => {
         await client.DeleteFulfillmentLocation("a1s2d3");
     });
 }
 public async void UpdateFulfillmentLocation_ThrowsCorrectExceptionOnForbidden(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <AccessForbiddenException>(async() => {
         await client.UpdateFulfillmentLocation("a1s2d3", _locationConfigurations.ElementAt(0));
     });
 }
 public async void UpdateFulfillmentLocation_ThrowsCorrectExceptionOnBadRequest(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <InvalidConfigurationException>(async() => {
         await client.UpdateFulfillmentLocation("a1s2d3", _locationConfigurations.ElementAt(0));
     });
 }
 public async void GetFulfillmentLocation_ThrowsCorrectExceptionOnOtherError(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <CommunicationFailureException>(async() => {
         await client.GetFulfillmentLocation(String.Empty);
     });
 }
 public async void GetFulfillmentLocation_ThrowsCorrectExceptionOnForbidden(FulfillmentLocationClient client)
 {
     await Assert.ThrowsAsync <AccessForbiddenException>(async() => {
         await client.GetFulfillmentLocation(String.Empty);
     });
 }
        public async void GetFulfillmentLocation_ReturnsFulfillmentLocationByInternalFulfillmentLocationId(FulfillmentLocationClient client)
        {
            var fulfillmentLocation = await client.GetFulfillmentLocation(_fulfillmentLocations.ElementAt(0).InternalFulfillmentLocationId);

            Assert.Equal(_fulfillmentLocations.ElementAt(0), fulfillmentLocation);
        }
        public async void GetFulfillmentLocations_FiltersByInternalFulfillerId(FulfillmentLocationClient client)
        {
            var fulfillmentLocations = await client.GetFulfillmentLocations(_fulfillmentLocations.ElementAt(0).InternalFulfillerId);

            Assert.True(fulfillmentLocations.SequenceEqual(_fulfillmentLocations.Where(fl => fl.FulfillerId == _fulfillmentLocations.ElementAt(0).FulfillerId)));
        }
        public async void GetFulfillmentLocations_ReturnsFulfillmentLocations(FulfillmentLocationClient client)
        {
            var fulfillmentLocations = await client.GetFulfillmentLocations();

            Assert.True(fulfillmentLocations.SequenceEqual(_fulfillmentLocations));
        }