Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public void CanGetAllRestaurantsDomainModelList()
        {
            try
            {
                IRestaurantsDataAdapter restaurantsDataAdapter = new RestaurantsDataAdapter();

                IList <RestaurantDM> results = restaurantsDataAdapter.GetAllRestaurants();

                Assert.IsTrue(results != null);

                Assert.IsTrue(results.Count > 0);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Ejemplo n.º 3
0
        public void CanGetRestaurantDomainModelListByCityName()
        {
            try
            {
                string cityName = "Twin Peaks";

                IRestaurantsDataAdapter restaurantsDataAdapter = new RestaurantsDataAdapter();

                IList <RestaurantDM> results = restaurantsDataAdapter.GetRestaurantsByCity(cityName);

                Assert.IsTrue(results != null);

                Assert.IsTrue(results.Count > 0);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }