Beispiel #1
0
        public void WishList_Can_Add_Wish_For_User()
        {
            int ownerId = 1;

            WishList.Data.WishList list = Service.GetWishList(ownerId);

            int  numberOfWishes = list.Wishes.Count;
            Wish newWish        = new Wish()
            {
                Owner = new User()
                {
                    Id = ownerId
                },
                Name        = "Testönskning",
                Description = "Lorem ipsum dolor sit amet"
            };

            Service.SaveWish(newWish, true);
            list = Service.GetWishList(ownerId);

            Assert.AreEqual <int>(numberOfWishes + 1, list.Wishes.Count, "Number of wishes did not increase by one");

            Wish loadedWish = (from w in list.Wishes where w.Name == newWish.Name select w).SingleOrDefault <Wish>();

            Assert.IsNotNull(loadedWish, "Wish was null");
            Assert.AreEqual <string>(newWish.Description, loadedWish.Description, "Description did not match");
        }
Beispiel #2
0
        public void WishList_Can_Load_Wishes_For_User_By_Name()
        {
            string userName = "******";

            WishList.Data.WishList list = Service.GetWishList(userName);

            Assert.AreEqual <int>(1, list.UserId, "Wrong user id in loaded Wishlist");
            Assert.AreEqual <int>(5, list.Wishes.Count, "Number of wishes for user 1 was wrong");
        }
Beispiel #3
0
        public void WishList_Can_Load_Wishes_For_User_By_Id()
        {
            int ownerId = 1;

            WishList.Data.WishList list = Service.GetWishList(ownerId);

            Assert.AreEqual <int>(ownerId, list.UserId, "Wrong user id in loadedWish list");
            Assert.AreEqual <int>(5, list.Wishes.Count, "Number of wishes for user 1 was wrong");
        }
Beispiel #4
0
        public void WishList_Can_Remove_Wish_For_User()
        {
            int ownerId = 1;
            IWishListRepository repository = new TestWishListRepository();

            WishList.Data.WishList list = Service.GetWishList(ownerId);

            int  numberOfWishes  = list.Wishes.Count;
            Wish wishToBeRemoved = list.Wishes[0];

            Service.RemoveWish(wishToBeRemoved);
            list = Service.GetWishList(ownerId);

            Assert.AreEqual <int>(numberOfWishes - 1, list.Wishes.Count, "Number of wishes did not decrease by one when wish list was reloaded");
        }