コード例 #1
0
 def test_1(self):
     """This test is checking to make sure the checkout price is equal to 33.45 (since they are a premium member"""
     p1 = Store.Product("889", "Rodent of unusual size",
                        "when a rodent of the usual size just won't do",
                        33.45, 8)
     c1 = Store.Customer("Yinsheng", "QWF", True)
     myStore = Store.Store()
     myStore.add_product(p1)
     myStore.add_member(c1)
     myStore.add_product_to_member_cart("889", "QWF")
     result = myStore.check_out_member("QWF")
     self.assertEqual(result, 33.45)
コード例 #2
0
 def test_2(self):
     """This test is checking to make sure the program is charging the extra 7% shipping cost for non-premium
     members"""
     p1 = Store.Product("889", "Rodent of unusual size",
                        "when a rodent of the usual size just won't do",
                        33.45, 8)
     c1 = Store.Customer("Yinsheng", "QWF", False)
     myStore = Store.Store()
     myStore.add_product(p1)
     myStore.add_member(c1)
     myStore.add_product_to_member_cart("889", "QWF")
     result = myStore.check_out_member("QWF")
     self.assertEqual(result, (33.45 * 1.07))
コード例 #3
0
 def test_5(self):
     c1 = Store.Customer("Yinsheng", "QWF", False)
     name = c1.get_name()
     self.assertIn(name, "Yinsheng")
コード例 #4
0
 def test_4(self):
     c1 = Store.Customer("Yinsheng", "QWF", False)
     membership = c1.is_premium_member()
     self.assertIs(membership, False)
コード例 #5
0
 def test_5(self):
     customer = Store.Customer("Ben", "GGF", True)
     self.assertEqual(customer.is_premium_member(), True)
コード例 #6
0
 def test_2(self):
     customer = Store.Customer("Sam", "FRW", False)
     self.assertNotEqual(customer.get_name(), "Samantha")