public void it_can_be_deserialized_when_has_errors() { var expected = new BookingResponse { Consignments = new List <BookingResponse.Consignment> { new BookingResponse.Consignment { CorrelationId = null, Confirmation = null, Errors = new List <Error> { new Error( "b2e73d9f-6281-4ed2-91ee-431eba33f766", "BOOK-INPUT-023", new List <ErrorMessage> { new ErrorMessage( "en", "The shipment is too big to send with the given product" ) } ) } } } }; var actual = JsonConvert.DeserializeObject <BookingResponse>(ErrorJsonResponse, new MilisecondEpochConverter()); expected.Should().BeEquivalentTo(actual); }
public void it_can_be_deserialized() { var expected = new BookingResponse { Consignments = new List <BookingResponse.Consignment> { new BookingResponse.Consignment { CorrelationId = "INTERNAL-123456", Confirmation = new BookingResponse.Confirmation { ConsignmentNumber = "70438101268018539", Links = new BookingResponse.Links { Labels = new Uri("https://www.mybring.com/booking/labels/2968466?auth-token=5cf1dcee-4f01-4c9a-9870-3ba6d9ba050b"), Tracking = new Uri("http://sporing.bring.no/sporing.html?q=70438101268018539") }, DateAndTimes = new BookingResponse.DateAndTimes { EarliestPickup = null, ExpectedDelivery = DateTime.Parse("Sat, 22 Nov 2014 13:33:56.515") }, Packages = new List <BookingResponse.Package> { new BookingResponse.Package { CorrelationId = "PACKAGE-123", PackageNumber = "370438101268058536" } } }, Errors = null } } }; var actual = JsonConvert.DeserializeObject <BookingResponse>(SuccessJsonResponse, new MilisecondEpochConverter()); expected.Should().BeEquivalentTo(actual); }