Class: TestBookStore

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/bookstore_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



7
8
9
10
# File 'lib/bookstore_test.rb', line 7

def setup
	@BookStore = BookStoreCore.new
	@bookHash={"Bone":2,"Btwo":2,"Bthree":1,"Bfour":4}
end

#test_add_update_bookObject



25
26
27
# File 'lib/bookstore_test.rb', line 25

def test_add_update_book
	assert_equal ({"B-one":2,"B-two":2,"B-three":1,"B-four":4,"B-to":2}), @BookStore.add_update_book("B-to",2,{"B-one":2,"B-two":2,"B-three":1,"B-four":4}) 
end

#test_delete_bookObject



29
30
31
# File 'lib/bookstore_test.rb', line 29

def test_delete_book
	assert_equal ({"B-one":2,"B-three":1,"B-four":4}), @BookStore.delete_book("B-two",{"B-one":2,"B-two":2,"B-three":1,"B-four":4}) 
end

#test_get_all_booksObject



20
21
22
# File 'lib/bookstore_test.rb', line 20

def test_get_all_books
	assert_equal ("B-one has rating 2."), @BookStore.get_all_books({"B-one":2}) 
end

#test_get_full_titleObject



16
17
18
# File 'lib/bookstore_test.rb', line 16

def test_get_full_title
	assert_equal ('B-one'), @BookStore.get_full_title("B-on",{"B-one":2,"B-two":2,"B-three":1,"B-four":4}) 
end

#test_is_existObject



12
13
14
# File 'lib/bookstore_test.rb', line 12

def test_is_exist
	assert_equal true, @BookStore.exist?("Btwo",{"Bone":2,"Btwo":2,"Bthree":1,"Bfour":4})
end