예제 #1
0
        public void MyTestInitialize()
        {
            transaction = new TransactionScope();

            category = new Category();
            category.categoryName = categoryName;

            category2 = new Category();
            category2.categoryName = "Category2";

            categoryDao.Create(category);
            categoryDao.Create(category2);

            tag         = new Tag();
            tag.tagName = "tag";
            tagDao.Create(tag);

            user            = new UserProfile();
            user.address    = "address";
            user.country    = "ES";
            user.language   = "es";
            user.loginName  = "login";
            user.enPassword = "******";
            user.firstName  = "name";
            user.lastName   = "surname";
            user.role       = 0;
            user.email      = "email";
            userProfileDao.Create(user);
        }
        private Category CreateCategory(string categoryName)
        {
            Category category = new Category
            {
                categoryName = categoryName
            };

            categoryDao.Create(category);

            return(category);
        }
예제 #3
0
        public void DAO_FindAllTest()
        {
            int numberCategories = 5;

            List <Category> createdCategories = new List <Category>(numberCategories);

            for (int i = 0; i < numberCategories; i++)
            {
                Category cat = new Category
                {
                    categoryName = "CategoryTest" + i
                };

                categoryDao.Create(cat);
                createdCategories.Add(cat);
            }

            List <Category> retrievedCategories = categoryDao.FindAll();

            Assert.AreEqual(numberCategories, retrievedCategories.Count);

            for (int i = 0; i < numberCategories; i++)
            {
                Assert.AreEqual(retrievedCategories[i], createdCategories[i]);
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        public void MyTestInitialize()
        {
            transaction = new TransactionScope();

            userProfile            = new UserProfile();
            userProfile.loginName  = userLoginName;
            userProfile.enPassword = PasswordEncrypter.Crypt(clearPassword);
            userProfile.firstName  = firstName;
            userProfile.lastName   = lastName;
            userProfile.email      = email;
            userProfile.language   = language;
            userProfile.country    = country;

            userProfileDao.Create(userProfile);

            category      = new Category();
            category.name = categoryName;

            categoryDao.Create(category);

            myEvent                 = new Event();
            myEvent.categoryId      = categoryId;
            myEvent.name            = name;
            myEvent.eventDate       = date;
            myEvent.review          = review;
            myEvent.Category        = category;
            myEvent.Comments        = new List <Comment>();
            myEvent.Recommendations = new List <Recommendation>();

            eventDao.Create(myEvent);

            userGroup              = new UserGroup();
            userGroup.name         = groupName;
            userGroup.description  = groupDescription;
            userGroup.UserProfiles = new List <UserProfile>();
            userGroup.UserProfiles.Add(userProfile);
            userGroup.Recommendations = new List <Recommendation>();

            userGroupDao.Create(userGroup);


            recommendation1             = new Recommendation();
            recommendation1.reason      = recom;
            recommendation1.Event       = myEvent;
            recommendation1.UserProfile = userProfile;
            recommendation1.UserGroup   = userGroup;
            recommendation1.created     = DateTime.Now;

            recommendationDao.Create(recommendation1);

            recommendation2             = new Recommendation();
            recommendation2.Event       = myEvent;
            recommendation2.reason      = recom;
            recommendation2.UserProfile = userProfile;
            recommendation2.UserGroup   = userGroup;
            recommendation2.created     = DateTime.Now;

            recommendationDao.Create(recommendation2);
        }
예제 #6
0
        private static long CreateCategory(string categoryName)
        {
            Category cat = new Category();

            cat.name = categoryName;
            categoryDao.Create(cat);
            return(cat.categoryId);
        }
예제 #7
0
        public void MyTestInitialize()
        {
            transaction = new TransactionScope();

            userProfile            = new UserProfile();
            userProfile.loginName  = userLoginName;
            userProfile.enPassword = PasswordEncrypter.Crypt(clearPassword);
            userProfile.firstName  = firstName;
            userProfile.lastName   = lastName;
            userProfile.email      = email;
            userProfile.language   = language;
            userProfile.country    = country;

            userProfileDao.Create(userProfile);

            category      = new Category();
            category.name = categoryName;

            categoryDao.Create(category);

            myEvent                 = new Event();
            myEvent.categoryId      = categoryId;
            myEvent.name            = name;
            myEvent.eventDate       = date;
            myEvent.review          = review;
            myEvent.Category        = category;
            myEvent.Comments        = new List <Comment>();
            myEvent.Recommendations = new List <Recommendation>();

            eventDao.Create(myEvent);

            label      = new Label();
            label.name = categoryName;

            labelDao.Create(label);

            comment             = new Comment();
            comment.content     = content;
            comment.Event       = myEvent;
            comment.Labels      = new List <Label>();
            comment.loginName   = userProfile.loginName;
            comment.UserProfile = userProfile;
            comment.commentDate = DateTime.Now;

            commentDao.Create(comment);

            comment2         = new Comment();
            comment2.content = content;
            comment2.Event   = myEvent;
            comment2.Labels  = new List <Label>();
            comment2.Labels.Add(label);
            comment2.loginName   = userProfile.loginName;
            comment2.UserProfile = userProfile;
            comment2.commentDate = date;

            commentDao.Create(comment2);
        }
        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);
        }
        public void GetAllCategoriesTest()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Category cat1 = new Category();
                cat1.name = "Music";
                Category cat2 = new Category();
                cat2.name = "Book";

                // Add categories
                categoryDao.Create(cat1);
                categoryDao.Create(cat2);

                // Extract all categories
                List <CategoryDetails> categories = categoryService.GetAllCategories();

                // Check the data
                Assert.AreEqual(cat1.name, categories[0].name);
                Assert.AreEqual(cat2.name, categories[1].name);
            }
        }
예제 #10
0
        public void AddRecommendationTest()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                ICollection <long> groups = new List <long>();
                long a = userService.RegisterUser("Patata", clearPassword,
                                                  new UserProfileDetails(firstName, lastName, email, language, country));

                Category category = new Category();
                category.name = categoryName;
                categoryDao.Create(category);

                Event myEvent = new Event();
                myEvent.categoryId = category.categoryId;
                myEvent.name       = name;
                myEvent.eventDate  = date;
                myEvent.review     = review;
                myEvent.Category   = category;
                eventDao.Create(myEvent);

                ICollection <Recommendation> r = userService.AddRecommendation(myEvent.eventId, groups, a, "hola");
                Assert.AreEqual(r.Count, 0);
            }
        }
예제 #11
0
파일: IEventDaoTest.cs 프로젝트: lob94/Mad
        public void MyTestInitialize()
        {
            transaction = new TransactionScope();

            category      = new Category();
            category.name = categoryName;

            categoryDao.Create(category);

            myEvent                 = new Event();
            myEvent.categoryId      = categoryId;
            myEvent.name            = name;
            myEvent.eventDate       = date;
            myEvent.review          = review;
            myEvent.Category        = category;
            myEvent.Comments        = new List <Comment>();
            myEvent.Recommendations = new List <Recommendation>();

            eventDao.Create(myEvent);
        }
예제 #12
0
        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);
        }