-
Notifications
You must be signed in to change notification settings - Fork 15
/
product_test.rb
24 lines (18 loc) · 930 Bytes
/
product_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require "test/unit"
require_relative './product'
class ProductTest < Test::Unit::TestCase
def test_product_equality
# A value object must be created whole
product = Product.new("dishwasher", "OEUOEU23", "Whirlpool", "7DP840CWDB0")
# Demonstrate equality of object by property
assert_equal Product.new("dishwasher", "OEUOEU23", "Whirlpool", "7DP840CWDB0"), product
end
def test_product_inequality
product = Product.new("dishwasher", "OEUOEU23", "Whirlpool", "7DP840CWDB0")
# Demonstrates inequality by property
assert_not_equal Product.new("stove", "OEUOEU23", "Whirlpool", "7DP840CWDB0"), product
assert_not_equal Product.new("dishwasher", "EUOEUOE", "Whirlpool", "7DP840CWDB0"), product
assert_not_equal Product.new("dishwasher", "OEUOEU23", "Maytag", "7DP840CWDB0"), product
assert_not_equal Product.new("dishwasher", "OEUOEU23", "Whirlpool", "99999999"), product
end
end