public void TestUpdateCarInRace() { Car car = new Car() { Driver = "Mads", Name = "Suzuki" }; var track = new Track() { BestTime = 121213123, LengthInMeters = 123214, MaxCars = 50, Name = "RaceTrack" }; var race = new Race() { NumberOfLaps = 5, PlannedEnd = new DateTime(1920, 11, 11), PlannedStart = new DateTime(1920, 11, 11), Track = track }; var carInRace = new CarInRace() { Car = car, Race = race }; context.Add(carInRace); context.SaveChanges(); var UpdatedCarInRaceInfo = new RaceCarDTO() { CarId = car.Id, RaceId = race.Id, EndPosition = 2, FastestLap = 123123, StartPosition = 1212, TotalTime = 2121212 }; raceRepository.UpdateCarInRace(UpdatedCarInRaceInfo); Assert.Equal(UpdatedCarInRaceInfo.EndPosition, context.CarsInRace.Find(carInRace.RaceId, carInRace.CarId).EndPosition); Assert.Equal(UpdatedCarInRaceInfo.FastestLap, context.CarsInRace.Find(carInRace.RaceId, carInRace.CarId).FastestLap); Assert.Equal(UpdatedCarInRaceInfo.TotalTime, context.CarsInRace.Find(carInRace.RaceId, carInRace.CarId).TotalTime); Assert.Equal(UpdatedCarInRaceInfo.StartPosition, context.CarsInRace.Find(carInRace.RaceId, carInRace.CarId).StartPosition); }