public void WillGenerateExceptionOnDuplicateRestaurantAddAttempt() { RestaurantDM duplicateAddAttempt = new RestaurantDM { City = "Butler", Name = "Mama Rosa", Overview = "Italian Cuisine From Old Country Recipes", StateId = 1, StreetAddress = "123 Old Butler Plank Road" }; try { IRestaurantsDataAdapter restaurantsDataAdapter = new RestaurantsDataAdapter(); int addResult = restaurantsDataAdapter.AddNewRestaurant(duplicateAddAttempt); Assert.Fail(); } catch (AssertFailedException e) { Assert.Fail(e.Message); } catch (Exception e) { Assert.IsTrue(e is Exception); } }
int IRestaurantsDataAdapter.AddNewRestaurant(RestaurantDM restaurant) { IModelBuilder <Restaurant, RestaurantDM> domainToEntityModelBuilder = new RestaurantDomainEntityModelBuilder(); AddNewRestaurantOperation addNewRestaurantOperation = new AddNewRestaurantOperation(); Restaurant restaurantDataEntity = domainToEntityModelBuilder.Build(restaurant); return(addNewRestaurantOperation.AddNewRestaurant(restaurantDataEntity)); }
IList <UserReviewDM> IUserReviewsDataAdapter.GetUserReviewsForRestaurant(RestaurantDM restaurantDm) { ISelectUserReviewsOperation selectUserReviewsOperation = new SelectUserReviewsOperation(); IList <UserReview> operationResults = selectUserReviewsOperation.SelectByRestaurant( new Restaurant() { Id = restaurantDm.Id }); return(BuildUserReviewDomainModelList(operationResults)); }