First post so hi all ![]()
can anyone tell my how can i test my custom repositories?
i have a repo which is using umbraco database:
public class MyRepository : IMyRepository
{
protected readonly UmbracoDatabase db;
public MyRepository()
{
db = ApplicationContext.Current.DatabaseContext.Database;
}
public void EditRestaurant(Restaurant restaurant)
{
var updatedRestaurant = db.SingleOrDefault<RestaurantPoco>("SELECT * FROM Restaurants WHERE Id = @0", restaurant.ID);
if (updatedRestaurant == null)
{
throw new KeyNotFoundException("Restaurant has not been found.");
}
db.Update("Restaurants", "Id", Mapper.Map<Restaurant, RestaurantPoco>(restaurant, updatedRestaurant));
}
}
i would like to use test database for my unit tests.
How can i do this?
thx in advance for help
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/74367-testing-custom-repository