public void when_sending_receipt_with_no_dropoff_should_geocode_vehicle_position() { var orderId = Guid.NewGuid(); using (var context = new BookingDbContext(DbName)) { context.Save(new OrderStatusDetail { OrderId = orderId, VehicleLatitude = 45.531608, VehicleLongitude = -73.622791, PickupDate = DateTime.Now, }); } Sut.When(new SendReceipt { OrderId = orderId, EmailAddress = "*****@*****.**", PickupAddress = new Address { FullAddress = "5250, rue Ferrier, Montreal, H1P 4L4", Latitude = 1.23456, Longitude = 7.890123 }, ClientLanguageCode = "fr" }); // verify templateData (2 times for subject + body) TemplateServiceMock.Verify(x => x.Render(It.IsAny <string>(), It.Is <object>(o => ObjectPropertyEquals(o, "DropOffAddress", "7250 Rue du Mile End, Montréal, QC H2R 2W1"))), Times.Exactly(2)); TemplateServiceMock.Verify(x => x.Render(It.IsAny <string>(), It.Is <object>(o => ObjectPropertyContains(o, "StaticMapUri", "?markers=color:0x1EC022%7Csize:medium%7C1.23456,7.890123&markers=color:0xFF0000%7Csize:medium%7C45.531608,-73.622791"))), Times.Exactly(2)); }
private void AssertTemplateValueContains(string key, string expectedValue) { // verify templateData (2 times for subject + body) TemplateServiceMock.Verify(x => x.Render(It.IsAny <string>(), It.Is <object>(o => ObjectPropertyContains(o, key, expectedValue))), Times.Exactly(2)); }