public async Task Should_ReturnInventoryVehicle_WhenVehicleIdExistsInDB() { //Given var testServer = new TestServer(hostBuilder(Guid.NewGuid().ToString())); var client = testServer.CreateClient(); var db = testServer.Services.GetRequiredService <DatabaseContext>(); var vehicle = new Vehicle { Id = 1, VIN = "4Y1SL65848Z411439", Make = "Toyota", Model = "Corolla", Year = 1997, Miles = 145000, Color = "Silver", SellingPrice = 2000, Status = Vehicle.StatusCode.Inventory, UserId = 1, VehicleImages = new List <VehicleImage>() }; var inventoryVehicle = new InventoryVehicle { Id = 1, VehicleId = 1, Price = 3000, Vehicle = vehicle }; db.Add(inventoryVehicle); db.SaveChanges(); // WHEN var response = await client.GetAsync("/Inventory/1"); var content = await response.Content.ReadAsStringAsync(); var result = JsonSerializer.Deserialize <InventoryVehicle>(content, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); //THEN inventoryVehicle should be returned result.Should().BeEquivalentTo(inventoryVehicle); }
public void Action_Should_When() { //Given InventoryVehicle inventoryVehicle = new InventoryVehicle(); //When //Then inventoryVehicle.Should().NotBeNull(); }
private List <string> GetImageUris(InventoryVehicle vehicle) { using (XDataTable table = DataSetHelper.GetDataTable(GetImageUrisSql, SessionManager.Instance.GetConnection("va2"), new NameValue("vin", vehicle.Vin), new NameValue("entityId", vehicle.Dealer.Id))) { if (table.Rows.Count == 0) { return(new List <string>()); } return(((XDataRow)table.Rows[0]).GetList <string>("ImageUris")); } }