示例#1
0
 public void Product_With_Negative_Price_Is_Invalid()
 {
     var saleItem = new SaleItem(new Product("book"))
                        {
                            BasicDutyType = new BasicDutyType("Book"),
                            Price = -1.55m
                        };
     Assert.IsFalse(saleItem.IsValid);
 }
        public void Can_Generate_Levier_With_BeforeTaxPrice()
        {
            var saleItem = new SaleItem(new Product("a"))
                               {
                                   Price = 19.99m,
                               };
            var levier = new LevierFactory().GenerateLevier(saleItem);

            Assert.AreEqual(19.99m, levier.BeforeTaxAmount);
        }
示例#3
0
        public void Can_Get_Tax()
        {
            var service = new Mock<ITaxPriceService>();
            var product = new SaleItem(new Product("a")) { TaxPriceService = service.Object };
            service.Setup(x => x.CalculateTax(product)).Returns(1.90m);

            var price = product.GetTax();

            Assert.AreEqual(1.90m, price);
        }
        public void Can_Generate_Levier_For_Product_Without_BasicDutyType()
        {
            var saleItem = new SaleItem(new Product("a"))
                               {
                                   BasicDutyType = null,
                                   IsImported = false
                               };
            var levier = new LevierFactory().GenerateLevier(saleItem);

            Assert.AreEqual(0, levier.TaxCalculaters.Count);
        }
        public void Can_Generate_Levier_For_NonImported_Product()
        {
            var saleItem = new SaleItem(new Product("a"))
                              {
                                  BasicDutyType = new BasicDutyType("Books"){TaxRate = 0.1},
                                  IsImported = false
                              };
            var levier = new LevierFactory().GenerateLevier(saleItem);

            Assert.AreEqual(1, levier.TaxCalculaters.Count);
        }
示例#6
0
 public void Product_Without_ProductType_Is_Invalid()
 {
     var saleItem = new SaleItem(new Product("book")) { BasicDutyType = null };
     Assert.IsFalse(saleItem.IsValid);
 }
示例#7
0
 public void Product_IsNot_Imported_By_Default()
 {
     var saleItem = new SaleItem(_stubProduct);
     Assert.IsFalse(saleItem.IsImported);
 }
示例#8
0
 public void Can_Get_Correct_Description_For_NonImported_Product()
 {
     var saleItem = new SaleItem(_stubProduct);
     saleItem.IsImported = false;
     Assert.AreEqual("book", saleItem.GetPrintingDesc());
 }