public void Success_FindUserProduct() { //Arrange int index; UserProduct user_product; UserProduct result; //Act index = 52; user_product = new UserProduct { ProductId = products[index].Id, Username = user.Username, IsActive = false }; db_userproduct.CreateUserProduct(user_product); result = db_userproduct.FindUserProduct(user_product); //Assert Assert.AreEqual(user_product.Username, result.Username); }
/// <summary> /// finds a list of user products by username, productId or both. /// </summary> /// <param name="user_product"></param> /// <param name="instance_use"></param> /// <returns>List<UserProduct></returns> public List <UserProduct> Find(UserProduct user_product, string instance_use) { List <UserProduct> result; switch (instance_use) { case "Username": result = db_userproduct.FindUserProductByUsername(user_product.Username); break; case "Product Id": result = db_userproduct.FindUserProductByProductId(user_product.ProductId); break; case "Both": result = new List <UserProduct>(); result.Add(db_userproduct.FindUserProduct(user_product)); break; default: result = new List <UserProduct>(); break; } return(result); }