public void parcel_with_weight_over_10kg_should_be_routed_via_heavy_department(double parcelWeight) { var parcelHandler = new ParcelHandler(); parcelHandler.GetParcelRoutes(new Parcel("someId", "1234AB", "1a", parcelWeight, 0)) .Single() .Departments.Should().BeEquivalentTo("Heavy"); }
public void parcels_with_weight_up_to_1kg_should_be_routed_via_mail_department(double parcelWeight) { var parcelHandler = new ParcelHandler(); parcelHandler.GetParcelRoutes(new Parcel("someId", "1234AB", "1a", parcelWeight, 0)) .Single() .Departments.Should().BeEquivalentTo("Mail"); }
public void parcel_with_a_declared_value_over_1k_euro_should_be_routed_via_the_insurance_department_first() { var parcelHandler = new ParcelHandler(); parcelHandler.GetParcelRoutes(new Parcel("someId", "1234AB", "1a", 10.01, 1000.01)) .Single() .Departments.Should() .BeEquivalentTo(new [] { "Insurance", "Heavy" }, opt => opt .WithStrictOrdering()); }
public void parcel_routes_should_contain_original_parcel_information() { var parcel = new Parcel("some Id", "1234 AB", "1 a", 0.2, 0); var parcelHandler = new ParcelHandler(); parcelHandler.GetParcelRoutes(parcel) .Single() .Should().BeEquivalentTo(parcel); }
public static void Main(string[] args) { var parcelStore = new EmbeddedResourceParcelStore(); var parcelHandler = new ParcelHandler(); foreach (var parcelRoute in parcelHandler.GetParcelRoutes(parcelStore.GetAll().ToArray())) { Console.WriteLine("========================="); Console.WriteLine($"Parcel: {parcelRoute.PostalCode}-{parcelRoute.HouseNumber}-{parcelRoute.Id}"); Console.WriteLine($"- weight : {parcelRoute.Weight}"); Console.WriteLine($"- declared value : {parcelRoute.DeclaredValue}"); Console.WriteLine($"- department route (strict order): {string.Join(",", parcelRoute.Departments)}"); Console.WriteLine(); } Console.WriteLine("Press enter to exit."); Console.ReadLine(); }