public void ShouldCreateAProductCsvWhitoutDeliveredIn() { _deliveredIn = string.Empty; var product = new ProductCsv(_key, _artikleCode, _colorCode, _description, _price, _discountPrice, _deliveredIn, _q1, _size, _color); Assert.Empty(product.DeliveredIn); }
public void ShouldCreateAProductCsvWhitoutDiscountPrice() { _discountPrice = 0m; var product = new ProductCsv(_key, _artikleCode, _colorCode, _description, _price, _discountPrice, _deliveredIn, _q1, _size, _color); Assert.Equal(0m, product.DiscountPrice); }
public void ShouldParseStringToProductCsv() { var productCsvLineExpected = new ProductCsv("2800104", "2", "broek", "Gaastra", 8m, 0m, "1-3 werkdagen", "baby", 104, "grijs"); var result = _csvParser.Parse(@"Key,ArtikelCode,ColorCode,Description,Price,DiscountPrice,DeliveredIn,Q1,Size,Color 2800104,2,broek,Gaastra,8,0,1-3 werkdagen,baby,104,grijs"); Assert.Equal(productCsvLineExpected, result.First()); }
public void ShouldPreventNoIndexForCategoryAttribute() { var q1 = "NOINDEX"; _productCsv = ProductCsvBuilder.AProductCsv().WithQ1(q1).Build(); var product = _productFactory.Create(_productCsv); Assert.Empty(product.Category); }
public void ShouldPreventNoIndexForDeliveredInAttribute() { var deliveredIn = "NOINDEX"; _productCsv = ProductCsvBuilder.AProductCsv().WithDeliveredIn(deliveredIn).Build(); var product = _productFactory.Create(_productCsv); Assert.Empty(product.DeliveredIn); }
public void ShouldPreventNoIndexForColorCodeAttribute() { var colorCode = "NOINDEX"; _productCsv = ProductCsvBuilder.AProductCsv().WithColorCode(colorCode).Build(); var product = _productFactory.Create(_productCsv); Assert.Empty(product.ColorCode); }
public void ShouldPreventNoIndexForKeyAttribute() { var key = "NOINDEX"; _productCsv = ProductCsvBuilder.AProductCsv().WithKey(key).Build(); var product = _productFactory.Create(_productCsv); Assert.Empty(product.Key); }
private void InitializeMocks() { _productCsv = ProductCsvBuilder.AProductCsv().Build(); var productsCsv = new List <ProductCsv>() { _productCsv }; _csvParser.Setup(x => x.Parse(_csv)).Returns(productsCsv); _product = ProductBuilder.AProduct().Build(); _productFactory.Setup(x => x.Create(_productCsv)).Returns(_product); }
public void ShouldCreateAProductCsv() { var productCsvExpected = new { Key = _key, ArtikleCode = _artikleCode, ColorCode = _colorCode, Description = _description, Price = _price, DiscountPrice = _discountPrice, DeliveredIn = _deliveredIn, Q1 = _q1, Size = _size, Color = _color, }; var productCsv = new ProductCsv(_key, _artikleCode, _colorCode, _description, _price, _discountPrice, _deliveredIn, _q1, _size, _color); productCsvExpected.ToExpectedObject().Matches(productCsv); }
public Product Create(ProductCsv productCsv) { if (productCsv == null) { return(null); } var key = PreventNoIndex(productCsv.Key); var articleCode = PreventNoIndex(productCsv.ArtikleCode); var colorCode = PreventNoIndex(productCsv.ColorCode); var description = PreventNoIndex(productCsv.Description); var price = productCsv.Price; var discountPrice = productCsv.DiscountPrice; var deliveredIn = PreventNoIndex(productCsv.DeliveredIn); var category = PreventNoIndex(productCsv.Q1); var size = productCsv.Size; var color = PreventNoIndex(productCsv.Color); return(new Product(key, articleCode, colorCode, description, price, discountPrice, deliveredIn, category, size, color)); }
public ProductFactoryTest() { _productCsv = ProductCsvBuilder.AProductCsv().Build(); _productFactory = new ProductFactory(); }