public void throw_missconfigured_parcel_when_dimension_is_not_standardized()
        {
            courierQuery =
                CourierQueryBuilder.ACourierQuery()
                .WithParcelOfDimension("T")
                .Build();

            Assert.Throws <Exception>(() => courierHandler.Handle(courierQuery));
        }
        public void add_weight_quota_to_L_parcel()
        {
            courierQuery =
                CourierQueryBuilder.ACourierQuery()
                .WithLParcel()
                .Build();

            var courierResponse = courierHandler.Handle(courierQuery);

            Assert.Equal(27, courierResponse.TotalPrice);
            Assert.Equal(27, courierResponse.Parcels[0].Cost);
        }
        public void return_speedy_shipping_to_be_double_the_total_price()
        {
            courierQuery =
                CourierQueryBuilder.ACourierQuery()
                .WithSmParcel()
                .WithMParcel()
                .Build();

            var courierResponse = courierHandler.Handle(courierQuery);

            Assert.Equal(courierResponse.TotalPrice * 2, courierResponse.SpeedyShipping.TotalPrice);
        }
Beispiel #4
0
        public async Task add_weight_quota_to_dimension()
        {
            A_COURIER_QUERY =
                CourierQueryBuilder.ACourierQuery()
                .WithLParcel()
                .Build();

            StringContent stringContent = SerializeCourierQuery();

            CourierResponse courierResponse = await DeserializeCourierResponse(stringContent);

            Assert.Equal(27, courierResponse.TotalPrice);
            Assert.Equal(27, courierResponse.Parcels[0].Cost);
        }
        public void return_right_amount_of_cost_for_a_single_parcel_dimension(
            string parcelDimension,
            decimal expectedCost)
        {
            courierQuery =
                CourierQueryBuilder.ACourierQuery()
                .WithParcelOfDimension(parcelDimension)
                .Build();

            var courierResponse = courierHandler.Handle(courierQuery);

            var parcelResponse = courierResponse.Parcels.First();

            Assert.Equal(expectedCost, parcelResponse.Cost);
        }
Beispiel #6
0
        public async Task return_speedy_delivery_option()
        {
            A_COURIER_QUERY =
                CourierQueryBuilder.ACourierQuery()
                .WithLParcel()
                .WithXLParcel()
                .Build();

            StringContent stringContent = SerializeCourierQuery();

            CourierResponse courierResponse = await DeserializeCourierResponse(stringContent);

            Assert.Equal(72, courierResponse.TotalPrice);
            Assert.Equal(144, courierResponse.SpeedyShipping.TotalPrice);
        }
Beispiel #7
0
        public async Task return_collection_of_items_with_prices_for_each()
        {
            A_COURIER_QUERY =
                CourierQueryBuilder.ACourierQuery()
                .WithLParcel()
                .WithXLParcel()
                .Build();

            StringContent stringContent = SerializeCourierQuery();

            CourierResponse courierResponse = await DeserializeCourierResponse(stringContent);

            Assert.Equal(27, courierResponse.Parcels[0].Cost);
            Assert.Equal(45, courierResponse.Parcels[1].Cost);
        }
Beispiel #8
0
        public async Task return_total_price_for_parcels(
            decimal expectedTotalPrice,
            params string[] dimensions)
        {
            A_COURIER_QUERY =
                CourierQueryBuilder.ACourierQuery()
                .WithParcelsOfDimension(dimensions)
                .Build();

            StringContent stringContent = SerializeCourierQuery();

            CourierResponse courierResponse = await DeserializeCourierResponse(stringContent);

            Assert.Equal(expectedTotalPrice, courierResponse.TotalPrice);
        }
Beispiel #9
0
        public async Task return_matching_json()
        {
            string expectedJson = "{\"totalPrice\":72.0,\"parcels\":[{\"cost\":27.0},{\"cost\":45.0}],\"speedyShipping\":{\"totalPrice\":144.0}}";

            A_COURIER_QUERY =
                CourierQueryBuilder.ACourierQuery()
                .WithLParcel()
                .WithXLParcel()
                .Build();

            StringContent stringContent = SerializeCourierQuery();

            string responseJson = await ExtractJsonResponse(stringContent);

            Assert.Equal(expectedJson, responseJson);
        }