Example #1
0
        //Test Read Ops
        // When testing methods that do not state of the data

        public void GetAllCustomersShouldAddCustomers()
        {
            //putting in a test context/ connection to our test db
            using (var context = new Entity.StoreDBContext(options))
            {
                //Arrange
                IRepository _repo = new RepoDB(context);

                //Act
                var stores = _repo.GetAllCustomers();

                //Assert
                Assert.Equal(2, stores.Count);
            }
        }
Example #2
0
 public void addProductsShouldAddProducts()
 {
     using (var context = new Entity.StoreDBContext(options))
     {
         IRepository _repo = new RepoDB(context);
         _repo.AddStore
         (
             new Model.Store("Patrick's Peppers", "Austin", "TX")
         );
     }
     //use a diff context to check if changes persist to db
     using (var assertContext = new Entity.StoreDBContext(options))
     {
         var result = assertContext.Stores.FirstOrDefault(store => store.Id == 3);
         Assert.NotNull(result);
         assertContext.Equal("Austin", result.City);
     }
 }