public void MyTestInitialize() { transaction = new TransactionScope(); category = new Category(); category.categoryName = categoryName; categoryDao.Create(category); product = new Product(); product.categoryId = category.categoryId; product.productName = productName; product.productPrice = productPrice; product.productQuantity = productQuantity; product.productDate = date; productDao.Create(product); user = new UserProfile { loginName = "loginNameTest", enPassword = "******", firstName = "name", lastName = "lastName", email = "*****@*****.**", language = "es", country = "ES", role = 0, address = "addressTest" }; userProfileDao.Create(user); }
public Guid SetProduct(ProductCreateInputModel model) { model.Id = Guid.NewGuid(); Product modelProduct = MapModelProductToDataProduct(model); _IProductDao.Create(modelProduct); return(model.Id); }
public void MyTestInitialize() { transaction = new TransactionScope(); UserProfile newUser = new UserProfile { loginName = "loginNameTest", enPassword = "******", firstName = "name", lastName = "lastName", email = "*****@*****.**", language = "es", country = "ES", role = 0, address = "addressTest" }; userProfileDao.Create(newUser); user = newUser; CreditCard defaultCreditCard = new CreditCard { cardNumber = 5231962446920945, cardType = "débito", expirationDate = DateTime.Now.AddMonths(1), userId = user.usrId, verificationCode = 555, defaultCard = 1 }; creditCardDao.Create(defaultCreditCard); creditCard = defaultCreditCard; Category newCategory = new Category { categoryName = "Category test" }; categoryDao.Create(newCategory); category = newCategory; Product newProduct = new Product { categoryId = category.categoryId, productDate = DateTime.Now.AddMonths(-1), productName = "Test product", productPrice = new decimal(9.99), productQuantity = 100 }; productDao.Create(newProduct); product = newProduct; shoppingCart = new ShoppingCart(1, product, false); }
private static long CreateProduct(long categoryId, string name, int units, float prize) { Product p = new Product(); p.categoryId = categoryId; p.name = name; p.registerDate = DateTime.Now; p.numberOfUnits = units; p.prize = prize; productDao.Create(p); return(p.productId); }
private Product CreateProduct(string productName, decimal productPrice, System.DateTime productDate, int productQuantity, long categoryId) { Product product = new Product { productName = productName, productPrice = productPrice, productDate = productDate, productQuantity = productQuantity, categoryId = categoryId }; productDao.Create(product); return(product); }
public void DAO_FindByTagId() { int numberFoundProducts = 1; List <Product> createdProducts = new List <Product>(); product = new Product(); product.productName = productName + 1; product.productPrice = productPrice; product.productDate = productDate; product.productQuantity = productQuantity; product.Category = category; productDao.Create(product); Comment comment = new Comment(); comment.comment1 = "comment"; comment.commentDate = System.DateTime.Now; comment.productId = product.productId; comment.userId = user.usrId; comment.Tags.Add(tag); commentDao.Create(comment); createdProducts.Add(product); product = new Product(); product.productName = "name" + 2; product.productPrice = productPrice; product.productDate = productDate; product.productQuantity = productQuantity; product.categoryId = category2.categoryId; productDao.Create(product); List <Product> totalRetrievedProducts = productDao.FindByTagId(tag.tagId); Assert.AreEqual(numberFoundProducts, totalRetrievedProducts.Count); for (int i = 0; i < numberFoundProducts; i++) { Assert.AreEqual(totalRetrievedProducts[i], createdProducts[i]); } }
public void MyTestInitialize() { transaction = new TransactionScope(); userProfile = new UserProfile(); userProfile.loginName = loginName; userProfile.enPassword = password; userProfile.firstName = firstName; userProfile.lastName = lastName; userProfile.email = email; userProfile.language = language; userProfile.country = country; userProfile.role = role; userProfile.address = address; userProfileDao.Create(userProfile); creditCard = new CreditCard(); creditCard.cardType = TYPE; creditCard.cardNumber = CARD_NUMBER; creditCard.defaultCard = 1; creditCard.expirationDate = System.DateTime.Now; creditCard.verificationCode = VER_CODE; creditCard.userId = userProfile.usrId; creditCardDao.Create(creditCard); delivery = new Delivery(); delivery.deliveryAddress = address; delivery.deliveryDate = deliveryDate; delivery.deliveryPrice = deliveryPrice; delivery.description = description; delivery.userId = userProfile.usrId; delivery.cardId = creditCard.cardId; deliveryDao.Create(delivery); delivery2 = new Delivery(); delivery2.deliveryAddress = address; delivery2.deliveryDate = deliveryDate; delivery2.deliveryPrice = deliveryPrice; delivery2.description = description; delivery2.userId = userProfile.usrId; delivery2.cardId = creditCard.cardId; deliveryDao.Create(delivery2); category = new Category(); category.categoryName = categoryName; categoryDao.Create(category); product = new Product(); product.productName = productName; product.productPrice = productPrice; product.productDate = productDate; product.productQuantity = productQuantity; product.categoryId = category.categoryId; productDao.Create(product); }
public async Task <Product> Create(Product model) { await _dao.Create(model); return(model); }