Exemplo n.º 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);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public void Product_Without_ProductType_Is_Invalid()
 {
     var saleItem = new SaleItem(new Product("book")) { BasicDutyType = null };
     Assert.IsFalse(saleItem.IsValid);
 }
Exemplo n.º 7
0
 public void Product_IsNot_Imported_By_Default()
 {
     var saleItem = new SaleItem(_stubProduct);
     Assert.IsFalse(saleItem.IsImported);
 }
Exemplo n.º 8
0
 public void Can_Get_Correct_Description_For_NonImported_Product()
 {
     var saleItem = new SaleItem(_stubProduct);
     saleItem.IsImported = false;
     Assert.AreEqual("book", saleItem.GetPrintingDesc());
 }