public void Clear_ShouldClearAllTheItemsFromTheList()
        {
            //Arrange
            var fakeContext = CreateJONCookieInFakeHttpContextWith10ItemsInside();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            //Act
            cookiePersistence.ClearWishList();
            //Assert

            fakeContext.Response.Cookies["JON"].Expires.Should().BeBefore(DateTime.Now);
        }
        public void RemoveID_ShouldDoNothingIfCookieDoesntExistAndWeTryToDelete()
        {
            //Arrange
            var fakeContext = CreateFakeHttpContextWithoutTheCookie();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            var jewelID = 7;
            //Act
            cookiePersistence.RemoveID(jewelID);

            //Assert
            fakeContext.Response.Cookies["JON"].Should().BeNull();
        }
        public void RemoveID_ShouldRemoveIDFromTheCookieList()
        {
            //Arrange
            var fakeContext = CreateJONCookieInFakeHttpContextWith10ItemsInside();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            var jewelID = 7;
            //Act
            cookiePersistence.RemoveID(jewelID);

            //Assert
            var items = cookiePersistence.GetItemsOnWishList();
            items.Should().NotContain(7);
        }
        public void GetItemsInWishList_ShouldReturnIDsLikeInTheFakeCookieCollection()
        {
            //Arrange

             var fakeContext = CreateJONCookieInFakeHttpContextWith10ItemsInside();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            //Act

            var list = cookiePersistence.GetItemsOnWishList();

            //Assert

            list.Should().HaveCount(10);
        }
        public void SaveID_ShouldNotSaveTheSameIdTwice()
        {
            //Arrange
            var fakeContext = CreateJONCookieInFakeHttpContextWith10ItemsInside();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            var newID = fixture.CreateAnonymous<int>();
            //Act
            cookiePersistence.SaveID(newID);
            cookiePersistence.SaveID(newID);
            cookiePersistence.SaveID(newID);

            //Assert

            var list = cookiePersistence.GetItemsOnWishList();
            list.Should().HaveCount(11);
        }
        public void SaveID_ShouldSaveTheIDtoTheCookieAndCreateTheCookieIfCookieDoesntExists()
        {
            //Arrange
            var fakeContext = CreateFakeHttpContextWithoutTheCookie();

            var cookiePersistence = new CookieWishListPersistence(fakeContext);

            var newID = fixture.CreateAnonymous<int>();
            //Act
            cookiePersistence.SaveID(newID);

            //Assert
            fakeContext.Response.Cookies["JON"].Should().NotBeNull();
        }