public void DAO_FindByUserId() { int numberDeliverys = 7; List <Delivery> createdDeliverys = new List <Delivery>(numberDeliverys); for (int i = 0; i < numberDeliverys; i++) { delivery = new Delivery { deliveryAddress = address, deliveryDate = deliveryDate, deliveryPrice = deliveryPrice, description = description + i, userId = userProfile.usrId, cardId = creditCard.cardId }; deliveryDao.Create(delivery); createdDeliverys.Add(delivery); } delivery = new Delivery { deliveryAddress = address, deliveryDate = deliveryDate, deliveryPrice = deliveryPrice, description = description, userId = userProfile2.usrId, cardId = creditCard.cardId }; deliveryDao.Create(delivery); List <Delivery> totalRetrievedDeliverys = deliveryDao.FindByUserId(userProfile.usrId); Assert.AreEqual(numberDeliverys, totalRetrievedDeliverys.Count); for (int i = 0; i < numberDeliverys; i++) { Assert.AreEqual(totalRetrievedDeliverys[i], createdDeliverys[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 <Delivery> Create(Delivery model) { await _dao.Create(model); return(model); }