Inheritance: IEntityId
 /// <summary>
 ///A test for Save
 ///</summary>
 //[TestMethod]
 public void ShouldCreateIdOnSave()
 {
     ProductProvider target = ServiceLocator.Get<ProductProvider>();
     Product product = new Product {Name = "My new product", RawPrice = 100};
     target.Save(product);
     Assert.IsTrue(product.IdOfEntity != 0);
 }
        public void GetTax()
        {
            //Initialize our product
            Product myProduct = new Product { IdOfEntity = 1, Name = "Simple Product", RawPrice = 25.0M };

            //Create a mock with Moq
            Mock<ITaxCalculator> fakeTaxCalculator = new Mock<ITaxCalculator>();

            // make sure to return 5$ of tax for a 25$ product
            fakeTaxCalculator.Setup(tax => tax.GetTax(25.0M)).Returns(5.0M);

            // Retrived the calculated tax
            decimal calculatedTax = 0;
            calculatedTax = myProduct.GetPriceWithTax(fakeTaxCalculator.Object);

            // Verify that the "GetTax" method was called from  the interface
            fakeTaxCalculator.Verify(tax => tax.GetTax(25.0M));

            // Retrived the calculated tax
            calculatedTax = myProduct.GetPriceWithTax(fakeTaxCalculator.Object);

            // Make sure that the taxes were calculated
            Assert.AreEqual(calculatedTax, 30.0M);
        }
 public virtual void Save(Product product)
 {
     Check.Require(product != null, "Product is required for Save");
     _productRepository.SaveOrUpdate(product);
 }
 public virtual void Delete(Product product)
 {
     Check.Require(product != null, "Product is required for Delete");
     _productRepository.Delete(product);
 }