public CreateDriverCommandHandlerTest() { var rnd = new Random(); _driverContext = new DriverContext(new DbContextOptionsBuilder <DriverContext>() .UseInMemoryDatabase("Test" + rnd.NextDouble().ToString()) .Options); _mapper = new Mapper(new MapperConfiguration( cfg => cfg.AddProfile(new DomainProfile()))); _geocoder = new DummyGeocoder(new Coordinates(10, -10)); }
public UpdateDriverCommandHandlerTest() { var rnd = new Random(); _driverContext = new DriverContext(new DbContextOptionsBuilder <DriverContext>() .UseInMemoryDatabase("Test" + rnd.NextDouble().ToString()) .Options); var driver = new Driver { FirstName = "Fulano", LastName = "da Silva", Car = new Car { Brand = "Ford", Model = "Focus", RegistrationPlate = "LUJ1234" }, Address = new Address { Line1 = "Av Brasil, 9020", Line2 = "Olaria", Municipality = "Rio de Janeiro", State = "RJ", ZipCode = "21030-001", Coordinates = new Coordinates(-22.8370646, -43.2556345) } }; _driverContext.Drivers.Add(driver); _driverContext.SaveChangesAsync(); _driverId = driver.DriverId; _mapper = new Mapper(new MapperConfiguration( cfg => cfg.AddProfile(new DomainProfile()))); _geocoder = new DummyGeocoder(new Coordinates(20, -30)); }